query-f3e9a1274f41ea10927cf1172509e5a4
Get DDC numbers from Wikidata for a given Wikipedia article PREFIX pq: http://www.wikidata.org/prop/qualifier/ SELECT ?item ?itemLabel ?ddc ?edition ?editionLabel WHERE {
https://no.wikipedia.org/wiki/Fisk schema:about ?item .
# Replace three lines with "?item wdt:P1036 ?ddc" if edition don't matter ?item p:P1036 ?statement . ?statement ps:P1036 ?ddc . OPTIONAL { ?statement pq:P747 ?edition . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "no,en" . } }
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Get DDC numbers from Wikidata for a given Wikipedia article
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?item ?itemLabel ?ddc ?edition ?editionLabel WHERE {
<https://no.wikipedia.org/wiki/Fisk> schema:about ?item .
# Replace three lines with "?item wdt:P1036 ?ddc" if edition don't matter
?item p:P1036 ?statement .
?statement ps:P1036 ?ddc .
OPTIONAL { ?statement pq:P747 ?edition . }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "no,en" .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?ddc"):::projected
v4("?edition"):::projected
v1("?item"):::projected
v2("?statement")
c7(["bd:serviceParam"]):::iri
c9(["no,en"]):::literal
c1([https://no.wikipedia.org/wiki/Fisk]):::iri
c1 --"schema:about"--> v1
v1 --"p:P1036"--> v2
v2 --"p:statement/P1036"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P747".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end