Wikidata:WikiProject Visual arts/Getty Vocabularies

This sub-project of the WikiProject Visual arts aims to align the information of the Getty Vocabulary Program (Q5554720) and Wikidata. The current approach is to use federated SPARQL queries that compare Getty and Wikidata date and whose results are fed to Wikidata via QuickStatements. There are bots around which work on this as well, so by Multichill dealing with labels, aliases and sex or gender (P21) and by Magnus Magnus dealing with date of birth (P569) and date of death (P570).

Queries edit

The table contains queries that can be easily used as input for QuickStatements.

Property 1st ref 1st stmt Comment
ULAN entities
place of birth (P19)
# property P19 statements without any reference
# 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 ULAN as first 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  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P19 ?statement .
    ?statement ps:P19 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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
  # 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 first reference 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
QScsv ; QScsv
# property P19 statements without any reference
# 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 p:P19 ?statement .
    ?statement ps:P19 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?gettyObject)\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 ?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 first reference 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", ?P19, "%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
nice-QS ; nice-QS
# 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
QScsv ; QScsv
# property P19 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 .
    
    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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?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 ?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
  # 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", ?P19, "%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
nice-QS ; nice-QS

Q5 only:

# 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 .
    ?item wdt:P31 wd:Q5.
    FILTER NOT EXISTS { ?item p:P19 [] . }
  } LIMIT 1200 } 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
QScsv ; QScsv
# property P19 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:P19 [] . }
  } LIMIT 1200 } 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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?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 ?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
  # 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", ?P19, "%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
nice-QS ; nice-QS
  • most frequent as POB or POD in ULAN, but TGN not in WD:
    PREFIX gvp: <http://vocab.getty.edu/ontology#>
    
    SELECT
    ?placeURL ?wdSearchURL ?name ?id ?count
      WHERE {
      SERVICE <http://vocab.getty.edu/sparql.json> {
        { SELECT ?place ?name ?id (COUNT(?place) as ?count) {
          ?agent gvp:biographyPreferred/(schema:birthPlace|schema:deathPlace)/^foaf:focus ?place .
          ?place gvp:prefLabelGVP/gvp:term ?name .
          ?place dc:identifier ?id .
          }
          GROUP BY ?place ?name ?id
        }
      }
      MINUS { ?item wdt:P1667 ?id . }
      BIND(URI(CONCAT("http://vocab.getty.edu/page/tgn/", ?id)) AS ?placeURL)
      BIND(URI(CONCAT("https://www.wikidata.org/wiki/Special:Search/", ?name)) AS ?wdSearchURL)
    }
    ORDER BY DESC(?count)
    LIMIT 30
    
    Try it! ; Try it!, plus work location similar places:
    PREFIX gvp: <http://vocab.getty.edu/ontology#>
    PREFIX bio: <http://purl.org/vocab/bio/0.1/>
    
    SELECT
    ?placeURL ?wdSearchURL ?name ?id ?count
      WHERE {
      SERVICE <http://vocab.getty.edu/sparql.json> {
        { SELECT ?place ?name ?id (COUNT(?place) as ?count) {
          ?agent (gvp:biographyPreferred/(schema:birthPlace|schema:deathPlace)|bio:event/(schema:location|(schema:location/gvp:broaderExtended)))/^foaf:focus ?place .
          ?place gvp:prefLabelGVP/gvp:term ?name .
          ?place dc:identifier ?id .
          }
          GROUP BY ?place ?name ?id
        }
      }
      MINUS { ?item wdt:P1667 ?id . }
      BIND(URI(CONCAT("http://vocab.getty.edu/page/tgn/", ?id)) AS ?placeURL)
      BIND(URI(CONCAT("https://www.wikidata.org/wiki/Special:Search/", ?name)) AS ?wdSearchURL)
    }
    ORDER BY DESC(?count)
    LIMIT 30
    
    Try it! ; Try it!
