query wikidata sparql for artworks, creators, and museum cross-identifiers
domain: wikidata.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
open the Wikidata Query Service at query.wikidata.org (GUI) or POST to query.wikidata.org/sparql programmatically
write a SPARQL query selecting items with wdt:P31/wdt:P279* of an artwork class (e.g. wd:Q3305213 for painting), joined to wdt:P170 (creator) and properties like wdt:P276 (location) or wdt:P195 (collection)
add OPTIONAL clauses pulling museum-specific identifiers (e.g. wdt:P217 inventory number, or an institution's own external-ID property if one exists) to cross-link a Wikidata item to a record in a source museum's own API
add SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } to resolve human-readable labels instead of raw Q-IDs in results
test and refine queries interactively using the example queries linked from Wikidata:SPARQL_query_service/queries/examples before automating
Known gotchas
the query service enforces a query timeout (documented as roughly 60 seconds) — broad, unindexed queries over large classes can time out; add LIMIT and narrow type constraints
not every museum has a dedicated Wikidata external-ID property for its own object identifiers — check the item's existing statements before assuming a cross-link exists
Wikidata's structured data is CC0, but that does not license the linked image or artwork itself — check separate image/media rights independently (e.g. via Commons)
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?