query-59166aa7b6bd24c9c828f2fb38f4282c

rq turtle/ttl

Parts of the Nurse's Quran and their collections

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Graph
SELECT ?from ?fromLabel ?image1 ?to ?toLabel ?image2 ?edgeLabel 
WHERE {
  {
 SELECT ?from  ?image1 (?start AS ?to) (?startimage AS ?image2) (?prop AS ?edge) WHERE {
   {
  SELECT ?start ?startimage ?image1 ?from ?prop ?coll  WHERE {
  VALUES ?start {wd:Q107998577}. # Nurse's Quran
    ?start wdt:P18 ?startimage.
    ?from ?rel ?start; wdt:P195 ?coll.
    MINUS {?coll wdt:P31 wd:Q61781831} # Exclude curatorial departments
    ?prop wikibase:directClaim ?rel ; a wikibase:Property.
    OPTIONAL {?from wdt:P18 ?image1}.
   }  }
 } ORDER BY ?coll # put objects from the same collection close together
 }
  UNION {
  SELECT ?from  ?image1 (?coll AS ?to) ?image2 (wd:P195 AS ?edge) WHERE {
    {
  SELECT ?start ?startimage ?image1 ?from ?prop ?coll  WHERE {
  VALUES ?start {wd:Q107998577}. # Nurse's Quran
    ?start wdt:P18 ?startimage.
    ?from ?rel ?start; wdt:P195 ?coll.
    MINUS {?coll wdt:P31 wd:Q61781831} # Exclude curatorial departments
    ?prop wikibase:directClaim ?rel ; a wikibase:Property.
    OPTIONAL {?from wdt:P18 ?image1}.
   }  }
   OPTIONAL {?coll wdt:P18 ?image2}.
  }
}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
     ?from rdfs:label ?fromLabel. ?edge rdfs:label ?edgeLabel.  ?to rdfs:label ?toLabel}
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?coll") v11("?edge") v12("?edgeLabel"):::projected v4("?from"):::projected v11("?fromLabel"):::projected v7("?image1"):::projected v9("?image2"):::projected v6("?prop") v5("?rel") v11("?start") v3("?startimage") v11("?to"):::projected v13("?toLabel"):::projected c9(["bd:serviceParam"]):::iri c7(["wikibase:Property"]):::iri c4(["wd:Q61781831"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind0[/VALUES ?start/] bind0-->v11 bind00(["wd:Q107998577"]) bind00 --> bind0 v11 --"wdt:P18"--> v3 v4 -->v5--> v11 v4 --"wdt:P195"--> v1 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P31"--> c4 end v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v9 end bind2[/"?coll"/] v1 --o bind2 bind2 --as--o v11 bind3[/"'wd:P195'"/] bind3 --as--o v11 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind4[/VALUES ?start/] bind4-->v11 bind40(["wd:Q107998577"]) bind40 --> bind4 v11 --"wdt:P18"--> v3 v4 -->v5--> v11 v4 --"wdt:P195"--> v1 subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P31"--> c4 end v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c7 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end bind6[/"?start"/] v11 --o bind6 bind6 --as--o v11 bind7[/"?startimage"/] v3 --o bind7 bind7 --as--o v9 bind8[/"?prop"/] v6 --o bind8 bind8 --as--o v11 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 v4 --"rdfs:label"--> v11 v11 --"rdfs:label"--> v12 v11 --"rdfs:label"--> v13 end