sparql-examples

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

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

36

Find the orthologous proteins for UniProtKB entry P05067 using the OrthoDB database

Use at

PREFIX orthodb: <http://purl.orthodb.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT
  ?protein
  ?orthoGroup
  ?scientificName
  ?functionComment
  ?prefferedGeneName
  ((STRLEN(?value) - ?medianLength) as ?deviationFromMedianLength)
WHERE
{
  uniprotkb:P05067 a up:Protein ;
        up:organism/up:scientificName ?scientificName ;
        rdfs:seeAlso ?orthoGroup ;
        up:encodedBy/skos:prefLabel ?prefferedGeneName ;
          up:sequence/rdf:value ?value .
  OPTIONAL {
    ?protein up:annotation ?functionAnnotation .
    ?functionAnnotation a up:Function_Annotation ;
      rdfs:comment ?functionComment .
  }
  SERVICE <https://sparql.orthodb.org/sparql>{
    ?orthoGroup orthodb:ogMedianProteinLength ?medianLength .
    ?orthoGroup orthodb:hasMember ?xref .
    ?xref orthodb:xref/orthodb:xrefResource uniprotkb:P05067 .
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v10("?deviationFromMedianLength")
  v6("?functionAnnotation")
  v7("?functionComment"):::projected 
  v8("?medianLength"):::projected 
  v2("?orthoGroup"):::projected 
  v3("?prefferedGeneName"):::projected 
  v5("?protein"):::projected 
  v1("?scientificName"):::projected 
  v4("?value"):::projected 
  v9("?xref")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  c1(["uniprotkb:P05067"]):::iri 
  c12(["up:Function_Annotation"]):::iri 
  c3(["up:Protein"]):::iri 
  c1 --"a"-->  c3
  c1 --"up:organism"-->  a1
  a1 --"up:scientificName"-->  v1
  c1 --"rdfs:seeAlso"-->  v2
  c1 --"up:encodedBy"-->  a2
  a2 --"skos:prefLabel"-->  v3
  c1 --"up:sequence"-->  a3
  a3 --"rdf:value"-->  v4
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v5 -."up:annotation".->  v6
    v6 --"a"-->  c12
    v6 --"rdfs:comment"-->  v7
  end
  subgraph s1["https://sparql.orthodb.org/sparql"]
    style s1 stroke-width:4px;
    v2 --"orthodb:ogMedianProteinLength"-->  v8
    v2 --"orthodb:hasMember"-->  v9
    v9 --"orthodb:xref"-->  a4
    a4 --"orthodb:xrefResource"-->  c1
  end
  bind0[/"string-length(?value) - ?medianLength"/]
  v4 --o bind0
  v8 --o bind0
  bind0 --as--o v10