170_batch_ensembl_gene_and_protein_ids

rq turtle/ttl

Given a batch of UniProt accessions, resolve each to its Ensembl gene ID and Ensembl protein ID in one query. UniProt's rdfs:seeAlso cross-reference to Ensembl only reaches the transcript level directly; the transcript resource itself links on to the gene it was transcribed from (up:transcribedFrom, an ENSG id) and the protein it was translated to (up:translatedTo, an ENSP id), so no federation with an external Ensembl endpoint is needed to reach gene-level identifiers. Similar pattern appears for the other Ensembl like databases such as EnsemblBacteria

Use at

PREFIX up: <http://purl.uniprot.org/core/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>

SELECT
  ?protein
  ?ensemblTranscript
  ?ensemblGene
  ?ensemblProtein
WHERE {
  VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 }
  ?protein rdfs:seeAlso ?ensemblTranscript .
  ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> ;
    up:transcribedFrom ?ensemblGene ;
    up:translatedTo ?ensemblProtein .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?ensemblGene"):::projected 
  v4("?ensemblProtein"):::projected 
  v2("?ensemblTranscript"):::projected 
  v1("?protein"):::projected 
  c3([http://purl.uniprot.org/database/Ensembl]):::iri 
  bind0[/VALUES ?protein/]
  bind0-->v1
  bind00(["uniprotkb:P04637"])
  bind00 --> bind0
  bind01(["uniprotkb:P01308"])
  bind01 --> bind0
  bind02(["uniprotkb:Q13613"])
  bind02 --> bind0
  v1 --"rdfs:seeAlso"-->  v2
  v2 --"up:database"-->  c3
  v2 --"up:transcribedFrom"-->  v3
  v2 --"up:translatedTo"-->  v4