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