sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

007

What are the anatomical entities where the mouse gene APOC1 is expressed in the adult stages?

Use at

PREFIX efo: <http://www.ebi.ac.uk/efo/>
PREFIX genex: <http://purl.org/genex#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT DISTINCT ?geneName ?anatName ?anat ?stageName ?stage WHERE {
    ?seq a orth:Gene ;
        rdfs:label ?geneName ;
        genex:isExpressedIn ?condition ;
        orth:organism ?organism .
    ?condition a genex:ExpressionCondition ;
        genex:hasAnatomicalEntity ?anat ;
        genex:hasAnatomicalEntity obo:GO_0005575 ;
        genex:hasDevelopmentalStage ?stage .
    ?anat a genex:AnatomicalEntity ;
        rdfs:label ?anatName .
    ?stage a efo:EFO_0000399 ; # developmental stage
        rdfs:label ?stageName .
    ?organism obo:RO_0002162 ?taxon . # in taxon
    ?taxon a up:Taxon ;
        up:commonName "mouse" .
    FILTER (CONTAINS(LCASE(?stageName), 'adult' ))
    FILTER (lcase(str(?geneName)) = "apoc1" ).
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?anat"):::projected 
  v8("?anatName"):::projected 
  v4("?condition")
  v1("?geneName"):::projected 
  v5("?organism")
  v3("?seq")
  v7("?stage"):::projected 
  v2("?stageName"):::projected 
  v9("?taxon")
  c13(["efo:EFO_0000399"]):::iri 
  c8(["genex:ExpressionCondition"]):::iri 
  c10(["obo:GO_0005575"]):::iri 
  c4(["orth:Gene"]):::iri 
  c15(["up:Taxon"]):::iri 
  c12(["genex:AnatomicalEntity"]):::iri 
  c17(["mouse"]):::literal 
  f0[["lower-case(str(?geneName)) = 'apoc1'"]]
  f0 --> v1
  f1[["contains(lower-case(?stageName),'adult')"]]
  f1 --> v2
  v3 --"a"-->  c4
  v3 --"rdfs:label"-->  v1
  v3 --"genex:isExpressedIn"-->  v4
  v3 --"orth:organism"-->  v5
  v4 --"a"-->  c8
  v4 --"genex:hasAnatomicalEntity"-->  v6
  v4 --"genex:hasAnatomicalEntity"-->  c10
  v4 --"genex:hasDevelopmentalStage"-->  v7
  v6 --"a"-->  c12
  v6 --"rdfs:label"-->  v8
  v7 --"a"-->  c13
  v7 --"rdfs:label"-->  v2
  v5 --"obo:RO_0002162"-->  v9
  v9 --"a"-->  c15
  v9 --"up:commonName"-->  c17