query-a7542d2a92884e97746fed2fa097b11e

rq turtle/ttl

SPARQL query in upload script

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?itemdate ?inv ?downloadurl ?format ?sourceurl ?title ?creatorname ?license ?operator ?collectionLabel ?collectioncategory WHERE {
  ?item p:P4765 ?image .
  ?item schema:dateModified ?itemdate .
  ?item wdt:P31 wd:Q81564326 .
  ?item wdt:P217 ?inv .
  ?item wdt:P6216 ?license .
  ?image ps:P4765 ?downloadurl .
  ?image pq:P2701 ?format .
  ?image pq:P2699 ?sourceurl .
  ?image pq:P1476 ?title .
  OPTIONAL { ?image pq:P2093 ?creatorname }.
 # ?item wdt:P170 wd:Q4233718 .
  ?image pq:P137 wd:Q1526131.
  ?item wdt:P195 ?collection .
  # ?item wdt:P170 ?creator .
  ?creator wdt:P570 ?dod . BIND(YEAR(?dod) AS ?deathyear)
  FILTER(?deathyear < (YEAR(NOW())-95)) .
  ?creator schema:dateModified ?creatordate .
  OPTIONAL { ?creator wdt:P373 ?creatorcategory } .
  ?collection rdfs:label ?collectionLabel. FILTER(LANG(?collectionLabel) = "en").
  ?collection wdt:P373 ?collectioncategory .
  ?item wdt:P571 ?inception . BIND(YEAR(?inception) AS ?inceptionyear)
  FILTER(?inceptionyear < 1890) .
  } ORDER BY DESC(?itemdate)
  LIMIT 15000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v14("?collection") v3("?collectionLabel"):::projected v19("?collectioncategory"):::projected v15("?creator") v18("?creatorcategory") v17("?creatordate") v13("?creatorname"):::projected v17("?deathyear") v16("?dod") v9("?downloadurl"):::projected v10("?format"):::projected v6("?image") v20("?inception") v21("?inceptionyear") v7("?inv"):::projected v5("?item"):::projected v1("?itemdate"):::projected v8("?license"):::projected v11("?sourceurl"):::projected v12("?title"):::projected c16(["wd:Q1526131"]):::iri c7(["wd:Q81564326"]):::iri f0[["?inceptionyear < '1890^^xsd:integer'"]] f0 --> v21 f1[["?collectionLabel = 'en'"]] f1 --> v3 f2[["?deathyear < year-from-dateTime(NOW()) + '-95^^xsd:integer'"]] f2 --> v17 v5 --"p:P4765"--> v6 v5 --"schema:dateModified"--> v1 v5 --"p:direct/P31"--> c7 v5 --"p:direct/P217"--> v7 v5 --"p:direct/P6216"--> v8 v6 --"p:statement/P4765"--> v9 v6 --"p:qualifier/P2701"--> v10 v6 --"p:qualifier/P2699"--> v11 v6 --"p:qualifier/P1476"--> v12 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P2093".-> v13 end v6 --"p:qualifier/P137"--> c16 v5 --"p:direct/P195"--> v14 v15 --"p:direct/P570"--> v16 bind3[/"year-from-dateTime(?dod)"/] v16 --o bind3 bind3 --as--o v17 v15 --"schema:dateModified"--> v17 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:direct/P373".-> v18 end v14 --"rdfs:label"--> v3 v14 --"p:direct/P373"--> v19 v5 --"p:direct/P571"--> v20 bind4[/"year-from-dateTime(?inception)"/] v20 --o bind4 bind4 --as--o v21