query-245d6786b0ef19925f826de0c7d583fc
property P106 statements that could be added
with information in ULAN of the Getty Vocabulary Program (GVP)
output: a human-readable table that allows visual checking of the data of Wikidata and the GVP
PREFIX xl: http://www.w3.org/2008/05/skos-xl# PREFIX gvp: http://vocab.getty.edu/ontology# PREFIX aat: http://vocab.getty.edu/aat/
SELECT DISTINCT ?item ?itemLabel ?wdObject ?wdObjectLabel ?gettyHumanURI ?gettySubjectTerm ?gettyObject ?gettyObjectTerm ?QSlink # TODO: needs to be tested WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID WHERE { ?item wdt:P245 ?gettyID . ?item wdt:P31 wd:Q5. FILTER NOT EXISTS { ?item p:P106 [] . } } LIMIT 10 } AS %items
# now see what Getty says to those statements WHERE { INCLUDE %items BIND(URI(CONCAT("http://vocab.getty.edu/ulan/", ?gettyID)) AS ?gettySubject) BIND(URI(CONCAT("http://vocab.getty.edu/page/ulan/", ?gettyID)) AS ?gettyHumanURI) SERVICE http://vocab.getty.edu/sparql.json { ?gettySubject gvp:agentTypeNonPreferred ?gettyObject . {?gettyObject gvp:broaderPreferred* aat:300025485} UNION { FILTER (?gettyObject = aat:300115251)}
MINUS {?gettyObject gvp:broaderPreferred* aat:300025746 .} \u0023
{ SELECT ?gettyModified WHERE {
?gettySubject dct:modified ?gettyModified .
} ORDER BY DESC(?gettyModified) LIMIT 1
}\u0023
OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
}
?wdObject wdt:P1014 ?aatID . FILTER(URI(CONCAT("http://vocab.getty.edu/aat/", ?aatID)) = ?gettyObject)\u0023
hint:Query hint:optimizer "None" .\u0023
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}\u0023
# formatting
BIND(SUBSTR(STR(?item), 32) AS ?qid)
BIND(SUBSTR(STR(?wdObject), 32) AS ?P106)
BIND("Q2494649" AS ?S248)
BIND(CONCAT("\"", ?gettyID, "\"") AS ?s245)
# "publication date" (P577)
BIND(CONCAT("+", SUBSTR(STR(?gettyModified),1,10), "T00:00:00Z/11") AS ?s577)
# "retrieved" (P813)
BIND(CONCAT("+", SUBSTR(STR(NOW()),1,10), "T00:00:00Z/11") AS ?s813)\u0023
# String variables QuickStatements version 1 format
BIND("P106" AS ?wdPropPid)
BIND("S248" as ?S248str)
BIND("S245" as ?S245str)
BIND("S577" as ?S577str)
BIND("S813" as ?S813str)\u0023
BIND("/add data from [[Q2494649]]. Documentation at [[WD:WPVA/Getty]]. Please report any issues e.g. at [[WT:WPVA/Getty]]! /" AS ?comment)\u0023
# Produce QuickStatements version 1 links
# cf. https://www.wikidata.org/wiki/Help:QuickStatements#Running_QuickStatements_through_URL:
BIND(URI(CONCAT("https://quickstatements.toolforge.org/index_old.html#v1=",
?qid, "%09", ?wdPropPid, "%09", ?P106, "%09", ?S248str, "%09", ?S248,
"%09", ?S245str,
"%09", ?s245,
"%09", ?S577str, "%09", ?s577,
"%09", ?S813str, "%09", ?s813,
?comment)) AS ?QSlink)
BIND(CONCAT("[", STR(?gettyHumanURI), " ", ?gettyID, "]") AS ?gettyLink)
BIND(CONCAT("[", STR(?gettyObject), "]") AS ?gettyObjectLink)
}
ORDER BY xsd:integer(SUBSTR(STR(?qid),2))
LIMIT 500 # I think this isn't needed
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 p: <http://www.wikidata.org/prop/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# property P106 statements that could be added
# with information in ULAN of the Getty Vocabulary Program (GVP)
# output: a human-readable table that allows visual checking of the data of Wikidata and the GVP
PREFIX xl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX gvp: <http://vocab.getty.edu/ontology#>
PREFIX aat: <http://vocab.getty.edu/aat/>
SELECT DISTINCT
?item ?itemLabel ?wdObject ?wdObjectLabel ?gettyHumanURI ?gettySubjectTerm ?gettyObject ?gettyObjectTerm ?QSlink # TODO: needs to be tested
# now see what Getty says to those statements
WHERE { { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
WHERE {
?item wdt:P245 ?gettyID .
?item wdt:P31 wd:Q5.
FILTER NOT EXISTS { ?item p:P106 [] . }
} LIMIT 10 } BIND(URI(CONCAT("http://vocab.getty.edu/ulan/", ?gettyID)) AS ?gettySubject)
BIND(URI(CONCAT("http://vocab.getty.edu/page/ulan/", ?gettyID)) AS ?gettyHumanURI)
SERVICE <http://vocab.getty.edu/sparql.json> {
?gettySubject gvp:agentTypeNonPreferred ?gettyObject .
{?gettyObject gvp:broaderPreferred* aat:300025485} UNION { FILTER (?gettyObject = aat:300115251)}
#MINUS {?gettyObject gvp:broaderPreferred* aat:300025746 .} \u0023
{ SELECT ?gettyModified WHERE {
?gettySubject dct:modified ?gettyModified .
} ORDER BY DESC(?gettyModified) LIMIT 1
}\u0023
OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
}
?wdObject wdt:P1014 ?aatID . FILTER(URI(CONCAT("http://vocab.getty.edu/aat/", ?aatID)) = ?gettyObject)\u0023
\u0023
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}\u0023
# formatting
BIND(SUBSTR(STR(?item), 32) AS ?qid)
BIND(SUBSTR(STR(?wdObject), 32) AS ?P106)
BIND("Q2494649" AS ?S248)
BIND(CONCAT(""", ?gettyID, """) AS ?s245)
# "publication date" (P577)
BIND(CONCAT("+", SUBSTR(STR(?gettyModified),1,10), "T00:00:00Z/11") AS ?s577)
# "retrieved" (P813)
BIND(CONCAT("+", SUBSTR(STR(NOW()),1,10), "T00:00:00Z/11") AS ?s813)\u0023
# String variables QuickStatements version 1 format
BIND("P106" AS ?wdPropPid)
BIND("S248" as ?S248str)
BIND("S245" as ?S245str)
BIND("S577" as ?S577str)
BIND("S813" as ?S813str)\u0023
BIND("/*add data from [[Q2494649]]. Documentation at [[WD:WPVA/Getty]]. Please report any issues e.g. at [[WT:WPVA/Getty]]! */" AS ?comment)\u0023
# Produce QuickStatements version 1 links
# cf. <https://www.wikidata.org/wiki/Help:QuickStatements#Running_QuickStatements_through_URL>:
BIND(URI(CONCAT("https://quickstatements.toolforge.org/index_old.html#v1=",
?qid, "%09", ?wdPropPid, "%09", ?P106, "%09", ?S248str, "%09", ?S248,
"%09", ?S245str,
"%09", ?s245,
"%09", ?S577str, "%09", ?s577,
"%09", ?S813str, "%09", ?s813,
?comment)) AS ?QSlink)
BIND(CONCAT("[", STR(?gettyHumanURI), " ", ?gettyID, "]") AS ?gettyLink)
BIND(CONCAT("[", STR(?gettyObject), "]") AS ?gettyObjectLink)
}
ORDER BY xsd:integer(SUBSTR(STR(?qid),2))
# LIMIT 500 # I think this isn't needed