place of death (P20)
# property P20 statements without any reference
# 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): P20 ("place of death") statements: add ULAN as first 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 ?P20  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P20 ?statement .
    ?statement ps:P20 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:deathPlace/^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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P20)
  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("P20" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P20 statements without any reference
# 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 p:P20 ?statement .
    ?statement ps:P20 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:deathPlace/^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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?gettyObject)\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 ?P20)
  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("P20" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P20, "%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
nice-QS ; nice-QS
# property P20 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): P20 ("place of death") 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 ?P20 ?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:P20 [] . }
  } 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:deathPlace/^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 ?P20)
  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("P20" 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
QScsv ; QScsv
# property P20 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 .
    
    FILTER NOT EXISTS { ?item p:P20 [] . }
  } 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:deathPlace/^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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?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 ?P20)
  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("P20" 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", ?P20, "%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
nice-QS ; nice-QS
sex or gender (P21)
# property P21 statements without any reference
# 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): P21 ("sex or gender") statements: add ULAN as first 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 ?P21  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P21 ?statement .
    ?statement ps:P21 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 500 } 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:gender ?gettyObject .  \u0023
    { SELECT ?gettyModified WHERE {
      ?gettySubject dct:modified ?gettyModified .
      } ORDER BY DESC(?gettyModified) LIMIT 1
    }
  BIND(IF(?gettyObject = aat:300189559, wd:Q6581097, IF(?gettyObject = aat:300189557, wd:Q6581072, "")) AS ?wdObjectFromGetty)
  }
  FILTER(?wdObject = ?wdObjectFromGetty)\u0023
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P21)
  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("P21" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P21 statements without any reference
# 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 p:P21 ?statement .
    ?statement ps:P21 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 500 } 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:gender ?gettyObject .  \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. }
  BIND(IF(?gettyObject = aat:300189559, wd:Q6581097, IF(?gettyObject = aat:300189557, wd:Q6581072, "")) AS ?wdObjectFromGetty)
  }
  FILTER(?wdObject = ?wdObjectFromGetty)\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 ?P21)
  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("P21" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P21, "%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
nice-QS ; nice-QS

Q5 only:

# property P21 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): P21 ("sex or gender") 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 ?P21 ?comment ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    ?item wdt:P31 wd:Q5.
    FILTER NOT EXISTS { ?item p:P21 [] . }
  } LIMIT 200 } 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:gender ?gettyObject .  \u0023
    { SELECT ?gettyModified WHERE {
      ?gettySubject dct:modified ?gettyModified .
      } ORDER BY DESC(?gettyModified) LIMIT 1
    }
  
  }
  BIND(IF(?gettyObject = aat:300189559, wd:Q6581097, IF(?gettyObject = aat:300189557, wd:Q6581072, "")) AS ?wdObject)
  FILTER(?wdObject != "")\u0023
  hint:Query hint:optimizer "None" .\u0023
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P21)
  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("P21" 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
QScsv ; QScsv
  • count genders in ULAN:
    SELECT ?gender (COUNT(?gender) as ?count) {
      ?agent gvp:biographyPreferred/schema:gender ?gender .
      }
    GROUP BY ?gender
    
    Try it! ; Try it!
  • a messy query to spot contradictory gender in Wikidata and ULAN (nothing found so far up to OFFSET given here, on 2018-06-10; could perhaps be sped up by hints, now better queries from complex constraints on Property talk:P245!):
    PREFIX gvp: <http://vocab.getty.edu/ontology#>
    PREFIX aat: <http://vocab.getty.edu/aat/>
    
    SELECT
    ?item ?ulanID
    # ?itemLabel ?wdValueLabel ?ulanHuman
      WITH { SELECT ?item ?ulanID ?wdValue
      WHERE {
        ?item wdt:P245 ?ulanID .
        ?item wdt:P21 ?wdValue .
      } ORDER BY ?item LIMIT 5000 OFFSET 55000 } AS %items
    
      # now see what ULAN says to those statements
      WHERE { INCLUDE %items
      BIND(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) AS ?ulanURI)
    #  BIND(URI(CONCAT("http://vocab.getty.edu/page/ulan/", ?ulanID)) AS ?ulanHuman)
      SERVICE <http://vocab.getty.edu/sparql.json> {
        ?ulanURI foaf:focus ?ulanAgent .
        ?ulanAgent gvp:biographyPreferred ?ulanBio.
        ?ulanBio schema:gender ?ulanValue .
        # translate: aat:300189557 (female) -> wd:Q6581072, aat:300189559 (male) -> wd:Q6581097
        # don't use aat:300400512 (unavailable; 61321 (2018-06-10)), aat:300400513 (other; 2 (2018-06-10))
        BIND(IF(?ulanValue = aat:300189559, wd:Q6581097, IF(?ulanValue = aat:300189557, wd:Q6581072, wd:Q1)) AS ?wdValueFromGetty)
      }
      FILTER((?wdValueFromGetty IN (aat:300189557, aat:300189559)) && (?wdValue != ?wdValueFromGetty))
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}
    }
    LIMIT 500
    
    Try it!
work location (P937)
# property P937 statements without any reference
# 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): P937 ("work location") statements: add ULAN as first 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 ?P937  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P937 ?statement .
    ?statement ps:P937 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:eventPreferred|gvp:eventNonPreferred) ?event.
