A set of SPARQL examples that are used in different SIB resources
For the human entry P05067 (Amyloid-beta precursor protein) find the gene start ends in WikiData
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT
?protein
?begin
?end
?chromosome
?assembly
WHERE {
{
BIND(uniprotkb:P05067 AS ?proteinIRI)
BIND (SUBSTR(STR(?proteinIRI), STRLEN(STR(uniprotkb:))+1) AS ?protein)
}
SERVICE <https://query.wikidata.org/sparql> {
?wp wdt:P352 ?protein ;
wdt:P702 ?wg .
?wg p:P644 ?wgss .
?wgss ps:P644 ?begin ;
pq:P1057/wdt:P1813 ?chromosome ;
pq:P659/rdfs:label ?assembly .
?wg p:P645 ?wgse .
?wgse ps:P645 ?end ;
pq:P1057/wdt:P1813 ?chromosome ;
pq:P659/rdfs:label ?assembly .
FILTER(lang(?assembly) = "en")
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?assembly"):::projected
v7("?begin"):::projected
v8("?chromosome"):::projected
v10("?end"):::projected
v2("?protein"):::projected
v1("?proteinIRI")
v5("?wg")
v9("?wgse")
v6("?wgss")
v4("?wp")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
bind0[/"'uniprotkb:P05067'"/]
bind0 --as--o v1
bind1[/"substring(str(?proteinIRI),string-length(str('uniprotkb:')) + '+1^^xsd:integer')"/]
v1 --o bind1
bind1 --as--o v2
subgraph s1["https://query.wikidata.org/sparql"]
style s1 stroke-width:4px;
f2[["?assembly = 'en'"]]
f2 --> v3
v4 --"p:direct/P352"--> v2
v4 --"p:direct/P702"--> v5
v5 --"p:P644"--> v6
v6 --"p:statement/P644"--> v7
v6 --"p:qualifier/P1057"--> a1
a1 --"p:direct/P1813"--> v8
v6 --"p:qualifier/P659"--> a2
a2 --"rdfs:label"--> v3
v5 --"p:P645"--> v9
v9 --"p:statement/P645"--> v10
v9 --"p:qualifier/P1057"--> a3
a3 --"p:direct/P1813"--> v8
v9 --"p:qualifier/P659"--> a4
a4 --"rdfs:label"--> v3
end