query-d0f5048d775e4f75e4fecdafa0c441e6
can we federate UK parliament data and Wikidata?
this search finds everything in Parliament with a Wikidata ID
then looks them up in WD to see if it knows the connection
PREFIX parliament:https://id.parliament.uk/schema/
SELECT DISTINCT ?item ?itemLabel ?wdid ?parlid WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } SERVICE https://api.parliament.uk/sparql { ?item parliament:wikidataResourceHasEquivalentWikidataThing ?parlid } # compare Parliament search at https://api.parliament.uk/s/3851ffb0 optional { ?item wdt:P6213 ?wdid } # anything in Wikidata with a Parliament data ID }
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# can we federate UK parliament data and Wikidata?
# this search finds everything in Parliament with a Wikidata ID
# then looks them up in WD to see if it knows the connection
PREFIX parliament:<https://id.parliament.uk/schema/>
SELECT DISTINCT ?item ?itemLabel ?wdid ?parlid WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
SERVICE <https://api.parliament.uk/sparql> { ?item parliament:wikidataResourceHasEquivalentWikidataThing ?parlid }
# compare Parliament search at https://api.parliament.uk/s/3851ffb0
optional { ?item wdt:P6213 ?wdid }
# anything in Wikidata with a Parliament data ID
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?parlid"):::projected
v3("?wdid"):::projected
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
subgraph s2["https://api.parliament.uk/sparql"]
style s2 stroke-width:4px;
v1 --https://id.parliament.uk/schema/wikidataResourceHasEquivalentWikidataThing--> v2
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P6213".-> v3
end