query-62185e5dc8c2d740cb08625fa18d6f7a
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item (GROUP_CONCAT(?identifier) as ?identifiers) WHERE {
?item wdt:P31 wd:Q659563.
OPTIONAL {
# Get external identifiers
?item ?prop ?id.
?propItem wikibase:directClaim ?prop.
?propItem wikibase:propertyType wikibase:ExternalId.
?propItem wdt:P31 wd:Q28147643 .
?propItem wdt:P1630 ?formatterurl .
?propItem rdfs:label ?propItemLabel .
FILTER (lang(?propItemLabel) = "en").
BIND(IRI(REPLACE(?id, '^(.+)$', ?formatterurl)) AS ?url).
BIND(CONCAT("[", str(?url), " ", ?propItemLabel, "]") as ?identifier)
}
} GROUP BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?formatterurl")
v4("?id")
v8("?identifier"):::projected
v9("?identifiers")
v2("?item"):::projected
v3("?prop")
v5("?propItem")
v1("?propItemLabel")
v7("?url")
c7(["wd:Q28147643"]):::iri
c6(["wikibase:ExternalId"]):::iri
c3(["wd:Q659563"]):::iri
v2 --"wdt:P31"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -->v3--> v4
v5 -."wikibase:directClaim".-> v3
v5 --"wikibase:propertyType"--> c6
v5 --"wdt:P31"--> c7
v5 --"wdt:P1630"--> v6
v5 --"rdfs:label"--> v1
bind0[/"replace(?id,'^(.+)$',?formatterurl)"/]
v4 --o bind0
v6 --o bind0
bind0 --as--o v7
bind1[/"concat('#91;',str(?url),' ',?propItemLabel,'#93;')"/]
v7 --o bind1
v1 --o bind1
bind1 --as--o v8
end
bind3[/"?identifier"/]
v8 --o bind3
bind3 --as--o v9