Example Solr Queries: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(23 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
This page has examples of various kinds of queries possible on the GO Solr document store (GOlr), | This page has examples of various kinds of queries possible on the GO Solr document store (GOlr), | ||
Preliminary schema information can be found in the [http://geneontology.svn.sourceforge.net/viewvc/geneontology/java/gold/solr/conf/schema.xml?content-type=text%2Fplain repo]. | |||
Preliminary information about the schema can be found on [http://geneontology.svn.sourceforge.net/viewvc/geneontology/java/gold/solr/conf/schema.xml?content-type=text%2Fplain SF.net]. | |||
=Usage= | =Usage= | ||
Line 7: | Line 10: | ||
The current testing ground for GOlr is: | The current testing ground for GOlr is: | ||
http:// | http://golr.berkeleybop.org/ | ||
This is a naked Solr server; you can access it with any http client, including a web browser. In addition, there is an experimental version of | This is a naked Solr server; you can access it with any http client, including a web browser. In addition, there is an experimental version of Gannet that can talk to Solr (select a Solr mirror from the list): | ||
http://amigo2.berkeleybop.org/ | http://amigo2.berkeleybop.org/gannet | ||
This method is currently a little slower, but may make learning a little bit easier. | This method is currently a little slower, but may make learning a little bit easier. | ||
Line 20: | Line 23: | ||
URL | URL | ||
http:// | http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=10&indent=on&q=*:*&start=0 | ||
Gannet | |||
q=*:* | q=*:* | ||
Line 28: | Line 31: | ||
URL | URL | ||
http:// | http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=20&indent=on&q=*:*&start=0 | ||
Gannet | |||
q=*:* | q=*:* | ||
rows=20 | rows=20 | ||
==All bioentities (50-100)== | |||
URL | |||
http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=50&indent=on&q=*:*&fq=document_category:%22bioentity%22&start=50 | |||
Gannet | |||
q=*:* | |||
fq=document_category:"bioentity" | |||
rows=50 | |||
start=50 | |||
==Find term information for GO ID, for example "GO:0005634"== | |||
URL | |||
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=1&q=id:%22GO:0005634%22&fq=document_category:%22ontology_class%22 | |||
Gannet | |||
q=id:"GO:0005634" | |||
fq=document_category:"ontology_class" | |||
==Find term by (preferred) name, for example "nucleus"== | |||
URL | |||
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=1&q=label:%22nucleus%22&fq=document_category:%22ontology_class%22 | |||
Gannet | |||
q=label:"nucleus" | |||
fq=document_category:"ontology_class" | |||
rows=1 | |||
==To find (first 50) obsolete terms== | |||
URL | |||
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=50&q=document_category:%22ontology_class%22&fq=is_obsolete:%22true%22 | |||
Gannet | |||
q=document_category:"ontology_class" | |||
fq=is_obsolete:"true" | |||
rows=50 | |||
==Counts of types in IEA annotations (illustrates the use of solr 'facets')== | |||
URL | |||
http://golr.berkeleybop.org/select?fq=document_category:annotation&rows=0&json.nl=arrarr&facet.sort=count&q=*:*&indent=on&facet.field=type&fl=*%2Cscore&facet=true&start=0&wt=json&facet.mincount=1 | |||
Gannet | |||
q=*:* | |||
fq=document_category:annotation | |||
facet=true | |||
facet.field=type | |||
facet.sort=count | |||
facet.mincount=1 | |||
rows=0 | |||
==IEA Annotations from TAIR (first 10)== | ==IEA Annotations from TAIR (first 10)== | ||
URL | URL | ||
http:// | http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=10&indent=on&q=*:*&fq=document_category:annotation&start=0 | ||
Gannet | |||
q=*:* | q=*:* | ||
fq=document_category:annotation | fq=document_category:annotation | ||
Line 45: | Line 102: | ||
fq=evidence_type:"IEA" | fq=evidence_type:"IEA" | ||
== | ==Genes to both "macromolecule biosynthetic process" and "cellular response to stress" (first 10, plus facets)== | ||
URL | URL | ||
http:// | http://golr.berkeleybop.org/select?qt=standard&indent=on&wt=json&version=2.2&rows=10&start=0&fl=*%2Cscore&facet=true&facet.field=type&facet.field=taxon&facet.field=isa_partof_closure_label&fq=&q=*:*&fq=document_category:"bioentity"&fq=isa_partof_closure_label:"macromolecule biosynthetic process"&fq=isa_partof_closure_label:"cellular response to stress" | ||
Gannet (facets generated, but not shown) | |||
q=*:* | q=*:* | ||
fq=document_category:" | fq=document_category:"bioentity" | ||
fq= | fq=isa_partof_closure_label:"macromolecule biosynthetic process" | ||
fq= | fq=isa_partof_closure_label:"cellular response to stress" | ||
facet=true | |||
facet.field=type | |||
facet.field=taxon | |||
facet.field=isa_partof_closure_label | |||
==Distribution by species of annotations to sensory perception of smell== | |||
Gannet (facets generated, but not shown) | |||
q=*:* | |||
fq=document_category:"bioentity" | |||
fq=isa_partof_closure_label:"sensory perception of smell" | |||
facet=true | |||
facet.field=taxon_label | |||
facet.mincount=1 | |||
rows=0 | |||
[[Category:Database]] |
Latest revision as of 15:43, 27 May 2015
Overview
This page has examples of various kinds of queries possible on the GO Solr document store (GOlr), Preliminary schema information can be found in the repo.
Preliminary information about the schema can be found on SF.net.
Usage
The current testing ground for GOlr is:
http://golr.berkeleybop.org/
This is a naked Solr server; you can access it with any http client, including a web browser. In addition, there is an experimental version of Gannet that can talk to Solr (select a Solr mirror from the list):
http://amigo2.berkeleybop.org/gannet
This method is currently a little slower, but may make learning a little bit easier.
Example Queries
All documents (first 10)
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=10&indent=on&q=*:*&start=0
Gannet
q=*:*
All documents (first 20)
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=20&indent=on&q=*:*&start=0
Gannet
q=*:* rows=20
All bioentities (50-100)
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=50&indent=on&q=*:*&fq=document_category:%22bioentity%22&start=50
Gannet
q=*:* fq=document_category:"bioentity" rows=50 start=50
Find term information for GO ID, for example "GO:0005634"
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=1&q=id:%22GO:0005634%22&fq=document_category:%22ontology_class%22
Gannet
q=id:"GO:0005634" fq=document_category:"ontology_class"
Find term by (preferred) name, for example "nucleus"
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=1&q=label:%22nucleus%22&fq=document_category:%22ontology_class%22
Gannet
q=label:"nucleus" fq=document_category:"ontology_class" rows=1
To find (first 50) obsolete terms
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*&version=2.2&wt=json&indent=on&rows=50&q=document_category:%22ontology_class%22&fq=is_obsolete:%22true%22
Gannet
q=document_category:"ontology_class" fq=is_obsolete:"true" rows=50
Counts of types in IEA annotations (illustrates the use of solr 'facets')
URL
http://golr.berkeleybop.org/select?fq=document_category:annotation&rows=0&json.nl=arrarr&facet.sort=count&q=*:*&indent=on&facet.field=type&fl=*%2Cscore&facet=true&start=0&wt=json&facet.mincount=1
Gannet
q=*:* fq=document_category:annotation facet=true facet.field=type facet.sort=count facet.mincount=1 rows=0
IEA Annotations from TAIR (first 10)
URL
http://golr.berkeleybop.org/select?qt=standard&fl=*%2Cscore&version=2.2&wt=json&rows=10&indent=on&q=*:*&fq=document_category:annotation&start=0
Gannet
q=*:* fq=document_category:annotation fq=source:"TAIR" fq=evidence_type:"IEA"
Genes to both "macromolecule biosynthetic process" and "cellular response to stress" (first 10, plus facets)
URL
http://golr.berkeleybop.org/select?qt=standard&indent=on&wt=json&version=2.2&rows=10&start=0&fl=*%2Cscore&facet=true&facet.field=type&facet.field=taxon&facet.field=isa_partof_closure_label&fq=&q=*:*&fq=document_category:"bioentity"&fq=isa_partof_closure_label:"macromolecule biosynthetic process"&fq=isa_partof_closure_label:"cellular response to stress"
Gannet (facets generated, but not shown)
q=*:* fq=document_category:"bioentity" fq=isa_partof_closure_label:"macromolecule biosynthetic process" fq=isa_partof_closure_label:"cellular response to stress" facet=true facet.field=type facet.field=taxon facet.field=isa_partof_closure_label
Distribution by species of annotations to sensory perception of smell
Gannet (facets generated, but not shown)
q=*:* fq=document_category:"bioentity" fq=isa_partof_closure_label:"sensory perception of smell" facet=true facet.field=taxon_label facet.mincount=1 rows=0