query-f4b2d55c664e160df7bf112ba90ce357
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?qid ?name ?en ?fr WHERE {
?qid wdt:P9619 [] ;
rdfs:label ?name .
{?qid wdt:P2671 ?gkp .} UNION {?qid wdt:P646 ?gkp .}
FILTER(LANG(?name) = "en").
BIND(REPLACE("https://www.google.com/search?kgmid=ABC&kponly&q=XYZ","ABC",?gkp ) AS ?x).
BIND(REPLACE(?x,"XYZ",ENCODE_FOR_URI(?name)) AS ?url).
BIND(URI(CONCAT(?url, "&hl=en")) as ?en)
BIND(URI(CONCAT(?url, "&hl=fr")) as ?fr)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?en"):::projected
v7("?fr"):::projected
v3("?gkp")
v1("?name"):::projected
v2("?qid"):::projected
v5("?url")
v4("?x")
a1((" "))
f0[["?name = 'en'"]]
f0 --> v1
v2 --"wdt:P9619"--> a1
v2 --"rdfs:label"--> v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P646"--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P2671"--> v3
end
union0r <== or ==> union0l
end
bind1[/"replace('https://www.google.com/search?kgmid=ABC&kponly&q=XYZ','ABC',?gkp)"/]
v3 --o bind1
bind1 --as--o v4
bind2[/"replace(?x,'XYZ',encode-for-uri(?name))"/]
v4 --o bind2
v1 --o bind2
bind2 --as--o v5
bind3[/"concat(?url,'&hl=en')"/]
v5 --o bind3
bind3 --as--o v6
bind4[/"concat(?url,'&hl=fr')"/]
v5 --o bind4
bind4 --as--o v7