query-99088b2a758ff0502d2806734ad22bfe

rq turtle/ttl

property P19 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): P19 ("place of birth") 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 ?P19 ?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:P19 [] . }

} LIMIT 2000 } 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 foaf:focus/gvp:biographyPreferred/schema:birthPlace/^foaf:focus ?gettyObject . ?gettyObject xl:prefLabel/xl:literalForm ?gettyObjectTerm. FILTER(LANG(?gettyObjectTerm) = "en") \u0023 { SELECT ?gettyModified WHERE { ?gettySubject dct:modified ?gettyModified . } ORDER BY DESC(?gettyModified) LIMIT 1 }

} ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?gettyObject)\u0023 hint:Query hint:optimizer "None" .\u0023 # formatting BIND(SUBSTR(STR(?item), 32) AS ?qid) BIND(SUBSTR(STR(?wdObject), 32) AS ?P19) 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("P19" 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 schema: <http://schema.org/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX dct: <http://purl.org/dc/terms/>
# property P19 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): P19 ("place of birth") 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 ?P19 ?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:P19 [] . }
  } LIMIT 2000 }  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 foaf:focus/gvp:biographyPreferred/schema:birthPlace/^foaf:focus ?gettyObject . ?gettyObject xl:prefLabel/xl:literalForm ?gettyObjectTerm. FILTER(LANG(?gettyObjectTerm) = "en") \u0023
    { SELECT ?gettyModified WHERE {
      ?gettySubject dct:modified ?gettyModified .
      } ORDER BY DESC(?gettyModified) LIMIT 1
    }

  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?gettyObject)\u0023
  hint:Query hint:optimizer "None" .\u0023
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P19)
  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("P19" 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