query-e8f2b9d4aeb3e398eedeea3db4207afc

rq turtle/ttl

Query to get Qids of duplicate YCBA artworks added in error SELECT ?artwork WHERE { { # Subquery to get 297 YCBA accession numbers for # works added by SmartifyBot more than once SELECT ?acc WHERE { ?item wdt:P195 wd:Q6352575. ?item wdt:P973 ?desc. FILTER(CONTAINS(STR(?desc), "smartify")). ?item wdt:P217 ?acc. } GROUP BY ?acc HAVING(COUNT(?item) > 1) } ?artwork wdt:P195 wd:Q6352575. # Get artworks for YCBA ?artwork wdt:P217 ?accession. # Get accession number ?artwork wdt:P973 ?described. # Only get artworks FILTER(CONTAINS(STR(?described), "smartify")). # described at Smartify # NOTE: remove following 2 lines to see original # work and duplicate on successive lines ?artwork schema:description ?description # Only get duplicate work with YCBA and FILTER(CONTAINS(?description, "(YCBA")). # accession number added to description FILTER(?accession = ?acc). # Only consider 297 works from subquery } ORDER BY $accession

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
# Query to get Qids of duplicate YCBA artworks added in error
SELECT ?artwork WHERE {
  {
    # Subquery to get 297 YCBA accession numbers for
    # works added by SmartifyBot more than once
    SELECT ?acc WHERE {
        ?item wdt:P195 wd:Q6352575.
        ?item wdt:P973 ?desc.
        FILTER(CONTAINS(STR(?desc), "smartify")).
        ?item wdt:P217 ?acc.
    }
    GROUP BY ?acc
    HAVING(COUNT(?item) > 1)
  }
  ?artwork wdt:P195 wd:Q6352575.                   # Get artworks for YCBA
  ?artwork wdt:P217 ?accession.                    # Get accession number
  ?artwork wdt:P973 ?described.                    # Only get artworks
  FILTER(CONTAINS(STR(?described), "smartify")).   #  described at Smartify
  # NOTE: remove following 2 lines to see original
  #      work and duplicate on successive lines
  ?artwork schema:description ?description         # Only get duplicate work with YCBA and
  FILTER(CONTAINS(?description, "(YCBA")).         #   accession number added to description
  FILTER(?accession = ?acc).                       # Only consider 297 works from subquery
}
ORDER BY $accession

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?_anon_42b5416610844a34809f33a099ae9de195387") v2("?acc") v1("?accession") v8("?artwork"):::projected v5("?desc") v4("?described") v3("?description") v6("?item") a1((" ")) c5(["wd:Q6352575"]):::iri f0[["?accession = ?acc"]] f0 --> v1 f0 --> v2 f1[["contains(?description,'(YCBA')"]] f1 --> v3 f2[["contains(str(?described),'smartify')"]] f2 --> v4 f3[[" > '1^^xsd:integer'"]] f3 --> a1 f4[["contains(str(?desc),'smartify')"]] f4 --> v5 v6 --"wdt:P195"--> c5 v6 --"wdt:P973"--> v5 v6 --"wdt:P217"--> v2 bind6[/"count(?item)"/] v6 --o bind6 bind6 --as--o v7 v8 --"wdt:P195"--> c5 v8 --"wdt:P217"--> v1 v8 --"wdt:P973"--> v4 v8 --"schema:description"--> v3