Met Museum Open Access report

Here are a series Wikidata queries to show items created and images uploaded as part of the Metropolitan Museum of Art Open Access initiative. Andrew Lih (User:Fuzheado), The Met Wikimedia Strategist, and Richard Knipel (User:Pharos), the Wikimedian in residence, are working on comprehensive contribution of the Met's highlighted objects, Heilbrunn Timeline of Art History and significant objects on view to Wikimedia projects Wikipedia, Wikidata and Commons.

The full Wikidata query can be explored by clicking on the "Wikidata Query Service" link/icon on each block.

import urllib.parse
from IPython.display import IFrame
baseurl='https://query.wikidata.org/embed.html#'

def wdq(query='',width=800,height=500):
  """Runs Wikidata query in an iFrame and shows the results."""
  return IFrame(baseurl+urllib.parse.quote(query), width=width, height=height)

Wikidata presence

A current count of all Met artworks, using multiple criterion.

wdq("""
SELECT DISTINCT (COUNT(?item) as ?count) WHERE { 
    BIND (wd:Q160236 AS ?institution)
    ?item p:P217 [ ps:P217 ?id ; pq:P195 ?institution ] 
    OPTIONAL { ?item wdt:P31 ?inst } 
}
""",width=300,height=70)

Image grid of Wikidata items

A sampling of the Wikidata items with images.

wdq(width=1000,height=600,query="""
#defaultView:ImageGrid
SELECT DISTINCT ?item ?itemLabel ?id ?img WHERE {
  BIND (wd:Q160236 AS ?institution)
  ?item p:P217 [ps:P217 ?id; pq:P195 ?institution ] .
  OPTIONAL { ?item wdt:P18 ?img } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
""")

Histogram of different types of artworks

What types of artworks are in Wikidata? The Sum of All Paintings (SOAP) project has ingested many paintings already, contributing a large showing in that category.

wdq("""
#defaultView:BubbleChart
# Show histogram of artwork types/instances for a GLAM entity
SELECT DISTINCT ?q ?qLabel (COUNT(?q) as ?count) WHERE {
    # Replace the below with the GLAM institution
    BIND (wd:Q160236 AS ?institution)
    { ?item wdt:P3634 ?id }
    UNION 
    { ?item wdt:P195 ?institution }
    ?item wdt:P31 ?q .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?q ?qLabel
ORDER BY DESC (?count)
LIMIT 50
""")
wdq("""
#defaultView:BubbleChart
# Show histogram of artwork types/instances for a GLAM entity
SELECT ?q ?qLabel (COUNT(?q) as ?count) WHERE {
    # Replace the below with the GLAM institution
    BIND (wd:Q160236 AS ?institution)
    { ?item wdt:P3634 ?id }
    UNION 
    { ?item wdt:P195 ?institution }
    ?item wdt:P31 ?q .
    FILTER NOT EXISTS { ?item wdt:P31 wd:Q3305213 } 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?q ?qLabel
ORDER BY DESC (?count)
LIMIT 50
""")
wdq(width=1000,height=800,query="""
#defaultView:BubbleChart
# Show histogram of artwork types/instances for a GLAM entity
SELECT ?q ?qLabel (COUNT(?q) as ?count) WHERE {
    # Replace the below with the GLAM institution
    BIND (wd:Q160236 AS ?institution)
    { ?item wdt:P3634 ?id }
    UNION 
    { ?item wdt:P195 ?institution }
    ?item wdt:P170 ?q . # Creators
    FILTER NOT EXISTS { ?item wdt:P170 wd:Q4233718 } # Filter out anonymous

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?q ?qLabel
ORDER BY DESC (?count)
LIMIT 50
""")

Most depicted things in dataset

wdq("""
# Most depicted things in paintings
#defaultView:BubbleChart
SELECT ?depictstatementLabel ?count {
  {
  SELECT ?depictstatement (COUNT(?depictstatement) AS ?count) WHERE {
    SELECT ?item ?depictstatement WHERE {
      ?item wdt:P31/wdt:P279* wd:Q3305213 .
      BIND (wd:Q160236 AS ?institution)
      { ?item wdt:P3634 ?id }
      UNION 
      { ?item wdt:P195 ?institution }
      ?item wdt:P180 ?depictstatement .
    } LIMIT 300000
  } GROUP BY ?depictstatement
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }         
} ORDER BY DESC(?count) LIMIT 100
""")

Most represented artists in dataset

Which artists are most represented in the holdings in Wikidata?

wdq(width=1000,height=800,query="""
#defaultView:BubbleChart
# Show histogram of artwork types/instances for a GLAM entity
SELECT ?q ?qLabel (COUNT(?q) as ?count) WHERE {
    # Replace the below with the GLAM institution
    BIND (wd:Q160236 AS ?institution)
    { ?item wdt:P3634 ?id }
    UNION 
    { ?item wdt:P195 ?institution }
    ?item wdt:P170 ?q . # Creators
    FILTER NOT EXISTS { ?item wdt:P170 wd:Q4233718 } # Filter out anonymous

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?q ?qLabel
ORDER BY DESC (?count)
LIMIT 50
""")

Timeline of most prominent artists at The Met

wdq(width=1000,height=1000,query="""
#defaultView:Timeline
# Show histogram of creators for all artworks that match GLAM entity
SELECT DISTINCT ?q ?qLabel ?count ?dob ?img WHERE
{
    {
      SELECT ?q (COUNT(?q) as ?count) WHERE {
        # Replace with the GLAM institution
        BIND (wd:Q160236 AS ?institution)
        { ?item wdt:P3634 ?id }
        UNION 
        { ?item wdt:P195 ?institution }
        ?item wdt:P170 ?q . # Creators
        FILTER NOT EXISTS { ?item wdt:P170 wd:Q4233718 } # Filter out anonymous
      } 
    GROUP BY ?q ?qLabel
    } 
    OPTIONAL { ?q wdt:P569 ?dob }
    OPTIONAL { ?q wdt:P18 ?img }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY DESC (?count)
LIMIT 50
""")

Map of place of birth for most prominent artists

wdq("""
#defaultView:Map
# Show place of birth locations for most prominent artists
SELECT DISTINCT ?q ?qLabel ?pobLabel ?coord ?img WHERE
{
    {
      SELECT ?q (COUNT(?q) as ?count) WHERE {
        # Replace with the GLAM institution
        BIND (wd:Q160236 AS ?institution)
        { ?item wdt:P3634 ?id }
        UNION 
        { ?item wdt:P195 ?institution }
        ?item wdt:P170 ?q . # Creators
        FILTER NOT EXISTS { ?item wdt:P170 wd:Q4233718 } # Filter out anonymous
      } 
    GROUP BY ?q ?qLabel
    } 
    OPTIONAL { ?q wdt:P19 ?pob . ?pob wdt:P625 ?coord }
    OPTIONAL { ?q wdt:P18 ?img }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY DESC (?count)
LIMIT 400
""")