?event dct:type aat:300393177.
?event schema:location/^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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P937)
  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("P937" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P937 statements without any reference
# 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 p:P937 ?statement .
    ?statement ps:P937 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:eventPreferred|gvp:eventNonPreferred) ?event.
?event dct:type aat:300393177.
?event schema:location/^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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P1667 ?tgnID . FILTER(URI(CONCAT("http://vocab.getty.edu/tgn/", ?tgnID)) = ?gettyObject)\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 ?P937)
  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("P937" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P937, "%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
nice-QS ; nice-QS
  • This does not add dates, they are estimates though.[1] Adding would be possible by conferring with strings from rdfs:comment, see:
    SELECT * WHERE {
      ?gettySubject foaf:focus/(gvp:eventPreferred|gvp:eventNonPreferred) ?event.
      ?event dct:type aat:300393177.
      ?event schema:location/^foaf:focus ?gettyObject.
      ?event gvp:estStart ?start.
      ?event gvp:estEnd ?end.
      OPTIONAL { ?event rdfs:comment ?eventComment. }
    #  ?gettyObject xl:prefLabel/xl:literalForm ?gettyObjectTerm. FILTER(LANG(?gettyObjectTerm) = "en")
      OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
      OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
    }
    LIMIT 100
    
    Try it! ; Try it!
occupation (P106)
# property P106 statements without any reference
# 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): P106 ("occupation") statements: add ULAN as first 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 ?P106  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P106 ?statement .
    ?statement ps:P106 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 8000 } 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:agentTypePreferred|gvp:agentTypeNonPreferred) ?gettyObject .  \u0023
    { SELECT ?gettyModified WHERE {
      ?gettySubject dct:modified ?gettyModified .
      } ORDER BY DESC(?gettyModified) LIMIT 1
    }
  OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  }
  ?wdObject wdt:P1014 ?aatID . FILTER(URI(CONCAT("http://vocab.getty.edu/aat/", ?aatID)) = ?gettyObject)\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 first reference 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
QScsv ; QScsv
# property P106 statements without any reference
# 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 p:P106 ?statement .
    ?statement ps:P106 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } 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:agentTypePreferred|gvp:agentTypeNonPreferred) ?gettyObject .  \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
  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 first reference 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
nice-QS ; nice-QS

GVP-side type checked (and remove less specific gvp:agentTypePreferred here!! (cf. GVP doc))

# 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
nice-QS ; nice-QS
child (P40)
# property P40 statements without any reference
# 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 ULAN as first 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  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P40 ?statement .
    ?statement ps:P40 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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
  # 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 first reference 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
QScsv ; QScsv
# property P40 statements without any reference
# 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 p:P40 ?statement .
    ?statement ps:P40 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  
  }
  ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?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 first reference 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", ?P40, "%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
nice-QS ; nice-QS
# 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
QScsv ; QScsv
# property P40 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 .
    
    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
    }\u0023
    OPTIONAL { ?gettySubject gvp:prefLabelGVP/xl:literalForm ?gettySubjectTerm. }
    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
  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 ?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
  # 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", ?P40, "%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
