Skip to content

Instantly share code, notes, and snippets.

@baskaufs
Created October 6, 2021 21:41
Show Gist options
  • Save baskaufs/f0bc9b34037c3c25d426d99bd2adeb27 to your computer and use it in GitHub Desktop.
Save baskaufs/f0bc9b34037c3c25d426d99bd2adeb27 to your computer and use it in GitHub Desktop.
SPARQL query for finding ACT IDs to remove from non-artwork
# work1 has an ACT ID, and is an artwork. work2 is NOT an artwork and may or may not have an ACT ID.
# If work2 has an ACT ID, it should be removed. If it doesn't, no action is required.
select distinct ?work1 ?actId1 ?work1Label ?class1Label ?work2 ?actId2 ?work2Label ?class2Label where {
?work1 wdt:P9092 ?actId1.
?work1 wdt:P18 ?commonsImage.
?work1 wdt:P31 ?class1.
?work2 wdt:P18 ?commonsImage.
optional{?work2 wdt:P31 ?class2.}
optional {?work2 wdt:P9092 ?actId2.}
filter(?work1 != ?work2)
minus {?work2 wdt:P31 wd:Q3305213.} # painting
minus {?work2 wdt:P31 wd:Q15711026.} # altarpiece
minus {?work2 wdt:P31 wd:Q93184.} # drawing
minus {?work2 wdt:P31 wd:Q22669139.} # fresco
minus {?work2 wdt:P31 wd:Q15123870.} # lithograph
minus {?work2 wdt:P31 wd:Q8362.} # miniature
minus {?work2 wdt:P31 wd:Q133067.} # mosaic
minus {?work2 wdt:P31 wd:Q219423.} # mural
minus {?work2 wdt:P31 wd:Q125191.} # photograph
minus {?work2 wdt:P31 wd:Q11060274.} # print
minus {?work2 wdt:P31 wd:Q1064538.} # quilt
minus {?work2 wdt:P31 wd:Q245117.} # relief sculpture
minus {?work2 wdt:P31 wd:Q860861.} # sculpture
minus {?work2 wdt:P31 wd:Q2282251.} # seven-branched candlestick
minus {?work2 wdt:P31 wd:Q1473346.} # stained glass
minus {?work2 wdt:P31 wd:Q179700.} # statue
minus {?work2 wdt:P31 wd:Q18761202.} # watercolor painting
{?work1 wdt:P31 wd:Q3305213.} # painting
union {?work1 wdt:P31 wd:Q15711026.} # altarpiece
union {?work1 wdt:P31 wd:Q93184.} # drawing
union {?work1 wdt:P31 wd:Q22669139.} # fresco
union {?work1 wdt:P31 wd:Q15123870.} # lithograph
union {?work1 wdt:P31 wd:Q8362.} # miniature
union {?work1 wdt:P31 wd:Q133067.} # mosaic
union {?work1 wdt:P31 wd:Q219423.} # mural
union {?work1 wdt:P31 wd:Q125191.} # photograph
union {?work1 wdt:P31 wd:Q11060274.} # print
union {?work1 wdt:P31 wd:Q1064538.} # quilt
union {?work1 wdt:P31 wd:Q245117.} # relief sculpture
union {?work1 wdt:P31 wd:Q860861.} # sculpture
union {?work1 wdt:P31 wd:Q2282251.} # seven-branched candlestick
union {?work1 wdt:P31 wd:Q1473346.} # stained glass
union {?work1 wdt:P31 wd:Q179700.} # statue
union {?work1 wdt:P31 wd:Q18761202.} # watercolor painting
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}
order by ?work1Label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment