query-4f660220fafbb5564f1ff2eceaee63c5
Find people with multiple LCCNs or VIAFs
SELECT DISTINCT
?academic
?academicLabel
?academicDescription
?academicAltLabel
(GROUP_CONCAT(DISTINCT ?lccnurl; SEPARATOR = ";") AS ?LCCN_urls)
(GROUP_CONCAT(DISTINCT ?viafurl; SEPARATOR = ";") AS ?VIAF_urls)
WHERE {
{
SELECT ?academic (COUNT(DISTINCT ?lccn2) AS ?countl) (COUNT(DISTINCT ?viaf2) AS ?countv) WHERE {
?academic wdt:P31 wd:Q5 . # academic is a person
{
?academic wdt:P27 wd:Q664 . # citizen of New Zealand
} UNION {
?academic wdt:P551 wd:Q664 . # residence of New Zealand
}
?academic wdt:P244 ?lccn2 .
?academic wdt:P214 ?viaf2
} GROUP BY ?academic
}
FILTER ( ?countv > 1|| ?count1 > 1 )
OPTIONAL { ?academic wdt:P244 ?lccn . BIND( IRI(CONCAT('https://lccn.loc.gov/', STR(?lccn))) AS ?lccnurl ) . } . OPTIONAL { ?academic wdt:P214 ?viaf . BIND( IRI(CONCAT('https://viaf.org/viaf/', STR(?viaf))) AS ?viafurl ) . } . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" } } GROUP BY ?academic ?academicLabel ?academicDescription ?academicAltLabel
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 bd: <http://www.bigdata.com/rdf#>
#Find people with multiple LCCNs or VIAFs
SELECT DISTINCT
?academic
?academicLabel
?academicDescription
?academicAltLabel
(GROUP_CONCAT(DISTINCT ?lccnurl; SEPARATOR = ";") AS ?LCCN_urls)
(GROUP_CONCAT(DISTINCT ?viafurl; SEPARATOR = ";") AS ?VIAF_urls)
WHERE {
{
SELECT ?academic (COUNT(DISTINCT ?lccn2) AS ?countl) (COUNT(DISTINCT ?viaf2) AS ?countv) WHERE {
?academic wdt:P31 wd:Q5 . # academic is a person
{
?academic wdt:P27 wd:Q664 . # citizen of New Zealand
} UNION {
?academic wdt:P551 wd:Q664 . # residence of New Zealand
}
?academic wdt:P244 ?lccn2 .
?academic wdt:P214 ?viaf2
} GROUP BY ?academic
}
FILTER ( ?countv > 1|| ?count1 > 1 )
OPTIONAL { ?academic wdt:P244 ?lccn . BIND( IRI(CONCAT('https://lccn.loc.gov/', STR(?lccn))) AS ?lccnurl ) . } .
OPTIONAL { ?academic wdt:P214 ?viaf . BIND( IRI(CONCAT('https://viaf.org/viaf/', STR(?viaf))) AS ?viafurl ) . } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
GROUP BY ?academic ?academicLabel ?academicDescription ?academicAltLabel