nice-QS ; nice-QS
sibling (P3373)
# property P3373 statements without any reference
# 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): P3373 ("sibling") statements: add ULAN as first 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 ?P3373  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P3373 ?statement .
    ?statement ps:P3373 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1501_sibling_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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P3373)
  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("P3373" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P3373 statements without any reference
# 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 p:P3373 ?statement .
    ?statement ps:P3373 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1501_sibling_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P3373)
  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("P3373" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P3373, "%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
nice-QS ; nice-QS
# property P3373 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): P3373 ("sibling") 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 ?P3373 ?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:P3373 [] . }
  } LIMIT 300 } 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:ulan1501_sibling_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 ?P3373)
  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("P3373" 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
QScsv ; QScsv
# property P3373 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 .
    
    FILTER NOT EXISTS { ?item p:P3373 [] . }
  } LIMIT 300 } 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:ulan1501_sibling_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?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 ?P3373)
  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("P3373" 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", ?P3373, "%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
nice-QS ; nice-QS
spouse (P26)
# property P26 statements without any reference
# 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): P26 ("spouse") statements: add ULAN as first 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 ?P26  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P26 ?statement .
    ?statement ps:P26 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1541_spouse_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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P26)
  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("P26" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P26 statements without any reference
# 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 p:P26 ?statement .
    ?statement ps:P26 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } 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:ulan1541_spouse_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P26)
  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("P26" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P26, "%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
nice-QS ; nice-QS
# property P26 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): P26 ("spouse") 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 ?P26 ?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:P26 [] . }
  } 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:ulan1541_spouse_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 ?P26)
  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("P26" 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
QScsv ; QScsv
# property P26 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 .
    
    FILTER NOT EXISTS { ?item p:P26 [] . }
  } 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:ulan1541_spouse_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?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 ?P26)
  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("P26" 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", ?P26, "%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
nice-QS ; nice-QS
stepparent (P3448)
# property P3448 statements without any reference
# 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): P3448 ("stepparent") statements: add ULAN as first 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 ?P3448  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P3448 ?statement .
    ?statement ps:P3448 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1562_step-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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P3448)
  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("P3448" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P3448 statements without any reference
# 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 p:P3448 ?statement .
    ?statement ps:P3448 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1562_step-parent_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P3448)
  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("P3448" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P3448, "%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
nice-QS ; nice-QS
# property P3448 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): P3448 ("stepparent") 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 ?P3448 ?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:P3448 [] . }
  } LIMIT 10000 } 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:ulan1562_step-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 ?P3448)
  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("P3448" 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
QScsv ; QScsv
# property P3448 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 .
    
    FILTER NOT EXISTS { ?item p:P3448 [] . }
  } LIMIT 10000 } 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:ulan1562_step-parent_of ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?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 ?P3448)
  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("P3448" 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", ?P3448, "%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
nice-QS ; nice-QS
family (P53)
# property P53 statements without any reference
# 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): P53 ("family") statements: add ULAN as first 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 ?P53  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P53 ?statement .
    ?statement ps:P53 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 100000 } 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:ulan1317_member_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:P31/wdt:P279* wd:Q8436 . ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\u0023
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P53)
  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("P53" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P53 statements without any reference
# 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 p:P53 ?statement .
    ?statement ps:P53 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 100000 } 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:ulan1317_member_of ?gettyObject .  \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. }
  OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  }
  ?wdObject wdt:P31/wdt:P279* wd:Q8436 . ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P53)
  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("P53" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P53, "%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
nice-QS ; nice-QS
# property P53 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): P53 ("family") 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 ?P53 ?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:P53 [] . }
  } LIMIT 100000 } 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:ulan1317_member_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:P31/wdt:P279* wd:Q8436 . ?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 ?P53)
  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("P53" 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
QScsv ; QScsv
# property P53 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 .
    
    FILTER NOT EXISTS { ?item p:P53 [] . }
  } LIMIT 100000 } 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:ulan1317_member_of ?gettyObject .  \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. }
  OPTIONAL { ?gettyObject gvp:prefLabelGVP/xl:literalForm ?gettyObjectTerm. }
  }
  ?wdObject wdt:P31/wdt:P279* wd:Q8436 . ?wdObject wdt:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?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 ?P53)
  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("P53" 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", ?P53, "%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
nice-QS ; nice-QS
  • most frequent as family in ULAN, but ULAN for family not in WD:
    PREFIX gvp: <http://vocab.getty.edu/ontology#>
    
    SELECT
    ?gettySubjectURL ?wdSearchURL ?name ?id ?count
      WHERE {
      SERVICE <http://vocab.getty.edu/sparql.json> {
        { SELECT ?gettySubject ?name ?id (COUNT(?gettySubject) as ?count) {
          ?agent gvp:ulan1317_member_of ?gettySubject .
          ?gettySubject gvp:agentTypePreferred <http://vocab.getty.edu/aat/300055474>.
          ?gettySubject gvp:prefLabelGVP/gvp:term ?name .
          ?gettySubject dc:identifier ?id .
          }
          GROUP BY ?gettySubject ?name ?id
        }
      }
      MINUS { ?item wdt:P245 ?id . }
      BIND(URI(CONCAT("http://vocab.getty.edu/page/ulan/", ?id)) AS ?gettySubjectURL)
      BIND(URI(CONCAT("https://www.wikidata.org/wiki/Special:Search/", ?name)) AS ?wdSearchURL)
    }
    ORDER BY DESC(?count)
    #LIMIT 300
    
    Try it! ; Try it!
