sparql-examples

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

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

57

rq turtle/ttl

Map a selection of PDB identifiers plus chains to UniProtKB

Use at

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

SELECT
  ?pdbId ?chain ?pdbChain ?uniprot
WHERE
{
  # A space separated list of pairs of PDB identifiers and the chain code.
  VALUES(?pdbId ?pdbChain) { ('6VXC' 'A') ('1BG3' 'B') }

  # Make an IRI out of the pdbId
  BIND(iri(concat('http://rdf.wwpdb.org/pdb/', ?pdbId)) AS ?pdb)

  # Map to UniProt entries
  ?uniprot rdfs:seeAlso ?pdb .
  ?pdb up:database <http://purl.uniprot.org/database/PDB> ;
       up:chainSequenceMapping ?chainSm .
  ?chainSm up:chain ?chainsPlusRange .

  # Extract the list of chains from the text representation.
  BIND(STRBEFORE(?chainsPlusRange, '=') AS ?chain)

  # Filter those that match.
  FILTER(CONTAINS(?chain, ?pdbChain))
}
as
rdfs:seeAlso
up:database
up:chainSequenceMapping
up:chain
as
?chain
?chainSm
?chainsPlusRange
?pdbChain
?pdbId
?uniprot
http://purl.uniprot.org/database/PDB
contains(?chain,?pdbChain)
VALUES ?pdbChain ?pdbId
6VXC
A
1BG3
B
concat('http://rdf.wwpdb.org/pdb/',?pdbId)
substring-before(?chainsPlusRange,'=')