sparql-examples

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

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

022

List the labels and identifiers of pig-tailed macaque genes in bgee

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX obo: <http://purl.obolibrary.org/obo/>

SELECT DISTINCT ?geneId ?geneName
WHERE {
    ?gene a orth:Gene ;
        dcterms:identifier ?geneId ;
        orth:organism/obo:RO_0002162/up:commonName ?commonName .
    OPTIONAL { ?gene rdfs:label ?geneName .}
    FILTER ( LCASE(?commonName) = "pig-tailed macaque" ) .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?commonName")
  v2("?gene")
  v3("?geneId"):::projected 
  v4("?geneName"):::projected 
  a1((" "))
  a2((" "))
  c3(["orth:Gene"]):::iri 
  f0[["lower-case(?commonName) = 'pig-tailed macaque'"]]
  f0 --> v1
  v2 --"a"-->  c3
  v2 --"dcterms:identifier"-->  v3
  v2 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:commonName"-->  v1
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."rdfs:label".->  v4
  end