query-5150b4b3f78352698015dca4d1ce2b67
Getting URL's out of "Wikidata property to identify artworks (Q44847669)"I'm trying to extract metadata and images of artworks for specific collections. Here is an example of a query that I use:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?work ?inventory_number ?image ?inception ?instance_of ?instance_ofLabel ?collection ?collectionLabel ?creator ?creatorLabel ?Groeningemuseum_work_PID WHERE {
?work wdt:P195 wd:Q1948674.
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
OPTIONAL { ?work wdt:P217 ?inventory_number. }
OPTIONAL { ?work wdt:P18 ?image. }
OPTIONAL { ?work wdt:P571 ?inception. }
OPTIONAL { ?work wdt:P31 ?instance_of. }
OPTIONAL { ?work wdt:P195 ?collection. }
OPTIONAL { ?work wdt:P170 ?creator. }
OPTIONAL { ?work wdt:P2282 ?Groeningemuseum_work_PID. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?Groeningemuseum_work_PID"):::projected
v6("?collection"):::projected
v7("?creator"):::projected
v3("?image"):::projected
v4("?inception"):::projected
v5("?instance_of"):::projected
v2("?inventory_number"):::projected
v1("?work"):::projected
c4(["bd:serviceParam"]):::iri
c2(["wd:Q1948674"]):::iri
c6(["nl"]):::literal
v1 --"wdt:P195"--> c2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P217".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P571".-> v4
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> v5
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P195".-> v6
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P170".-> v7
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P2282".-> v8
end