query-a83494fa5792b471e8772a89620994b5

rq turtle/ttl

general table for the 2019 Hong Kong protests

also viewable as graph and map

Note: ?edgeLabel has to be placed after object (?y), not between subject (?x) and object (?y).

Otherwise it will cause errors in graph.

SELECT DISTINCT ?x2 ?x2Label ?x2Description ?image ?y ?yLabel ?edgeLabel WHERE { # define ?x as "immediate" cause of (P828) or effect of (P1542) or "any" part of (P361) or facet of (P1269) 2019 Hong Kong protests (Q64509602) ### Note: Cause (P828) and effect (P1542) are limited to "immediate", not "any", to avoid a too long chain, and ### are limited to the relation with 2019 Hong Kong protests (Q64509602), not its sub-event/topic, to avoid a too general value. ?x (wdt:P828|wdt:P1542 |(wdt:P361 |wdt:P1269)) wd:Q64509602. # expand ?x to ?x1 (+?x's participant and related creative work) # by defining ?x1 as participant of (P1344) or depicts (P180) or main subject is (P921) ?x ?x1 (wdt:P1344 |wdt:P180 |wdt:P921)? ?x. # expand ?x1 to ?x2 (+?x1's organizer and author) # by defining ?x2 as ?x1's organizer (P664)
# or participant (P710) or depicted by (P1299) # or author (P50) or composer (P86) or lyrics by (P676) or creator (P170) ### Note: 1. Organizer (P664) does not have inverse property and its value cannot be included in ?x1. ### 2. Participant (P710) and depicted by (P1299) have inverse properties (participant of (P1344) and depicts (P180)), ### and their values can be included in ?x1 by inverse properties P1344 and P180, ### but item might have no P1344 or P180 intentionally (to, e.g., avoid trivial value or long list) or accidentally. ### 3. Author (P50), composer (P86), lyrics by (P676), and creator (P170) do not have inverse property and ### their values cannot be included in ?x1. And ### even if they do have inverse properties, they should not be added to "?x1 f ?x", because ### that need change (f)? to (f)
and might make a too long chain. ?x1 (wdt:P664 |wdt:P710 |wdt:P1299 |wdt:P50 |wdt:P86 |wdt:P676 |wdt:P170)? ?x2 # optional: define ?y as ?x2's cause (P828) or effect (P1542) or part of (P361) or part (P527) or facet of (P1269), i.e., ?x relation/inverse # or participant of (P1344) or participant (P710) or depicts (P180) or depicted by (P1299) or main subject (P921), i.e., ?x1+ relation/inverse # or organizer (P664) or author (P50) or composer (P86) or lyrics by (P676) or creator (P170), i.e., ?x2+ relation # or coordinate location (P625) or follows (P155) or followed by (P156) OPTIONAL {?x2 (wdt:P828 |wdt:P1542 |wdt:P361 |wdt:P527 |wdt:P1269 |wdt:P1344 |wdt:P710 |wdt:P180 |wdt:P1299 |wdt:P921 |wdt:P664 |wdt:P50 |wdt:P86 |wdt:P676 |wdt:P170 |wdt:P625 |wdt:P155 |wdt:P156) ?y # To avoid showing any other relation # define ?relation as only cause (P828) or effect (P1542) or part of (P361) or part (P527) or facet of (P1269), i.e., ?x relation/inverse # or participant of (P1344) or participant (P710) or depicts (P180) or depicted by (P1299) or main subject (P921), i.e., ?x1+ relation/inverse # or organizer (P664) or author (P50) or composer (P86) or lyrics by (P676) or creator (P170), i.e., ?x2+ relation # or coordinate location (P625) or follows (P155) or followed by (P156) VALUES ?relation {wdt:P828 wdt:P1542 wdt:P361 wdt:P527 wdt:P1269 wdt:P1344 wdt:P710 wdt:P180 wdt:P1299 wdt:P921 wdt:P664 wdt:P50 wdt:P86 wdt:P676 wdt:P170 wdt:P625 wdt:P155 wdt:P156} # ?relation is from ?x2 to ?y ?x2 ?relation ?y. # get ?relation's property label and allow it to appear on graph edge ?edge wikibase:directClaim ?relation; a wikibase:Property} # optional: show ?x2's image (P18), which appears directly in graph, and as link in table OPTIONAL {?x2 wdt:P18 ?image} # show label in simplified Chinese (zh-hans) as default, and English when no default label exists SERVICE wikibase:label { bd:serviceParam wikibase:language "zh-hans,en". } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# general table for the 2019 Hong Kong protests
# also viewable as graph and map
### Note: ?edgeLabel has to be placed after object (?y), not between subject (?x) and object (?y).
### Otherwise it will cause errors in graph.
SELECT DISTINCT ?x2 ?x2Label ?x2Description ?image ?y ?yLabel ?edgeLabel
WHERE {
  # define ?x as "immediate" cause of (P828) or effect of (P1542) or "any" part of (P361) or facet of (P1269) 2019 Hong Kong protests (Q64509602)
  ### Note: Cause (P828) and effect (P1542) are limited to "immediate", not "any", to avoid a too long chain, and
  ### are limited to the relation with 2019 Hong Kong protests (Q64509602), not its sub-event/topic, to avoid a too general value.
  ?x (wdt:P828|wdt:P1542 |(wdt:P361 |wdt:P1269)*) wd:Q64509602.
  # expand ?x to ?x1 (+?x's participant and related creative work)
  # by defining ?x1 as participant of (P1344) or depicts (P180) or main subject is (P921) ?x
  ?x1 (wdt:P1344 |wdt:P180 |wdt:P921)? ?x.
  # expand ?x1 to ?x2 (+?x1's organizer and author)
  # by defining ?x2 as ?x1's organizer (P664)  
  # or participant (P710) or depicted by (P1299)
  # or author (P50) or composer (P86) or lyrics by (P676) or creator (P170)
  ### Note: 1. Organizer (P664) does not have inverse property and its value cannot be included in ?x1.
  ### 2. Participant (P710) and depicted by (P1299) have inverse properties (participant of (P1344) and depicts (P180)),
  ### and their values can be included in ?x1 by inverse properties P1344 and P180,
  ### but item might have no P1344 or P180 intentionally (to, e.g., avoid trivial value or long list) or accidentally.
  ### 3. Author (P50), composer (P86), lyrics by (P676), and creator (P170) do not have inverse property and
  ### their values cannot be included in ?x1. And
  ### even if they do have inverse properties, they should not be added to "?x1 f ?x", because
  ### that need change (f)? to (f)* and might make a too long chain.
  ?x1 (wdt:P664 |wdt:P710 |wdt:P1299 |wdt:P50 |wdt:P86 |wdt:P676 |wdt:P170)? ?x2
  # optional: define ?y as ?x2's cause (P828) or effect (P1542) or part of (P361) or part (P527) or facet of (P1269), i.e., ?x relation/inverse
  # or participant of (P1344) or participant (P710) or depicts (P180) or depicted by (P1299) or main subject (P921), i.e., ?x1+ relation/inverse
  # or organizer (P664) or author (P50) or composer (P86) or lyrics by (P676) or creator (P170), i.e., ?x2+ relation
  # or coordinate location (P625) or follows (P155) or followed by (P156)
  OPTIONAL {?x2 (wdt:P828 |wdt:P1542 |wdt:P361 |wdt:P527 |wdt:P1269 |wdt:P1344 |wdt:P710 |wdt:P180 |wdt:P1299 |wdt:P921 |wdt:P664 |wdt:P50 |wdt:P86 |wdt:P676 |wdt:P170 |wdt:P625 |wdt:P155 |wdt:P156) ?y
            # To avoid showing any other relation
            # define ?relation as only cause (P828) or effect (P1542) or part of (P361) or part (P527) or facet of (P1269), i.e., ?x relation/inverse
            # or participant of (P1344) or participant (P710) or depicts (P180) or depicted by (P1299) or main subject (P921), i.e., ?x1+ relation/inverse
            # or organizer (P664) or author (P50) or composer (P86) or lyrics by (P676) or creator (P170), i.e., ?x2+ relation
            # or coordinate location (P625) or follows (P155) or followed by (P156)
            VALUES ?relation {wdt:P828 wdt:P1542 wdt:P361 wdt:P527 wdt:P1269 wdt:P1344 wdt:P710 wdt:P180 wdt:P1299 wdt:P921 wdt:P664 wdt:P50 wdt:P86 wdt:P676 wdt:P170 wdt:P625 wdt:P155 wdt:P156}
            # ?relation is from ?x2 to ?y
            ?x2 ?relation ?y.
            # get ?relation's property label and allow it to appear on graph edge
            ?edge wikibase:directClaim ?relation;
               a wikibase:Property}
  # optional: show ?x2's image (P18), which appears directly in graph, and as link in table
  OPTIONAL {?x2 wdt:P18 ?image}
  # show label in simplified Chinese (zh-hans) as default, and English when no default label exists
  SERVICE wikibase:label { bd:serviceParam wikibase:language "zh-hans,en". } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?edge") v7("?image"):::projected v5("?relation") v1("?x") v2("?x1") v3("?x2"):::projected v4("?y"):::projected c22(["wikibase:Property"]):::iri c27(["zh-hans,en"]):::literal c2(["wd:Q64509602"]):::iri c25(["bd:serviceParam"]):::iri 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; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P1269"--> c2 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P361"--> c2 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P1542"--> c2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P828"--> c2 end union0r <== or ==> union0l end subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P921"--> v1 end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P180"--> v1 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P1344"--> v1 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; end union3r <== or ==> union3l end subgraph union6[" Union "] subgraph union6l[" "] style union6l fill:#abf,stroke-dasharray: 3 3; subgraph union7[" Union "] subgraph union7l[" "] style union7l fill:#abf,stroke-dasharray: 3 3; subgraph union8[" Union "] subgraph union8l[" "] style union8l fill:#abf,stroke-dasharray: 3 3; subgraph union9[" Union "] subgraph union9l[" "] style union9l fill:#abf,stroke-dasharray: 3 3; subgraph union10[" Union "] subgraph union10l[" "] style union10l fill:#abf,stroke-dasharray: 3 3; subgraph union11[" Union "] subgraph union11l[" "] style union11l fill:#abf,stroke-dasharray: 3 3; subgraph union12[" Union "] subgraph union12l[" "] style union12l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P170"--> v3 end subgraph union12r[" "] style union12r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P676"--> v3 end union12r <== or ==> union12l end end subgraph union11r[" "] style union11r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P86"--> v3 end union11r <== or ==> union11l end end subgraph union10r[" "] style union10r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P50"--> v3 end union10r <== or ==> union10l end end subgraph union9r[" "] style union9r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P1299"--> v3 end union9r <== or ==> union9l end end subgraph union8r[" "] style union8r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P710"--> v3 end union8r <== or ==> union8l end end subgraph union7r[" "] style union7r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P664"--> v3 end union7r <== or ==> union7l end end subgraph union6r[" "] style union6r fill:#abf,stroke-dasharray: 3 3; end union6r <== or ==> union6l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union13[" Union "] subgraph union13l[" "] style union13l fill:#abf,stroke-dasharray: 3 3; subgraph union14[" Union "] subgraph union14l[" "] style union14l fill:#abf,stroke-dasharray: 3 3; subgraph union15[" Union "] subgraph union15l[" "] style union15l fill:#abf,stroke-dasharray: 3 3; subgraph union16[" Union "] subgraph union16l[" "] style union16l fill:#abf,stroke-dasharray: 3 3; subgraph union17[" Union "] subgraph union17l[" "] style union17l fill:#abf,stroke-dasharray: 3 3; subgraph union18[" Union "] subgraph union18l[" "] style union18l fill:#abf,stroke-dasharray: 3 3; subgraph union19[" Union "] subgraph union19l[" "] style union19l fill:#abf,stroke-dasharray: 3 3; subgraph union20[" Union "] subgraph union20l[" "] style union20l fill:#abf,stroke-dasharray: 3 3; subgraph union21[" Union "] subgraph union21l[" "] style union21l fill:#abf,stroke-dasharray: 3 3; subgraph union22[" Union "] subgraph union22l[" "] style union22l fill:#abf,stroke-dasharray: 3 3; subgraph union23[" Union "] subgraph union23l[" "] style union23l fill:#abf,stroke-dasharray: 3 3; subgraph union24[" Union "] subgraph union24l[" "] style union24l fill:#abf,stroke-dasharray: 3 3; subgraph union25[" Union "] subgraph union25l[" "] style union25l fill:#abf,stroke-dasharray: 3 3; subgraph union26[" Union "] subgraph union26l[" "] style union26l fill:#abf,stroke-dasharray: 3 3; subgraph union27[" Union "] subgraph union27l[" "] style union27l fill:#abf,stroke-dasharray: 3 3; subgraph union28[" Union "] subgraph union28l[" "] style union28l fill:#abf,stroke-dasharray: 3 3; subgraph union29[" Union "] subgraph union29l[" "] style union29l fill:#abf,stroke-dasharray: 3 3; v3 -."wdt:P156".-> v4 end subgraph union29r[" "] style union29r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P155"--> v4 end union29r <== or ==> union29l end end subgraph union28r[" "] style union28r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P625"--> v4 end union28r <== or ==> union28l end end subgraph union27r[" "] style union27r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P170"--> v4 end union27r <== or ==> union27l end end subgraph union26r[" "] style union26r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P676"--> v4 end union26r <== or ==> union26l end end subgraph union25r[" "] style union25r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P86"--> v4 end union25r <== or ==> union25l end end subgraph union24r[" "] style union24r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P50"--> v4 end union24r <== or ==> union24l end end subgraph union23r[" "] style union23r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P664"--> v4 end union23r <== or ==> union23l end end subgraph union22r[" "] style union22r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P921"--> v4 end union22r <== or ==> union22l end end subgraph union21r[" "] style union21r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1299"--> v4 end union21r <== or ==> union21l end end subgraph union20r[" "] style union20r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P180"--> v4 end union20r <== or ==> union20l end end subgraph union19r[" "] style union19r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P710"--> v4 end union19r <== or ==> union19l end end subgraph union18r[" "] style union18r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1344"--> v4 end union18r <== or ==> union18l end end subgraph union17r[" "] style union17r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1269"--> v4 end union17r <== or ==> union17l end end subgraph union16r[" "] style union16r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P527"--> v4 end union16r <== or ==> union16l end end subgraph union15r[" "] style union15r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P361"--> v4 end union15r <== or ==> union15l end end subgraph union14r[" "] style union14r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1542"--> v4 end union14r <== or ==> union14l end end subgraph union13r[" "] style union13r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P828"--> v4 end union13r <== or ==> union13l end bind0[/VALUES ?relation/] bind0-->v5 bind00(["wdt:P828"]) bind00 --> bind0 bind01(["wdt:P1542"]) bind01 --> bind0 bind02(["wdt:P361"]) bind02 --> bind0 bind03(["wdt:P527"]) bind03 --> bind0 bind04(["wdt:P1269"]) bind04 --> bind0 bind05(["wdt:P1344"]) bind05 --> bind0 bind06(["wdt:P710"]) bind06 --> bind0 bind07(["wdt:P180"]) bind07 --> bind0 bind08(["wdt:P1299"]) bind08 --> bind0 bind09(["wdt:P921"]) bind09 --> bind0 bind010(["wdt:P664"]) bind010 --> bind0 bind011(["wdt:P50"]) bind011 --> bind0 bind012(["wdt:P86"]) bind012 --> bind0 bind013(["wdt:P676"]) bind013 --> bind0 bind014(["wdt:P170"]) bind014 --> bind0 bind015(["wdt:P625"]) bind015 --> bind0 bind016(["wdt:P155"]) bind016 --> bind0 bind017(["wdt:P156"]) bind017 --> bind0 v3 -->v5--> v4 v6 --"wikibase:directClaim"--> v5 v6 --"a"--> c22 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P18".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c25 --"wikibase:language"--> c27 end