Difference between revisions of "Template:SPARQLPredicateGraph"
Jump to navigation
Jump to search
(Created page with "#defaultView:Graph SELECT ?item1 ?item1Label ?rgb ?item2 ?item2Label ?link WITH { SELECT ?predicateFilterValue ?predicateFilterValueRGB WHERE { VALUES (?predicateFilterV...") |
|||
Line 27: | Line 27: | ||
WITH {SELECT ?subject ?object ?edgeRGB WHERE { | WITH {SELECT ?subject ?object ?edgeRGB WHERE { | ||
INCLUDE %predicates. | INCLUDE %predicates. | ||
− | ?subject {{{ | + | ?subject {{{predicate}}} ?subjectValue. |
− | ?object {{{ | + | ?object {{{predicate}}} ?objectValue. |
?subject ?predicate ?object. | ?subject ?predicate ?object. | ||
# This is filtering for each edge twice, potentially a huge waste: |E|*|V| instead of |V| | # This is filtering for each edge twice, potentially a huge waste: |E|*|V| instead of |V| |
Revision as of 08:52, 21 May 2019
- defaultView:Graph
SELECT ?item1 ?item1Label ?rgb ?item2 ?item2Label ?link WITH {
SELECT ?predicateFilterValue ?predicateFilterValueRGB WHERE { VALUES (?predicateFilterValue ?predicateFilterValueRGB) { {{{filter_values_colors}}} } }
} AS %predicateFilterValues WITH {
SELECT ?predicate ?subjectValue ?objectValue ?predicateRGB WHERE { VALUES (?predicate ?subjectValue ?objectValue ?predicateRGB) { {{{predicates_subjects_objects_colors}}} } }
} AS %predicates WITH {SELECT ?node ?nodeRGB WHERE {
?node {{{node_condition}}}. ?node {{{filter_predicate}}} ?predicateFilterValue. INCLUDE %predicateFilterValues. BIND(?predicateFilterValueRGB AS ?nodeRGB) }
} AS %nodes WITH {SELECT ?subject ?object ?edgeRGB WHERE {
INCLUDE %predicates. ?subject {{{predicate}}} ?subjectValue. ?object {{{predicate}}} ?objectValue. ?subject ?predicate ?object. # This is filtering for each edge twice, potentially a huge waste: |E|*|V| instead of |V| ?subject {{{node_condition}}}. ?object {{{node_condition}}}. BIND(?predicateRGB as ?edgeRGB) }
} AS %edges WHERE {
{ # The caption's nodes: INCLUDE %predicateFilterValues. BIND(?predicateFilterValue AS ?item1). BIND(?predicateValueRGB AS ?rgb). } UNION { # The caption's edges: INCLUDE %predicates. BIND(?subjectClass AS ?item1). BIND(?objectClass AS ?item2). BIND(?predicateRGB AS ?rgb). } UNION { INCLUDE %nodes. BIND(?node AS ?item1). BIND(?nodeRGB AS ?rgb). } UNION { INCLUDE %edges. BIND(?subject AS ?item1). BIND(?object AS ?item2). BIND(?edgeRGB AS ?rgb). } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
} LIMIT 10000