A set of SPARQL examples that are used in different SIB resources
Map a selection of PDB identifiers plus chains to UniProtKB
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))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?chain"):::projected
v6("?chainSm")
v7("?chainsPlusRange")
v4("?pdb")
v4("?pdbChain"):::projected
v3("?pdbId"):::projected
v5("?uniprot"):::projected
c3([http://purl.uniprot.org/database/PDB]):::iri
f0[["contains(?chain,?pdbChain)"]]
f0 --> v8
f0 --> v4
bind1[/VALUES ?pdbChain ?pdbId/]
bind1-->v3
bind1-->v4
bind10(["6VXC"])
bind10 --> bind1
bind11(["A"])
bind11 --> bind1
bind12(["1BG3"])
bind12 --> bind1
bind13(["B"])
bind13 --> bind1
bind2[/"concat('http://rdf.wwpdb.org/pdb/',?pdbId)"/]
v3 --o bind2
bind2 --as--o v4
v5 --"rdfs:seeAlso"--> v4
v4 --"up:database"--> c3
v4 --"up:chainSequenceMapping"--> v6
v6 --"up:chain"--> v7
bind3[/"substring-before(?chainsPlusRange,'=')"/]
v7 --o bind3
bind3 --as--o v8