query-526eafc5884b7a3df41c8e12f065696a

rq turtle/ttl

Objects in Khalili Collections related to Abbas II (graphical version)

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
#title:Khalili Collections objects related to Abbas II
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:Q157159}. # Choose person to start with
    ?start wdt:P18 ?startimage.
    ?from ?rel ?start; wdt:P195 ?coll. ?coll wdt:P361 wd:Q63160499.
    ?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:Q157159}. # Choose person to start with
    ?start wdt:P18 ?startimage.
    ?from ?rel ?start; wdt:P195 ?coll. ?coll wdt:P361 wd:Q63160499.
    ?prop wikibase:directClaim ?rel ; a wikibase:Property.
    OPTIONAL {?from wdt:P18 ?image1}.
   }  }
   OPTIONAL {?coll wdt:P18 ?image2}.
  }
} UNION {
    SELECT ?from ?image1 (?type AS ?to) ("" AS ?image2) (wd:P31 AS ?edge) WHERE {
    {
  SELECT ?start ?startimage ?image1 ?from ?prop ?coll  WHERE {
  VALUES ?start {wd:Q157159}. # Choose person to start with
    ?start wdt:P18 ?startimage.
    ?from ?rel ?start; wdt:P195 ?coll. ?coll wdt:P361 wd:Q63160499.
    ?prop wikibase:directClaim ?rel ; a wikibase:Property.
    OPTIONAL {?from wdt:P18 ?image1}.
   }  }
      ?from wdt:P31 ?type.
  }
}
      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") v12("?edge") v13("?edgeLabel"):::projected v4("?from"):::projected v12("?fromLabel"):::projected v7("?image1"):::projected v12("?image2"):::projected v6("?prop") v5("?rel") v11("?start") v3("?startimage") v12("?to"):::projected v14("?toLabel"):::projected v11("?type") c7(["wikibase:Property"]):::iri c10(["bd:serviceParam"]):::iri c4(["wd:Q63160499"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; bind0[/VALUES ?start/] bind0-->v11 bind00(["wd:Q157159"]) bind00 --> bind0 v11 --"wdt:P18"--> v3 v4 -->v5--> v11 v4 --"wdt:P195"--> v1 v1 --"wdt:P361"--> c4 v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end v4 --"wdt:P31"--> v11 bind1[/"?type"/] v11 --o bind1 bind1 --as--o v12 bind2[/"''"/] bind2 --as--o v12 bind3[/"'wd:P31'"/] bind3 --as--o v12 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; bind4[/VALUES ?start/] bind4-->v11 bind40(["wd:Q157159"]) bind40 --> bind4 v11 --"wdt:P18"--> v3 v4 -->v5--> v11 v4 --"wdt:P195"--> v1 v1 --"wdt:P361"--> c4 v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c7 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v12 end bind5[/"?coll"/] v1 --o bind5 bind5 --as--o v12 bind6[/"'wd:P195'"/] bind6 --as--o v12 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind7[/VALUES ?start/] bind7-->v11 bind70(["wd:Q157159"]) bind70 --> bind7 v11 --"wdt:P18"--> v3 v4 -->v5--> v11 v4 --"wdt:P195"--> v1 v1 --"wdt:P361"--> c4 v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c7 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end bind8[/"?start"/] v11 --o bind8 bind8 --as--o v12 bind9[/"?startimage"/] v3 --o bind9 bind9 --as--o v12 bind10[/"?prop"/] v6 --o bind10 bind10 --as--o v12 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 v4 --"rdfs:label"--> v12 v12 --"rdfs:label"--> v13 v12 --"rdfs:label"--> v14 end