Template:SPARQLDigraphQuery

From Wikibase Personal data
Revision as of 12:16, 13 May 2019 by 192.168.0.1 (talk)
Jump to navigation Jump to search
  1. defaultView:Graph

SELECT ?{{{node1name}}} ?{{{node1name}}}Label ?rgb ?{{{node2name}}} ?{{{node2name}}}Label WITH {SELECT ?{{{node1name}}} WHERE {

   BIND(?item AS ?{{{node1name}}})
   ?item pdiot:P3 pdio:{{{node1}}}.
 }

} AS %{{{node1name}}} WITH {SELECT ?{{{node2name}}} WHERE {

   BIND(?item AS ?{{{node2name}}})
   ?item pdiot:P3 pdio:{{{node2}}}.
 }

} AS %{{{node2name}}} WHERE {

 {
    INCLUDE %{{{node1name}}}.
 }
 UNION
 {
    INCLUDE %{{{node2name}}}.
    BIND("990000" AS ?rgb)
 }
 UNION
 {
    INCLUDE %{{{node1name}}}.
    INCLUDE %{{{node2name}}}.
    ?{{{node2name}}} pdiot:P111 ?{{{node1name}}}
    BIND("FFFFFF" AS ?rgb)
 }
 UNION
 {
    INCLUDE %{{{node1name}}}.
    INCLUDE %{{{node2name}}}.
    ?{{{node1name}}} pdiot:P111 ?{{{node2name}}}
    BIND("FFFFFF" AS ?rgb)
 }
 SERVICE wikibase:label {
   bd:serviceParam wikibase:language "en" . 
 }

} LIMIT 10000