educated at (P69)
# property P69 statements without any reference
# 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): P69 ("educated at") statements: add ULAN as first 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 ?P69  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P69 ?statement .
    ?statement ps:P69 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 10000 } 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:ulan2828_student_at|gvp:ulan1322_school_was) ?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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P69)
  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("P69" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P69 statements without any reference
# 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 p:P69 ?statement .
    ?statement ps:P69 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 10000 } 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:ulan2828_student_at|gvp:ulan1322_school_was) ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P69)
  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("P69" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P69, "%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
nice-QS ; nice-QS
This does not add dates, they are estimates though.[1]
  • most frequent as education object in ULAN, but ULAN for object not in WD:
    PREFIX gvp: <http://vocab.getty.edu/ontology#>
    
    SELECT
    ?institutionURL ?wdSearchURL ?name ?id ?count
      WHERE {
      SERVICE <http://vocab.getty.edu/sparql.json> {
        { SELECT ?institution ?name ?id (COUNT(?institution) as ?count) {
          ?agent (gvp:ulan2828_student_at|gvp:ulan1322_school_was) ?institution .
          ?institution gvp:prefLabelGVP/gvp:term ?name .
          ?institution dc:identifier ?id .
          }
          GROUP BY ?institution ?name ?id
        }
      }
      MINUS { ?item wdt:P245 ?id . }
      BIND(URI(CONCAT("http://vocab.getty.edu/page/ulan/", ?id)) AS ?institutionURL)
      BIND(URI(CONCAT("https://www.wikidata.org/wiki/Special:Search/", ?name)) AS ?wdSearchURL)
    }
    ORDER BY DESC(?count)
    LIMIT 30
    
    Try it! ; Try it!
said to be the same as (P460)
# property P460 statements without any reference
# 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): P460 ("said to be the same as") statements: add ULAN as first 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 ?P460  ?S248 ?s245 ?s577 ?s813 ?commentRef
  WITH { SELECT ?item ?gettyHumanURI ?gettySubjectTerm ?wdObject ?gettyObject ?gettyObjectTerm ?gettyID
  WHERE {
    ?item wdt:P245 ?gettyID .
    
    ?item p:P460 ?statement .
    ?statement ps:P460 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1005_possibly_identified_with ?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
  # formatting
  BIND(SUBSTR(STR(?item), 32) AS ?qid)
  BIND(SUBSTR(STR(?wdObject), 32) AS ?P460)
  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("P460" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("add first reference 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
QScsv ; QScsv
# property P460 statements without any reference
# 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 p:P460 ?statement .
    ?statement ps:P460 ?wdObject .
    FILTER NOT EXISTS { ?statement prov:wasDerivedFrom ?wdRef . }
    FILTER NOT EXISTS { ?statement ?someQualProp [] .
                        [] wikibase:qualifier ?someQualProp . }
  } LIMIT 90000 } 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:ulan1005_possibly_identified_with ?gettyObject .  \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:P245 ?ulanID . FILTER(URI(CONCAT("http://vocab.getty.edu/ulan/", ?ulanID)) = ?gettyObject)\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 ?P460)
  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("P460" AS ?wdPropPid)    
  BIND("S248" as ?S248str)
  BIND("S245" as ?S245str)
  BIND("S577" as ?S577str)
  BIND("S813" as ?S813str)\u0023
  BIND("/*add first reference 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", ?P460, "%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
nice-QS ; nice-QS

Template:WDGettyCompQuery Template:WDGettyCompQuery

TGN entities
Template:P

Template:WDGettyCompQuery Template:WDGettyCompQuery

Template:P

Template:WDGettyCompQuery Template:WDGettyCompQuery

Template:WDGettyCompQuery Template:WDGettyCompQuery

  1. 1.0 1.1 [1] and [2]

Edits done edit

Usefulness has been contested in Wikidata:Project chat/Archive/2019/05#Does Wikidata lack a Quality mindset? Sometimes it feels more like a playground for python exercises...?

TGN matching edit

Matching on a specific administrative level can be done with queries like this one (heavy adaption necessary, also to escape timeout):

TODO edit

Lessons learnt edit

  • for many projects pywikibot will be a more sustainable way, having less restrictions with WDQS timeout, Lua memory usage etc. also copypasting can be reduced. drawbacks: useful built-in features like batches

Ontology mapping edit

  • From the database (some have still to be tested since the GVP ontology specification is not that clear; as of 2018-06-10 all ULAN properties have tried to be mapped there): Template:SPARQL

For the GVP ontology see http://vocab.getty.edu/ontology!

Some matches that need special modelling here:

Getty Wikidata
gvp:ulan1006_formerly_identified_with Template:P+Template:P with deprecated rank
gvp:ulan1204_donor_was Template:P is similar
gvp:ulan1513_grandchild_of Template:P with qualifier
gvp:ulan1514_gandparent_of "
gvp:ulan1532_uncle-aunt_of "