The following guide presents collection of LinkedData? SPARQL Query Examples Using the Gene Ontology:
PREFIX psys: <http://proton.semanticweb.org/2006/05/protons#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX gene: <http://linkedlifedata.com/resource/entrezgene/>
SELECT *
WHERE
{
?gene rdf:type gene:Gene .
?gene gene:goTerm ?go .
}
LIMIT 10
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
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 "Phytochrome A" .
?i biopax2:PARTICIPANTS ?p1 .
?p1 biopax2:PHYSICAL-ENTITY ?interactor_uri .
?interactor_uri rdf:type biopax2:protein .
?interactor_uri biopax2:NAME ?interactor_name .
}
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?interaction ?protein
WHERE
{
?interaction rdf:type biopax2:interaction .
?interaction biopax2:PARTICIPANTS ?p .
?p biopax2:PHYSICAL-ENTITY ?protein .
?protein biopax2:NAME "Phytochrome A" .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX uniprot: <http://purl.uniprot.org/core/>
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 <http://purl.uniprot.org/go/0006954>.
?protein uniprot:recommendedName ?name .
?name uniprot:fullName ?fullname .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX uniprot: <http://purl.uniprot.org/core/>
PREFIX drugbank: <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/>
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 <http://purl.uniprot.org/go/0006954>.
?protein uniprot:recommendedName ?name.
?name uniprot:fullName ?fullname .
?protein uniprot:mnemonic ?mnemonic .
?target drugbank:swissprotName ?mnemonic .
}
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX uniprot: <http://purl.uniprot.org/core/>
PREFIX drugbank: <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/>
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, "asthma", "i"))
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX uniprot: <http://purl.uniprot.org/core/>
PREFIX drugbank: <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/>
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 <http://purl.uniprot.org/go/0006954>.
?protein uniprot:recommendedName ?name.
?name uniprot:fullName ?fullname .
?target skos:exactMatch ?protein .
?drug drugbank:target ?target .
?drug drugbank:genericName ?drugname .
?drug drugbank:indication ?indication .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX gene: <http://linkedlifedata.com/resource/entrezgene/>
PREFIX uniprot: <http://purl.uniprot.org/uniprot/core/>
PREFIX core: <http://purl.uniprot.org/core/>
SELECT ?genedescription ?taxonomy
WHERE
{
?geneid gene:description ?genedescription .
?geneid gene:uniprotAccession ?uniprotaccession .
?geneid gene:chromosome 'Y' .
?uniprotaccession core:organism ?taxonomy .
?taxonomy core:scientificName 'Homo sapiens' .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gene: <http://linkedlifedata.com/resource/entrezgene/>
PREFIX core: <http://purl.uniprot.org/core/>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
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 'Homo sapiens' .
?geneid gene:uniprotAccession ?uniprotaccession .
?geneid gene:description ?genedescription .
?geneid gene:chromosome 'Y' .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gene: <http://linkedlifedata.com/resource/entrezgene/>
PREFIX core: <http://purl.uniprot.org/core/>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX lifeskim: <http://linkedlifedata.com/resource/lifeskim/>
PREFIX umls: <http://linkedlifedata.com/resource/umls/>
PREFIX pubmed: <http://linkedlifedata.com/resource/pubmed/>
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 <http://purl.uniprot.org/taxonomy/9606> .
?geneid gene:uniprotAccession ?uniprotaccession .
?geneid gene:description ?genedescription .
?geneid gene:pubmed ?pmid .
?geneid gene:chromosome 'Y' .
?pmid lifeskim:mentions ?umlsid .
?umlsid skos:prefLabel ?prefLabel .
?umlsid rdf:type <http://linkedlifedata.com/resource/semanticnetwork/id/T063> .
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gene: <http://linkedlifedata.com/resource/entrezgene/>
PREFIX core: <http://purl.uniprot.org/core/>
PREFIX biopax2: <http://www.biopax.org/release/biopax-level2.owl#>
PREFIX lifeskim: <http://linkedlifedata.com/resource/lifeskim/>
PREFIX umls: <http://linkedlifedata.com/resource/umls/>
PREFIX pubmed: <http://linkedlifedata.com/resource/pubmed/>
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 <http://purl.uniprot.org/taxonomy/9606> .
?geneid gene:uniprotAccession ?uniprotaccession .
?geneid gene:description ?genedescription .
?geneid gene:pubmed ?pmid .
?geneid gene:chromosome 'Y' .
?pmid lifeskim:mentions ?umlsid .
?umlsid skos:prefLabel 'Transfection' .
?umlsid skos:prefLabel ?prefLabel .
}
PREFIX umls-concept: <http://linkedlifedata.com/resource/umls/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX lld: <http://linkedlifedata.com/resource/>
SELECT ?concept ?prefLabel
WHERE
{
{ ?concept skos:prefLabel "Leukocytes" .
?concept skos:inScheme lld:umls .
?concept skos:prefLabel ?prefLabel }
UNION
{ ?concept1 skos:prefLabel "Leukocytes" .
?concept1 skos:inScheme lld:umls .
?concept skos:broaderTransitive ?concept1 .
?concept skos:inScheme lld:umls .
?concept skos:prefLabel ?prefLabel }
}
PREFIX umls-concept: <http://linkedlifedata.com/resource/umls/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX lld: <http://linkedlifedata.com/resource/>
SELECT ?concept ?prefLabel
WHERE
{
{ ?concept skos:prefLabel "Respiration Disorders" .
?concept skos:inScheme lld:umls .
?concept skos:prefLabel ?prefLabel }
UNION
{ ?concept1 skos:prefLabel "Respiration Disorders" .
?concept1 skos:inScheme lld:umls .
?concept skos:broaderTransitive ?concept1 .
?concept skos:inScheme lld:umls .
?concept skos:prefLabel ?prefLabel }
}