query-6949af983cc278e81d3bce74995eebe1
Federated query failGrateful for assistance with this ropey federated query, which fetches ID-containing URLs from an end point, but errors when trying to reconcile the calculated ID with wikidata's property for that ID. thx.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX bio: <http://purl.org/vocab/bio/0.1/>
PREFIX blt: <http://www.bl.uk/schemas/bibliographic/blterms#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?event ?author ?ID WHERE {
SERVICE <http://bnb.data.bl.uk/sparql> {
?event a bio:Birth;
bio:date "1945"^^<http://www.w3.org/2001/XMLSchema#gYear>.
?author bio:event ?event;
foaf:name ?name.
}
bind(strafter(str(?author),"person/") as ?ID1)
bind(strbefore(?ID1,"-") as ?ID)
# ?item wdt:P5361 ?ID.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?ID"):::projected
v4("?ID1")
v2("?author"):::projected
v1("?event"):::projected
v3("?name")
c9(["bd:serviceParam"]):::iri
c11(["en"]):::literal
c5(["1945^^xsd:gYear"]):::literal
c3([http://purl.org/vocab/bio/0.1/Birth]):::iri
subgraph s1["http://bnb.data.bl.uk/sparql"]
style s1 stroke-width:4px;
v1 --"a"--> c3
v1 --http://purl.org/vocab/bio/0.1/date--> c5
v2 --http://purl.org/vocab/bio/0.1/event--> v1
v2 --http://xmlns.com/foaf/0.1/name--> v3
end
bind0[/"substring-after(str(?author),'person/')"/]
v2 --o bind0
bind0 --as--o v4
bind1[/"substring-before(?ID1,'-')"/]
v4 --o bind1
bind1 --as--o v5
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c9 --"wikibase:language"--> c11
end