<docbook><section><title>VirtSPARQLGeneExamplesCollecton</title><title>LinkedData SPARQL Reference Collection Using the Gene Ontology</title><ulink url="LinkedData">LinkedData</ulink> SPARQL Reference Collection Using the Gene Ontology
<para>The following guide presents collection of <ulink url="LinkedData">LinkedData</ulink> SPARQL Query Examples Using the Gene Ontology:</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find Genes and their links to Gene Ontology terms</bridgehead>
 <programlisting>PREFIX psys: &lt;http://proton.semanticweb.org/2006/05/protons#&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX gene: &lt;http://linkedlifedata.com/resource/entrezgene/&gt;

SELECT *
WHERE 
  {
    ?gene rdf:type gene:Gene . 
    ?gene gene:goTerm ?go .           
  }
LIMIT 10
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/14PKiJh">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/YnSgE5">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find interacting partners for specified protein</bridgehead>
 <programlisting>PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;

SELECT DISTINCT ?protein ?interactor_uri ?interactor_name
WHERE 
  {
    ?i rdf:type biopax2:interaction .
    ?i biopax2:PARTICIPANTS ?p .
    ?p biopax2:PHYSICAL-ENTITY ?protein .
    ?protein biopax2:NAME &quot;Phytochrome A&quot; .
    ?i biopax2:PARTICIPANTS ?p1 .
    ?p1 biopax2:PHYSICAL-ENTITY ?interactor_uri .
    ?interactor_uri rdf:type biopax2:protein .
    ?interactor_uri biopax2:NAME ?interactor_name .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/X4Hnqw">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/12IxrtU">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find Interactions where Participates Specified Protein</bridgehead>
 <programlisting>PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;

SELECT ?interaction ?protein
WHERE 
  {
    ?interaction rdf:type biopax2:interaction .
    ?interaction biopax2:PARTICIPANTS ?p .
    ?p biopax2:PHYSICAL-ENTITY ?protein .
    ?protein biopax2:NAME &quot;Phytochrome A&quot; .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/14PKp7H">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/Vd7n5N">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Proteins That are Linked to a Curated Interaction from the Literature and to Inflammatory Response</bridgehead>
 <programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX uniprot: &lt;http://purl.uniprot.org/core/&gt;

SELECT distinct ?fullname
WHERE 
  {
    ?interaction rdf:type biopax2:physicalInteraction .
    ?interaction biopax2:PARTICIPANTS ?participant .
    ?participant biopax2:PHYSICAL-ENTITY ?physicalEntity .
    ?physicalEntity skos:exactMatch ?protein .
    ?protein uniprot:classifiedWith &lt;http://purl.uniprot.org/go/0006954&gt;.
    ?protein uniprot:recommendedName ?name .
    ?name uniprot:fullName ?fullname .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/WGnABt">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/WXFRbP">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Proteins that are Linked to a Curated Molecular Interaction, to Inflammatory Response and to a Target of Existing Drug</bridgehead>
<para> </para>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX uniprot: &lt;http://purl.uniprot.org/core/&gt;
PREFIX drugbank: &lt;http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/&gt;

SELECT distinct ?fullname
WHERE 
  {
    ?interaction rdf:type biopax2:physicalInteraction .
    ?interaction biopax2:PARTICIPANTS ?participant .
    ?participant biopax2:PHYSICAL-ENTITY ?physicalEntity .
    ?physicalEntity skos:exactMatch ?protein .
    ?protein uniprot:classifiedWith &lt;http://purl.uniprot.org/go/0006954&gt;.
    ?protein uniprot:recommendedName ?name.
    ?name uniprot:fullName ?fullname .
    ?protein uniprot:mnemonic ?mnemonic .
    ?target drugbank:swissprotName ?mnemonic .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/12aOyoe">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/YnSo6C">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Fund Drugs Related to Asthma that are Linked to a Molecular Interaction</bridgehead>
<para> </para>
<programlisting>PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX uniprot: &lt;http://purl.uniprot.org/core/&gt;
PREFIX drugbank: &lt;http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/&gt;

SELECT distinct ?fullname ?drugname ?indication
WHERE 
  {
    ?participant biopax2:PHYSICAL-ENTITY ?physicalEntity .
    ?physicalEntity skos:semanticRelation ?protein .
    ?protein uniprot:recommendedName ?name.
    ?name uniprot:fullName ?fullname .
    ?target skos:exactMatch ?protein .
    ?drug drugbank:target ?target.
    ?drug drugbank:genericName ?drugname.
    ?drug drugbank:indication ?indication.
    filter(regex(?indication, &quot;asthma&quot;, &quot;i&quot;))
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/Z7o8Tq">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/Y9idZe">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find Drugs Related to Asthma that are Linked to a Curated Molecular Interaction in the Literature where the Protein is Known to cause Inflammatory Response</bridgehead>
<para> </para>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX uniprot: &lt;http://purl.uniprot.org/core/&gt;
PREFIX drugbank: &lt;http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/&gt;

SELECT DISTINCT ?fullname ?drugname
WHERE 
  {
    ?interaction rdf:type biopax2:physicalInteraction .
    ?interaction biopax2:PARTICIPANTS ?participant .
    ?participant biopax2:PHYSICAL-ENTITY ?physicalEntity .
    ?physicalEntity skos:exactMatch ?protein .
    ?protein uniprot:classifiedWith &lt;http://purl.uniprot.org/go/0006954&gt;.
    ?protein uniprot:recommendedName ?name.
    ?name uniprot:fullName ?fullname .
    ?target skos:exactMatch ?protein .
    ?drug drugbank:target ?target .
    ?drug drugbank:genericName ?drugname .
    ?drug drugbank:indication ?indication .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/X1PrLQ">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/XFR7c9">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Located in Y-chromosome Human Genes</bridgehead>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX gene: &lt;http://linkedlifedata.com/resource/entrezgene/&gt;
PREFIX uniprot: &lt;http://purl.uniprot.org/uniprot/core/&gt;
PREFIX core: &lt;http://purl.uniprot.org/core/&gt;

SELECT ?genedescription ?taxonomy
WHERE 
  {
    ?geneid gene:description ?genedescription .
    ?geneid gene:uniprotAccession ?uniprotaccession .
    ?geneid gene:chromosome &#39;Y&#39; .
    ?uniprotaccession core:organism ?taxonomy .
    ?taxonomy core:scientificName &#39;Homo sapiens&#39; .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/WXGlP3">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/Xyl5Nc">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Located in Y-chromosome Human Genes with Known Molecular Interactions</bridgehead>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX gene: &lt;http://linkedlifedata.com/resource/entrezgene/&gt;
PREFIX core: &lt;http://purl.uniprot.org/core/&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;

SELECT ?genedescription ?taxonomy ?interactionname
WHERE 
  {
    ?interaction rdf:type biopax2:interaction .
    ?interaction biopax2:PARTICIPANTS ?p .
    ?interaction biopax2:NAME ?interactionname .
    ?p biopax2:PHYSICAL-ENTITY ?protein .
    ?protein skos:exactMatch ?uniprotaccession .
    ?uniprotaccession core:organism ?taxonomy .
    ?taxonomy core:scientificName &#39;Homo sapiens&#39; .
    ?geneid gene:uniprotAccession ?uniprotaccession .
    ?geneid gene:description ?genedescription .
    ?geneid gene:chromosome &#39;Y&#39; .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/V2Q6hS">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/12aOQLR">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Located in Y-chromosome, Human Genes with Known Molecular Interactions, which are analyzed with Molecular Techniques</bridgehead>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX gene: &lt;http://linkedlifedata.com/resource/entrezgene/&gt;
PREFIX core: &lt;http://purl.uniprot.org/core/&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX lifeskim: &lt;http://linkedlifedata.com/resource/lifeskim/&gt;
PREFIX umls: &lt;http://linkedlifedata.com/resource/umls/&gt;
PREFIX pubmed: &lt;http://linkedlifedata.com/resource/pubmed/&gt;

SELECT distinct ?genedescription ?prefLabel
WHERE 
  {
    ?interaction rdf:type biopax2:interaction .
    ?interaction biopax2:PARTICIPANTS ?p .
    ?p biopax2:PHYSICAL-ENTITY ?protein .
    ?protein skos:exactMatch ?uniprotaccession .
    ?uniprotaccession core:organism &lt;http://purl.uniprot.org/taxonomy/9606&gt; .
    ?geneid gene:uniprotAccession ?uniprotaccession .
    ?geneid gene:description ?genedescription .
    ?geneid gene:pubmed ?pmid .
    ?geneid gene:chromosome &#39;Y&#39; .
    ?pmid lifeskim:mentions ?umlsid .
    ?umlsid skos:prefLabel ?prefLabel .
    ?umlsid rdf:type &lt;http://linkedlifedata.com/resource/semanticnetwork/id/T063&gt; . 
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/WXGPEP">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/XylbVb">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Find All Located in Y-chromosome, Human Genes with Known Molecular Interactions, which are analyzed with &#39;Transfection&#39;</bridgehead>
<programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX gene: &lt;http://linkedlifedata.com/resource/entrezgene/&gt;
PREFIX core: &lt;http://purl.uniprot.org/core/&gt;
PREFIX biopax2: &lt;http://www.biopax.org/release/biopax-level2.owl#&gt;
PREFIX lifeskim: &lt;http://linkedlifedata.com/resource/lifeskim/&gt;
PREFIX umls: &lt;http://linkedlifedata.com/resource/umls/&gt;
PREFIX pubmed: &lt;http://linkedlifedata.com/resource/pubmed/&gt;

SELECT distinct ?genedescription ?prefLabel
WHERE 
  {
    ?interaction rdf:type biopax2:interaction .
    ?interaction biopax2:PARTICIPANTS ?p .
    ?p biopax2:PHYSICAL-ENTITY ?protein .
    ?protein skos:exactMatch ?uniprotaccession .
    ?uniprotaccession core:organism &lt;http://purl.uniprot.org/taxonomy/9606&gt; .
    ?geneid gene:uniprotAccession ?uniprotaccession .
    ?geneid gene:description ?genedescription .
    ?geneid gene:pubmed ?pmid .
    ?geneid gene:chromosome &#39;Y&#39; .
    ?pmid lifeskim:mentions ?umlsid .
    ?umlsid skos:prefLabel &#39;Transfection&#39; .
    ?umlsid skos:prefLabel ?prefLabel .
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/X4HVgd">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/Vd7GO2">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Show All White blood Cell Types</bridgehead>
<programlisting>PREFIX umls-concept: &lt;http://linkedlifedata.com/resource/umls/id/&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX lld: &lt;http://linkedlifedata.com/resource/&gt;

SELECT ?concept ?prefLabel
WHERE 
  {
    { ?concept skos:prefLabel &quot;Leukocytes&quot; .
      ?concept skos:inScheme lld:umls .
      ?concept skos:prefLabel ?prefLabel }
    UNION
    { ?concept1 skos:prefLabel &quot;Leukocytes&quot; .
      ?concept1 skos:inScheme lld:umls .
      ?concept skos:broaderTransitive ?concept1 .
      ?concept skos:inScheme lld:umls . 
      ?concept skos:prefLabel ?prefLabel }
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/11DxdF9">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/VQHXxa">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Example Show Respirations Disorder Types</bridgehead>
<programlisting>PREFIX umls-concept: &lt;http://linkedlifedata.com/resource/umls/id/&gt;
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX lld: &lt;http://linkedlifedata.com/resource/&gt;

SELECT ?concept ?prefLabel
WHERE 
  {
    { ?concept skos:prefLabel &quot;Respiration Disorders&quot; .
      ?concept skos:inScheme lld:umls .
      ?concept skos:prefLabel ?prefLabel }
    UNION
    { ?concept1 skos:prefLabel &quot;Respiration Disorders&quot; .
      ?concept1 skos:inScheme lld:umls .
      ?concept skos:broaderTransitive ?concept1 .
      ?concept skos:inScheme lld:umls . 
      ?concept skos:prefLabel ?prefLabel }
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/WXKUJ2">View the SPARQL Query Definition via SPARQL Protocol URL</ulink> </listitem>
<listitem><ulink url="http://bit.ly/VQI0ZR">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://linkedlifedata.com/sparql">The Linked Life Data SPARQL Endpoint</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html">Virtuoso Documentation</ulink></listitem>
</itemizedlist><para> </para>
</section></docbook>