query-e4592dabb8c1e926a87e5f94cf4da318
title:reference URL instead of ID SELECT ?ref ?url ?id WHERE { ?ref prov:wasDerivedFrom [ pr:P248 wd:Q104074149 ; pr:P854 ?url ]. BIND (REPLACE(STR(?url),"^./([0-9]+)[-/].$","$1") as ?id) }
Use at
- https://query.wikidata.org/sparql
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
#title:reference URL instead of ID
SELECT ?ref ?url ?id
WHERE {
?ref prov:wasDerivedFrom [ pr:P248 wd:Q104074149 ; pr:P854 ?url ].
BIND (REPLACE(STR(?url),"^.*/([0-9]+)[-/].*$","$1") as ?id)
}
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?id"):::projected
v2("?ref"):::projected
v1("?url"):::projected
a1((" "))
c2(["wd:Q104074149"]):::iri
a1 --"pr:P248"--> c2
a1 --"pr:P854"--> v1
v2 --"prov:wasDerivedFrom"--> a1
bind0[/"replace(str(?url),'^.*/(#91;0-9#93;+)#91;-/#93;.*$','$1')"/]
v1 --o bind0
bind0 --as--o v3