168_batch_ensembl_transcript_cross_references

rq turtle/ttl

Given a batch of UniProt accessions, map each to its cross-referenced Ensembl transcript(s) in one query. This relationship is one-to-many (a protein can have several Ensembl transcripts), which is a recurring biomaRt pain point since getBM() is reported to drop or omit rows for it -- with SPARQL, a one-to-many mapping simply produces more result rows

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
WHERE {
  VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 }
  ?protein rdfs:seeAlso ?ensemblTranscript .
  ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  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