query-249f1be3de43f5dc408e6f0c9c647cba
title: Objekte mit ObjektID und optional HERIS-ID SELECT DISTINCT ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) WHERE { ?item wdt:P2951 ?oldid . ?item wdt:P17 wd:Q40 . # österreich OPTIONAL { ?item wdt:P131 ?where . OPTIONAL { ?where rdfs:label ?whereLiteral . FILTER(LANG(?whereLiteral) = 'de') . } } optional {?item wdt:P9154 ?herisId . Bind (xsd:integer(?herisId) as ?herisIdNr) } BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) . Bind (xsd:integer(?oldid) as ?oldidNr) SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE]' } } GROUP BY ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription ?whereLabels ORDER BY ASC(?oldidNr)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Objekte mit ObjektID und optional HERIS-ID
SELECT DISTINCT ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) WHERE {
?item wdt:P2951 ?oldid .
?item wdt:P17 wd:Q40 . # österreich
OPTIONAL {
?item wdt:P131 ?where .
OPTIONAL {
?where rdfs:label ?whereLiteral .
FILTER(LANG(?whereLiteral) = 'de') .
}
}
optional {?item wdt:P9154 ?herisId .
Bind (xsd:integer(?herisId) as ?herisIdNr)
}
BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
Bind (xsd:integer(?oldid) as ?oldidNr)
SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE]' }
} GROUP BY ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription ?whereLabels ORDER BY ASC(?oldidNr)