sparql-examples

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

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

10

Retrieve all human proteins that are paralogous to the HBB gene and their UniProt cross-references.

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 ?PROTEIN_HBB ?IS_PARALOGOUS_TO_PROTEIN ?PARALOG_GENE_LABEL ?HBB_UNIPROT_XREF ?PARALOG_UNIPROT_XREF
WHERE {
    ?cluster a orth:OrthologsCluster ;
        orth:hasHomologousMember ?node1 ;
        orth:hasHomologousMember ?node2 .
    ?node2 orth:hasHomologousMember* ?PROTEIN_HBB .
    ?node1 orth:hasHomologousMember* ?IS_PARALOGOUS_TO_PROTEIN .
    ?PROTEIN_HBB a orth:Protein ;
        orth:organism/obo:RO_0002162/up:scientificName 'Homo sapiens' ;
        rdfs:label 'HBB';
        lscr:xrefUniprot ?HBB_UNIPROT_XREF .
    ?IS_PARALOGOUS_TO_PROTEIN a orth:Protein ;
        orth:organism/obo:RO_0002162/up:scientificName 'Homo sapiens' ;
        lscr:xrefUniprot ?PARALOG_UNIPROT_XREF ;
        rdfs:label ?PARALOG_GENE_LABEL .
    FILTER(?node1 != ?node2)
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?HBB_UNIPROT_XREF"):::projected 
  v5("?IS_PARALOGOUS_TO_PROTEIN"):::projected 
  v8("?PARALOG_GENE_LABEL"):::projected 
  v7("?PARALOG_UNIPROT_XREF"):::projected 
  v4("?PROTEIN_HBB"):::projected 
  v3("?cluster")
  v1("?node1")
  v2("?node2")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  c4(["orth:Protein"]):::iri 
  c2(["orth:OrthologsCluster"]):::iri 
  c8(["Homo sapiens"]):::literal 
  c10(["HBB"]):::literal 
  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
  v4 --"a"-->  c4
  v4 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:scientificName"-->  c8
  v4 --"rdfs:label"-->  c10
  v4 --"lscr:xrefUniprot"-->  v6
  v5 --"a"-->  c4
  v5 --"orth:organism"-->  a3
  a3 --"obo:RO_0002162"-->  a4
  a4 --"up:scientificName"-->  c8
  v5 --"lscr:xrefUniprot"-->  v7
  v5 --"rdfs:label"-->  v8