sparql-examples

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

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

14

Find genes with their properties by a list of their xrefs

Use at

PREFIX up: <http://purl.uniprot.org/core/>
PREFIX ensembl: <http://rdf.ebi.ac.uk/resource/ensembl/>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX entrezgene: <http://www.ncbi.nlm.nih.gov/gene/>
PREFIX : <http://purl.orthodb.org/>

SELECT *
WHERE {
    ?gene a :Gene.
    ?gene :name ?gene_name; :description ?description; up:organism [up:scientificName ?org_name].
    ?gene :xref [a :Xref; :xrefResource ?xref]
    FILTER(?xref in (
    ensembl:ENSPTRG00000022217
    ,ensembl:ENSPVAG00000015405
    ,uniprotkb:Q9D4H7
    ,uniprotkb:H2PWL0
    ,entrezgene:105598395
    ,entrezgene:105062977
    ))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?description"):::projected 
  v2("?gene"):::projected 
  v3("?gene_name"):::projected 
  v5("?org_name"):::projected 
  v1("?xref"):::projected 
  a1((" "))
  a2((" "))
  c13([":Xref"]):::iri 
  c8([":Gene"]):::iri 
  list0c3(["uniprotkb:Q9D4H7"]):::iri 
  list0c1(["ensembl:ENSPTRG00000022217"]):::iri 
  list0c2(["ensembl:ENSPVAG00000015405"]):::iri 
  list0c6(["entrezgene:105062977"]):::iri 
  list0c4(["uniprotkb:H2PWL0"]):::iri 
  list0c5(["entrezgene:105598395"]):::iri 
  list0c1 --o f0
  list0c2 --o f0
  list0c3 --o f0
  list0c4 --o f0
  list0c5 --o f0
  list0c6 --o f0
  f0[[" in "]]
  f0 --> v1
  v2 --"a"-->  c8
  v2 --":name"-->  v3
  v2 --":description"-->  v4
  a1 --"up:scientificName"-->  v5
  v2 --"up:organism"-->  a1
  a2 --"a"-->  c13
  a2 --":xrefResource"-->  v1
  v2 --":xref"-->  a2