BioModels Example SPARQL Queries

Here we list a set of interesting example queries

1. Number of curated models

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
PREFIX bqmodel: <http://biomodels.net/model-qualifiers#>
SELECT COUNT(?model) WHERE {
   ?model rdf:type sbmlrdf:SBMLModel .
   ?model bqmodel:curated true
}

 

2 Number of non-curated models

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
PREFIX bqmodel: <http://biomodels.net/model-qualifiers#>
SELECT COUNT(?model) WHERE {
?model rdf:type sbmlrdf:SBMLModel .
?model bqmodel:curated false
}

 

3 Number of triples

Click here to run this query at BioModels SPARQL end point.

SELECT (COUNT(*) AS ?no) { ?s ?p ?o }

 

4 Number of annotations

Click here to run this query at BioModels SPARQL end point.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT count (?annotation) WHERE {
   ?element ?qualifier ?annotation .
   ?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation
}

 

5 Number of distinct annotations

Click here to run this query at BioModels SPARQL end point.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT count (DISTINCT ?annotation) WHERE {
?element ?qualifier ?annotation .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation
}

 

6 Number of species

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT COUNT(?species) WHERE {
?species rdf:type sbmlrdf:Species
}

 

7 Number of distinct species calculated using annotations

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT count (DISTINCT ?annotation) WHERE {
?species rdf:type sbmlrdf:Species .
?species ?qualifier ?annotation .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation
}

 

8 Number of Reactions

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT COUNT(?reaction) WHERE {
?reaction rdf:type sbmlrdf:Reaction
}

 

9 Number of distinct species calculated using annotations

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT count (DISTINCT ?annotation) WHERE {
?reaction rdf:type sbmlrdf:Reaction .
?reaction ?qualifier ?annotation .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation
}

 

10 list all the species (with their names) which appear in the model Edelstein1996 - EPSP ACh event

Click here to run this query at BioModels SPARQL end point.

PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT ?speciesid ?name WHERE {
<http://identifiers.org/biomodels.db/BIOMD0000000001> sbmlrdf:species ?speciesid .
?speciesid sbmlrdf:name ?name
}

 

11 All model elements linked to the gene ontology term, acetylcholine-gated channel complex (GO:0005892)

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT ?modelElement ?elementType ?qualifier WHERE {
?modelElement ?qualifier <http://identifiers.org/go/GO:0005892> .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation .
?modelElement rdf:type ?elementType
}

 

12 All model elements that have annotations to CDC2 protein kinase (P06493 in UniProt)

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT ?modelElement ?elementType ?qualifier WHERE {
?modelElement ?qualifier <http://identifiers.org/uniprot/P06493> .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation .
?modelElement rdf:type ?elementType
}

 

13 All model elements that have annotations to any Reactome pathways

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT ?modelElement ?elementType ?qualifier ?value WHERE {
?modelElement ?qualifier ?value .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation .
?modelElement rdf:type ?elementType .
FILTER (REGEX(STR(?value), "http://identifiers.org/reactome/", "i"))
}

 

14 models which describe reactions involving calcium ions in the cytosol of rat

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
SELECT DISTINCT ?model ?reaction WHERE {
?model ?p1 <http://identifiers.org/taxonomy/10114> .
?model ?p2 ?element1 ;
?p3 ?element2 ;
?p4 ?reaction .
?element1 ?qualifier <http://identifiers.org/go/GO:0005829> .
?element2 ?qualifier <http://identifiers.org/chebi/CHEBI:29108> .
?reaction rdf:type sbmlrdf:Reaction
}

 

15 ChEMBL protein targets present in BIOMD0000000223

Click here to run this query at BioModels SPARQL end point.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
PREFIX cco: <http://rdf.ebi.ac.uk/terms/chembl#>
SELECT DISTINCT ?element ?annotation ?target WHERE
{
   <http://identifiers.org/biomodels.db/BIOMD0000000223> ?p ?element .
   ?p rdfs:subPropertyOf <http://identifiers.org/biomodels.vocabulary#sbmlElement> .
   ?element ?qualifier ?idorgannot .
   ?idorgannot owl:sameAs ?annotation .
   ?qualifier rdfs:subPropertyOf <http://identifiers.org/biomodels.vocabulary#sbmlAnnotation> .
   SERVICE <http://www.ebi.ac.uk/rdf/services/chembl/sparql>{
      ?target cco:hasTargetComponent ?targetcmpt .
      ?targetcmpt cco:targetCmptXref ?annotation
    }
}

 

16 Find models to compare with annotations to some proteins that are used as drug targets by lactic acid molecule (CHEMBL1200559).

Click here to run this query at BioModels SPARQL end point.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX sbmlrdf: <http://identifiers.org/biomodels.vocabulary#>
PREFIX cco: <http://rdf.ebi.ac.uk/terms/chembl#>
SELECT DISTINCT ?model ?annotation ?target WHERE {
SERVICE <http://www.ebi.ac.uk/rdf/services/chembl/sparql> {
?targetcmpt cco:targetCmptXref ?annotation .
?target cco:hasTargetComponent ?targetcmpt ;
cco:hasAssay ?assay .
?assay cco:hasActivity ?activity .
?activity cco:hasMolecule <http://rdf.ebi.ac.uk/resource/chembl/molecule/CHEMBL1200559>
}
?model ?p ?element.
?model rdf:type sbmlrdf:SBMLModel .
?element ?qualifier ?idorgAnnot .
?qualifier rdfs:subPropertyOf sbmlrdf:sbmlAnnotation .
?idorgAnnot owl:sameAs ?annotation
}


17. All model elements that relates to gene Tgfbr2 (ENSMUSG00000032440, transforming growth factor, beta receptor II).

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX atlasterms: <http://rdf.ebi.ac.uk/terms/atlas/>
PREFIX identifiers:<http://identifiers.org/ensembl/>
SELECT DISTINCT ?modelelement ?elementType ?qualifier ?uniprot WHERE {
SERVICE <http://www.ebi.ac.uk/rdf/services/atlas/sparql>{
?probe atlasterms:dbXref identifiers:ENSMUSG00000032440 .
?probe atlasterms:dbXref ?uniprot
}
?idorgannot owl:sameAs ?uniprot.
?modelelement ?qualifier ?idorgannot.
?qualifier rdfs:subPropertyOf <http://identifiers.org/biomodels.vocabulary#sbmlAnnotation> .
?modelelement rdf:type ?elementType
}


18. Reactome pathways that can be related to model http://identifiers.org/biomodels.db/BIOMD0000000005.

Click here to run this query at BioModels SPARQL end point.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX biopax3:<http://www.biopax.org/release/biopax-level3.owl#>
PREFIX sbmlrdf:<http://identifiers.org/biomodels.vocabulary#>

SELECT DISTINCT ?pathway ?pathwayname ?annotation WHERE
{
<http://identifiers.org/biomodels.db/BIOMD0000000005> sbmlrdf:species ?s . 
?s ?p ?idorgannot .
?idorgannot owl:sameAs ?annotation .

SERVICE <http://www.ebi.ac.uk/rdf/services/reactome/sparql>{
?pathway rdf:type biopax3:Pathway .
?pathway biopax3:displayName ?pathwayname .
?pathway biopax3:pathwayComponent ?reaction .
?reaction rdf:type biopax3:BiochemicalReaction .
{
{?reaction ?rel ?protein .}
UNION
{
?reaction ?rel ?complex .
?complex rdf:type biopax3:Complex .
?complex ?comp ?protein .
}
}
?protein rdf:type biopax3:Protein .
?protein biopax3:entityReference ?annotation
}
}