| 1 | Dasha documentation |
| 2 | |
| 3 | === How to configure and run query expansion in molgenis4phenotype === |
| 4 | 1) download the ontologies from http://bioportal.bioontology.org/ |
| 5 | |
| 6 | You should download |
| 7 | |
| 8 | * (!http://rest.bioontology.org/bioportal/ontologies/download/44307?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff) |
| 9 | |
| 10 | * Human Disease (!http://rest.bioontology.org/bioportal/ontologies/download/44309?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff) |
| 11 | |
| 12 | * NCI Thesaurus (!http://rest.bioontology.org/bioportal/ontologies/download/42838?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff) |
| 13 | |
| 14 | MeSH can be taken from biobank_search\!WebContent\WEB-INF |
| 15 | |
| 16 | 2) Change the directory names: |
| 17 | |
| 18 | * in DBIndexPlugin: LUCENE_INDEX_DIRECTORY |
| 19 | |
| 20 | * in !OntoCatIndexPlugin2: LUCENE_ONTOINDEX_DIRECTORY, ''ONTOLOGIES_DIRECTORY'' |
| 21 | |
| 22 | 3) Create a Molgenis database |
| 23 | |
| 24 | 4) Set the VM arguments for !OntoCatIndexPlugin2.java to –Xms1024M –Xmx1024M |
| 25 | |
| 26 | 5) Run the project |
| 27 | |
| 28 | 6) Upload the data into the database |
| 29 | |
| 30 | 7) In ''DB Index and Search'' press ''Build Index'' to build the index of your database |
| 31 | |
| 32 | 8) In ''Index OntoCAT'' '' ''press ''Build Ontocat Index'' |
| 33 | |
| 34 | 9) Now in ''DB Index and Search'' you can search your database by pressing ''Search Index'' or search your database with query expansion by choosing appropriate ontologies and pressing ''Search with query expansion'' |
| 35 | |
| 36 | === Project Description === |
| 37 | '''public class DBIndexPlugin''' |
| 38 | |
| 39 | the plugin to index and search the database (with or without query expansion): |
| 40 | |
| 41 | @param LUCENE_INDEX_DIRECTORY – empty directory to put index files in |
| 42 | |
| 43 | '''public void buildIndexAllTables(Database db)''' –makes the index |
| 44 | |
| 45 | '''public void SearchAllDBTablesIndex(Database db)''' –searches the index (in “description” field) |
| 46 | |
| 47 | '''public void !ExpandQuery(Database db)''' –expands the query by calling expand(!OntologiesForExpansion)from !OntocatQueryExpansion_lucene |
| 48 | |
| 49 | '''public class !OntocatQueryExpansion_lucene''' |
| 50 | |
| 51 | '''public List<String> parseQuery(String query)''' –parses the query by ignoring the punctuation, splitting the query by ‘ ‘, Boolean operators, reading phrases in quotation marks as a single unit. Calls public List<String> chunk (List<String> words) |
| 52 | |
| 53 | '''public List<String> chunk (List<String> words) '''– chunks the query (List<String> words) into all possible n-grams (combinations of subsequent query words) (n ranges from 1 to words.size()) |
| 54 | |
| 55 | '''public void expand(List<String> ontologiesToUse) '''– finds expansion terms in ontologiesToUse. For every n-gram of the chunked query searches it in ontologies, if found, adds expansion terms to initial query list |
| 56 | |
| 57 | '''public String output(List<String> parsed) '''– constructs a new query of the initial query list, adding expansion terms with lower weight, using the same Boolean operators and quotes (if any) as in user query. |
| 58 | |
| 59 | '''public class !OntoCatIndexPlugin2''' |
| 60 | |
| 61 | the plugin that indexes and searches the ontologies |
| 62 | |
| 63 | @param LUCENE_ONTOINDEX_DIRECTORY - empty directory to put index files in |
| 64 | |
| 65 | @param ''ONTOLOGIES_DIRECTORY ''– the directory, where the ontologies are stored |
| 66 | |
| 67 | @param ''ontologyNamesMap ''– the list of ontologies and the correspondence between ontology names and file names containing them |
| 68 | |
| 69 | '''public String !SearchIndexOntocat(String query, List<String> ontologyLabels) '''– searches the query in the ontologies with names ontologyLabels. Returns a string “!term:expansion term1; expansion term2;… expansion termN;” |
| 70 | |
| 71 | '''public void buildIndexOntocat() '''- builds the ontology index. Pairs (!term:expansion) are stored for each term of each ontology |
| 72 | |
| 73 | ''' ''' |