query-7f4356eaecf85f75c524332559e3166e

rq turtle/ttl

property P40 statements that could be added

with information in ULAN of the Getty Vocabulary Program (GVP)

output: a table that as CSV is ready for QuickStatements as "CSV with header row"

after replacing the column headers ("comment" and) "commentRef" with the "#" character

suggested QS batch name: 'Getty Vocabulary Program (GVP): P40 ("child") statements: add with ULAN as reference'

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 ?qid ?P40 ?comment ?S248 ?s245 ?s577 ?s813 ?commentRef WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID WHERE { ?item wdt:P245 ?gettyID .

FILTER NOT EXISTS { ?item p:P40 [] . }

} LIMIT 1000 } 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:ulan1512_parent_of ?gettyObject . \u0023 { SELECT ?gettyModified WHERE { ?gettySubject dct:modified ?gettyModified . } ORDER BY DESC(?gettyModified) LIMIT 1 } OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. } } ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\u0023 hint:Query hint:optimizer "None" .\u0023 # formatting BIND(SUBSTR(STR(?item), 32) AS ?qid) BIND(SUBSTR(STR(?wdObject), 32) AS ?P40) 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("P40" 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 BIND(?comment AS ?commentRef) # copy the comment to the column "commentRef" so that it can be used for # the edit summaries of the edit adding the statement and the edit adding the reference } ORDER BY xsd:integer(SUBSTR(STR(?qid),2))

LIMIT 500 # I think this isn't needed

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX dct: <http://purl.org/dc/terms/>
# property P40 statements that could be added
# with information in ULAN of the Getty Vocabulary Program (GVP)
# output: a table that as CSV is ready for QuickStatements as "CSV with header row"
# after replacing the column headers ("comment" and) "commentRef" with the "#" character
# suggested QS batch name: 'Getty Vocabulary Program (GVP): P40 ("child") statements: add with ULAN as reference'

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
?qid ?P40 ?comment ?S248 ?s245 ?s577 ?s813 ?commentRef

  # now see what Getty says to those statements
  WHERE {  { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .

    FILTER NOT EXISTS { ?item p:P40 [] . }
  } LIMIT 1000 }  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:ulan1512_parent_of ?gettyObject .  \u0023
    { SELECT ?gettyModified WHERE {
      ?gettySubject dct:modified ?gettyModified .
      } ORDER BY DESC(?gettyModified) LIMIT 1
    }
  OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  }
  ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\u0023
  \u0023
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P40)
  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("P40" 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
  BIND(?comment AS ?commentRef)
  # copy the comment to the column "commentRef" so that it can be used for
  # the edit summaries of the edit adding the statement and the edit adding the reference
}
ORDER BY xsd:integer(SUBSTR(STR(?qid),2))
# LIMIT 500 # I think this isn't needed

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?P40"):::projected v18("?S245str") v12("?S248"):::projected v17("?S248str") v19("?S577str") v20("?S813str") v21("?comment"):::projected v22("?commentRef"):::projected v7("?gettyHumanURI") v5("?gettyID") v8("?gettyModified") v3("?gettyObject") v9("?gettyObjectTerm") v6("?gettySubject") v4("?item") v11("?qid"):::projected v13("?s245"):::projected v14("?s577"):::projected v15("?s813"):::projected v2("?ulanID") v10("?wdObject") v16("?wdPropPid") a1((" ")) a2((" ")) f0[["concat('http://vocab.getty.edu/ulan/',?ulanID) = ?gettyObject"]] f0 --> v2 f0 --> v3 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"p:P40"--> e0a1 e0v1("?item"):::projected e0a1((" ")):::projected end f1--EXISTS--> f1e0 f1 --> v4 f1 --> c3 f1 --> a1 v4 --"p:P40"--> a1 v4 --"p:direct/P245"--> v5 bind2[/"concat('http://vocab.getty.edu/ulan/',?gettyID)"/] v5 --o bind2 bind2 --as--o v6 bind3[/"concat('http://vocab.getty.edu/page/ulan/',?gettyID)"/] v5 --o bind3 bind3 --as--o v7 subgraph s1["http://vocab.getty.edu/sparql.json"] style s1 stroke-width:4px; v6 --http://vocab.getty.edu/ontology#ulan1512_parent_of--> v3 v6 --"dct:modified"--> v8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -.http://vocab.getty.edu/ontology#prefLabelGVP.-> a2 a2 --http://www.w3.org/2008/05/skos-xl#literalForm--> v9 end end v10 --"p:direct/P245"--> v2 bind4[/"substring(str(?item),'32^^xsd:integer')"/] v4 --o bind4 bind4 --as--o v11 bind5[/"substring(str(?wdObject),'32^^xsd:integer')"/] v10 --o bind5 bind5 --as--o v11 bind6[/"'Q2494649'"/] bind6 --as--o v12 bind7[/"concat(', ?gettyID, ')"/] bind7 --as--o v13 bind8[/"concat('+',substring(str(?gettyModified),'1^^xsd:integer','10^^xsd:integer'),'T00:00:00Z/11')"/] v8 --o bind8 bind8 --as--o v14 bind9[/"concat('+',substring(str(NOW()),'1^^xsd:integer','10^^xsd:integer'),'T00:00:00Z/11')"/] bind9 --as--o v15 bind10[/"'P40'"/] bind10 --as--o v16 bind11[/"'S248'"/] bind11 --as--o v17 bind12[/"'S245'"/] bind12 --as--o v18 bind13[/"'S577'"/] bind13 --as--o v19 bind14[/"'S813'"/] bind14 --as--o v20 bind15[/"'add data from #91;#91;Q2494649#93;#93;. Documentation at #91;#91;WD:WPVA/Getty#93;#93;. Please report any issues e.g. at #91;#91;WT:WPVA/Getty#93;#93;!'"/] bind15 --as--o v21 bind16[/"?comment"/] v21 --o bind16 bind16 --as--o v22