Sample queries of enhanced MoMA data

See Data wrangling, feature engineering, and dada for more on this.

Because size calculations all start with measurements in centimeters, area figures are in square centimeters and volume in cubic centimeters.

Queries that return information about individual works usually include OPTIONAL { ?s owl:sameAs ?url } because the MoMA URL for a work take you right to their individual page about it. (OPTIONAL because they're not always there.)

All queries assume these prefix declarations:

PREFIX  dc:    <http://purl.org/dc/elements/1.1/>
PREFIX  rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  r:     <http://rdvocab.info/ElementsGr2/>
PREFIX  rdaGr2: <http://RDVocab.info/ElementsGr2/>
PREFIX  ci:    <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX  xsd:   <http://www.w3.org/2001/XMLSchema#>
PREFIX  owl:   <http://www.w3.org/2002/07/owl#>
PREFIX  m:     <http://rdfdata.org/models/moma/>

What’s the single largest painting?

SELECT ?title ?area ?artist ?url
WHERE { 
  ?work m:heightCm ?height;
        m:widthCm ?width ;
        rdfs:label ?title ;
        m:classification "Painting" ;
        dc:creator ?artist ;
        OPTIONAL { ?work owl:sameAs ?url }
   BIND(?height * ?width AS ?area)
}
ORDER BY DESC(?area)
LIMIT 1
title area artist url
F-111 798972.24 James Rosenquist http://www.moma.org/collection/works/79805

What’s the largest photograph?

SELECT ?title ?area ?artist ?url
WHERE { 
  ?work m:classification "Photograph" ;
        m:heightCm ?height;
        m:widthCm ?width ;
        rdfs:label ?title ;
        owl:sameAs ?url ;
        dc:creator ?artist .
   BIND(?height * ?width AS ?area)
}
ORDER BY DESC(?area)
LIMIT 1
title area artist url
11 232257.60 Mariah Robertson http://www.moma.org/collection/works/163921

What’s the largest three-dimensional work?

SELECT ?title ?volume ?artist ?url
WHERE { 
  ?work m:heightCm ?height;
         m:widthCm ?width ;
         m:depthCm ?depth ;
         rdfs:label ?title ;
         dc:creator ?artist . 
   OPTIONAL {?work owl:sameAs ?url }
   BIND(?height * ?width * ?depth AS ?volume)
}
ORDER BY DESC(?volume)
LIMIT 1
title volume artist url
Stations 1418631250.000 Bill Viola http://www.moma.org/collection/works/81737

How many painters come from each country?

This one used a subquery.

SELECT ?nationality (COUNT(?nationality) AS ?artistCount)
WHERE {
   SELECT DISTINCT ?artist ?nationality 
   WHERE { 
     ?work m:classification "Painting" ;
           dc:creator ?artist ;
           rdaGr2:countryAssociatedWithThePerson ?nationality . 
   }
}
GROUP BY ?nationality
ORDER BY desc(?artistCount)
nationality artistCount
American 494
French 89
German 56
British 46
Italian 41
Russian 18
Argentine 17
Japanese 16
Brazilian 14
Belgian 13
Canadian 13
Spanish 13
Dutch 12
Mexican 12
Swiss 11
Polish 9
Austrian 8
Cuban 8
Australian 7
Israeli 6
Indian 5
Peruvian 5
Colombian 4
Haitian 4
Danish 3
Hungarian 3
Swedish 3
Venezuelan 3
Chilean 2
Croatian 2
Icelandic 2
Iranian 2
Irish 2
Korean 2
Turkish 2
Uruguayan 2
Yugoslav 2
Zimbabwean 2
Bolivian 1
Congolese 1
Czech 1
Ghanaian 1
Guatemalan 1
Guyanese 1
Moroccan 1
Nicaraguan 1
Norwegian 1
Romanian 1
South 1
Sudanese 1
Tanzanian 1
Ukrainian 1
born 1

What’s the average painting size by country?

Note the comment about the HAVING statement.

SELECT ?nationality (round(AVG(?area)) AS ?averageArea)(
       count(?work) AS ?paintings)
WHERE { 
  ?work m:classification "Painting" ;
        m:heightCm ?height;
        m:widthCm ?width ;
        rdaGr2:countryAssociatedWithThePerson ?nationality . 
   BIND(?height * ?width AS ?area)
}
GROUP BY ?nationality
# We'll consider fewer than 11 paintings to 
# be an unrepresentative sample.
HAVING(?paintings > 10)
ORDER BY DESC(?averageArea)
nationality averageArea paintings
American 28244 1098
German 23503 123
British 22791 78
Japanese 22703 22
Italian 21889 77
Swiss 21538 19
Canadian 19415 13
Argentine 18665 19
Spanish 16155 96
French 14209 327
Brazilian 13224 15
Austrian 12761 13
Mexican 12341 28
Cuban 10423 11
Belgian 9813 35
Dutch 8277 35
Polish 7448 15
Russian 6758 32

What are the oldest pieces in the collection and who made them?

Now you can see why the owl:samAs property is optional (and why I created my own URIs to represent the works instead of just using the MoMA ones—because they don't all have them).

SELECT ?workFinishDate ?title ?artist ?medium ?url
WHERE { 
  ?work m:workFinishDate ?workFinishDate ;
        rdfs:label ?title ;
        ci:P2_has_type ?medium ;
        dc:creator ?artist .
  OPTIONAL { ?work owl:sameAs ?url }
}
ORDER BY ?workFinishDate
LIMIT 5
workFinishDate title artist medium url
1600 Woman unknown Double warp silk brocade
1768 Coffee Pot and Lid Josiah Wedgwood Black basalt with glazed interior http://www.moma.org/collection/works/91975
1768 Demitasse Cup and Saucer Josiah Wedgwood Black basalt with glazed interior http://www.moma.org/collection/works/91977
1768 Partial Coffee and Tea Service Josiah Wedgwood Black basalt with glazed interior http://www.moma.org/collection/works/2767
1768 Sugar Bowl Josiah Wedgwood Black basalt with glazed interior http://www.moma.org/collection/works/91978

Who are the five youngest painters with work in the collection?

Without DISTINCT, each would have been listed on a new row for each painting that they had.

SELECT DISTINCT ?artist ?birthYear
WHERE { 
     ?work m:classification "Painting" ;
    	   dc:creator ?artist ;
           rdaGr2:dateOfBirth ?birthYear .
}
ORDER BY desc(?birthYear)
LIMIT 5
artist birthYear
1984 Adam Pendleton
1983 Ryan Sullivan
1982 Alex Israel
1981 Tauba Auerbach
1980 Kerstin Brätsch, Adele Röder