sparql-examples

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

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

13

Retrieve all proteins belongong to the Hierarchical Orthologous Group (HOG) at the level 'Vertebrata' to which humans' CDIN1 gene belong, together with their gene name symbol if available.

Use at

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 ?HOG ?MEMBER ?GENE_LABEL
WHERE {
    ?HOG a orth:OrthologsCluster ;
      orth:hasHomologousMember ?node1 ;
      orth:hasTaxonomicRange ?taxRange .
    ?taxRange orth:taxRange 'Vertebrata' .
    ?node1 orth:hasHomologousMember* ?query ;
      orth:hasHomologousMember* ?MEMBER .
    ?MEMBER a orth:Protein .
    OPTIONAL {
        ?MEMBER rdfs:label ?GENE_LABEL .
    }
    ?query a orth:Protein ;
      orth:organism/obo:RO_0002162/up:scientificName 'Homo sapiens';
      rdfs:label 'CDIN1'.
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?GENE_LABEL"):::projected 
  v1("?HOG"):::projected 
  v5("?MEMBER"):::projected 
  v2("?node1")
  v4("?query")
  v3("?taxRange")
  a1((" "))
  a2((" "))
  c2(["orth:OrthologsCluster"]):::iri 
  c12(["Homo sapiens"]):::literal 
  c7(["orth:Protein"]):::iri 
  c6(["Vertebrata"]):::literal 
  c13(["CDIN1"]):::literal 
  v1 --"a"-->  c2
  v1 --"orth:hasHomologousMember"-->  v2
  v1 --"orth:hasTaxonomicRange"-->  v3
  v3 --"orth:taxRange"-->  c6
  v2 --"orth:hasHomologousMember"-->  v4
  v2 --"orth:hasHomologousMember"-->  v5
  v5 --"a"-->  c7
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v5 -."rdfs:label".->  v6
  end
  v4 --"a"-->  c7
  v4 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:scientificName"-->  c12
  v4 --"rdfs:label"-->  c13