sparql-examples

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

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

12

Retrieve all orthologs between mouse and rabbit, together with their HOG id

Use at

PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT DISTINCT ?MOUSE_PROTEIN ?RABIT_PROTEIN ?HOG
WHERE {
    ?HOG a orth:OrthologsCluster ;
        orth:hasHomologousMember ?node1 ;
        orth:hasHomologousMember ?node2 .
    ?node2 orth:hasHomologousMember* ?RABIT_PROTEIN .
    ?node1 orth:hasHomologousMember* ?MOUSE_PROTEIN .
    ?MOUSE_PROTEIN a orth:Protein ;
        orth:organism/obo:RO_0002162/up:scientificName 'Mus musculus' .
    ?RABIT_PROTEIN a orth:Protein ;
        orth:organism/obo:RO_0002162/up:scientificName 'Oryctolagus cuniculus' .
    FILTER(?node1 != ?node2)
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?HOG"):::projected 
  v5("?MOUSE_PROTEIN"):::projected 
  v4("?RABIT_PROTEIN"):::projected 
  v1("?node1")
  v2("?node2")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  c4(["orth:Protein"]):::iri 
  c8(["Mus musculus"]):::literal 
  c9(["Oryctolagus cuniculus"]):::literal 
  c2(["orth:OrthologsCluster"]):::iri 
  f0[["?node1 != ?node2"]]
  f0 --> v1
  f0 --> v2
  v3 --"a"-->  c2
  v3 --"orth:hasHomologousMember"-->  v1
  v3 --"orth:hasHomologousMember"-->  v2
  v2 --"orth:hasHomologousMember"-->  v4
  v1 --"orth:hasHomologousMember"-->  v5
  v5 --"a"-->  c4
  v5 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:scientificName"-->  c8
  v4 --"a"-->  c4
  v4 --"orth:organism"-->  a3
  a3 --"obo:RO_0002162"-->  a4
  a4 --"up:scientificName"-->  c9