sparql-examples

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

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

9

Retrieve all Rabbit's proteins encoded by genes that are orthologous to Mouses's hemoglobin Y gene and their cross-reference links to Uniprot.

Use at

PREFIX lscr: <http://purl.org/lscr#>
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 ?MOUSE_PROTEIN ?RABIT_PROTEIN ?MOUSE_UNIPROT_XREF ?RABIT_UNIPROT_XREF
WHERE {
    ?cluster a orth:OrthologsCluster ;
        orth:hasHomologousMember ?node1 ;
        orth:hasHomologousMember ?node2 .
    ?node2 orth:hasHomologousMember* ?RABIT_PROTEIN .
    ?node1 orth:hasHomologousMember* ?MOUSE_PROTEIN .
    ?MOUSE_PROTEIN a orth:Protein .
    ?MOUSE_PROTEIN  orth:organism/obo:RO_0002162/up:scientificName 'Mus musculus' ;
        rdfs:label 'HBB-Y';
        lscr:xrefUniprot ?MOUSE_UNIPROT_XREF .
    ?RABIT_PROTEIN a orth:Protein .
    ?RABIT_PROTEIN orth:organism/obo:RO_0002162/up:scientificName 'Oryctolagus cuniculus' .
    ?RABIT_PROTEIN lscr:xrefUniprot ?RABIT_UNIPROT_XREF.
    FILTER(?node1 != ?node2)
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?MOUSE_PROTEIN"):::projected 
  v6("?MOUSE_UNIPROT_XREF"):::projected 
  v4("?RABIT_PROTEIN"):::projected 
  v7("?RABIT_UNIPROT_XREF"):::projected 
  v3("?cluster")
  v1("?node1")
  v2("?node2")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  c4(["orth:Protein"]):::iri 
  c10(["HBB-Y"]):::literal 
  c8(["Mus musculus"]):::literal 
  c12(["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
  v5 --"rdfs:label"-->  c10
  v5 --"lscr:xrefUniprot"-->  v6
  v4 --"a"-->  c4
  v4 --"orth:organism"-->  a3
  a3 --"obo:RO_0002162"-->  a4
  a4 --"up:scientificName"-->  c12
  v4 --"lscr:xrefUniprot"-->  v7