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))
}