Difference between revisions of "Template:SPARQLDigraphQuery"

From Wikibase Personal data
Jump to navigation Jump to search
(Created page with "#defaultView:Graph SELECT ?operator ?operatorLabel ?rgb ?project ?projectLabel WITH {SELECT ?operator WHERE { BIND(?item AS ?operator) BIND(pdio:Q401 AS ?class) ?...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
#defaultView:Graph
 
#defaultView:Graph
SELECT ?operator ?operatorLabel ?rgb ?project ?projectLabel
+
SELECT ?{{{node1name}}} ?{{{node1name}}}Label ?rgb ?{{{node2name}}} ?{{{node2name}}}Label
WITH {SELECT ?operator WHERE {
+
WITH {SELECT ?{{{node1name}}} WHERE {
     BIND(?item AS ?operator)
+
     BIND(?item AS ?{{{node1name}}})
    BIND(pdio:Q401 AS ?class)
+
     ?item pdiot:P3 pdio:{{{node1}}}.
     ?item pdiot:P3 ?class.
+
    {{{restriction}}}
 
   }
 
   }
 
}
 
}
AS %operator
+
AS %{{{node1name}}}
WITH {SELECT ?project WHERE {
+
WITH {SELECT ?{{{node2name}}} WHERE {
     BIND(?item AS ?project)
+
     BIND(?item AS ?{{{node2name}}})
    BIND(pdio:Q646 AS ?class)
+
     ?item pdiot:P3 pdio:{{{node2}}}.
     ?item pdiot:P3 ?class.
+
    {{{restriction}}}
 
   }
 
   }
 
}
 
}
AS %project
+
AS %{{{node2name}}}
 
WHERE {
 
WHERE {
 
   {
 
   {
     INCLUDE %operator.
+
     INCLUDE %{{{node1name}}}.
 
   }
 
   }
 
   UNION
 
   UNION
 
   {
 
   {
     INCLUDE %project.
+
     INCLUDE %{{{node2name}}}.
 
     BIND("990000" AS ?rgb)
 
     BIND("990000" AS ?rgb)
 
   }
 
   }
 
   UNION
 
   UNION
 
   {
 
   {
     INCLUDE %operator.
+
     INCLUDE %{{{node1name}}}.
     INCLUDE %project.
+
     INCLUDE %{{{node2name}}}.
     ?project pdiot:P111 ?operator
+
     ?{{{node2name}}} pdiot:P111 ?{{{node1name}}}
 
     BIND("FFFFFF" AS ?rgb)
 
     BIND("FFFFFF" AS ?rgb)
 
   }
 
   }
 
   UNION
 
   UNION
 
   {
 
   {
     INCLUDE %operator.
+
     INCLUDE %{{{node1name}}}.
     INCLUDE %project.
+
     INCLUDE %{{{node2name}}}.
     ?operator pdiot:P111 ?project
+
     ?{{{node1name}}} pdiot:P111 ?{{{node2name}}}
 
     BIND("FFFFFF" AS ?rgb)
 
     BIND("FFFFFF" AS ?rgb)
 
   }
 
   }

Latest revision as of 12:25, 13 May 2019

  1. defaultView:Graph

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

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

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

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

} 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