Wikidata:WikiProject IFRC/List/Tree

From Wikidata
Jump to navigation Jump to search

IRCRCM tree

[edit]

Tree of entities under the International Red Cross and Red Crescent Movement (Q7178):

The following query uses these:

  • Properties: part of (P361)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, logo image (P154)  View with Reasonator View with SQID, inception (P571)  View with Reasonator View with SQID, dissolved, abolished or demolished date (P576)  View with Reasonator View with SQID, parent organization (P749)  View with Reasonator View with SQID, member of (P463)  View with Reasonator View with SQID, facet of (P1269)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, flag image (P41)  View with Reasonator View with SQID
    #defaultView:Tree
    SELECT
      ?top ?topLabel
      ?parent ?parentLogo (CONCAT(?parentName,' (',COALESCE(STR(YEAR(?parentStart)),'?'),' - ',COALESCE(STR(YEAR(?parentEnd)),'x'),')') AS ?parentLabel)
      ?society ?societyFlag (CONCAT(?societyName,' (',COALESCE(STR(YEAR(?societyStart)),'?'),' - ',COALESCE(STR(YEAR(?societyEnd)),'x'),')') AS ?societyLabel)
      ?branch ?branchFlag (CONCAT(?branchName,' (',COALESCE(STR(YEAR(?branchStart)),'?'),' - ',COALESCE(STR(YEAR(?branchEnd)),'x'),')') AS ?branchLabel)
    WHERE {
      ########## IRCRCM ##########
      BIND(wd:Q7178 AS ?top).
      
      
      ########## IFRC, ICRC ##########
      ?parent wdt:P361 ?top;
              (wdt:P31/(wdt:P279*)) wd:Q43229.
      OPTIONAL { ?parent wdt:P154 ?parentLogo. }
      OPTIONAL { ?parent wdt:P571 ?parentStart. }
      OPTIONAL { ?parent wdt:P576 ?parentEnd. }
      
      
      ########## National societies ##########
      OPTIONAL {
        ?society (wdt:P749|wdt:P463|wdt:P361|wdt:P1269) ?parent;
                 (wdt:P31/(wdt:P279*)) wd:Q43229.
        OPTIONAL { ?society wdt:P17/wdt:P41 ?societyFlag. }
        OPTIONAL { ?society wdt:P571 ?societyStart. }
        OPTIONAL { ?society wdt:P576 ?societyEnd. }
        
        
        ########## Regional societies and branches ##########
        OPTIONAL {
          ?branch (wdt:P749|wdt:P463|wdt:P361|wdt:P1269) ?society;
                  (wdt:P31/(wdt:P279*)) wd:Q43229.
          OPTIONAL { ?branch wdt:P17/wdt:P41 ?branchFlag. }
          OPTIONAL { ?branch wdt:P571 ?branchStart. }
          OPTIONAL { ?branch wdt:P576 ?branchEnd. }
        }
      }
      
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,sl".
        ?top rdfs:label ?topLabel .
        ?parent rdfs:label ?parentName .
        ?society rdfs:label ?societyName .
        ?branch rdfs:label ?branchName .
      }
    }
    ORDER BY (?parentLabel) (?societyLabel) (?branchLabel)
    

Other national societies

[edit]

Instances of national Red Cross and Red Crescent society (Q1968122) that do not appear in the above tree because not marked as part of International Federation of Red Cross and Red Crescent Societies (Q1069175) or because marked as part of International Federation of Red Cross and Red Crescent Societies (Q1069175) but not instance of national Red Cross and Red Crescent society (Q1968122):

SELECT DISTINCT ?society ?societyLabel
WHERE {
  {
    ?society wdt:P31 wd:Q1968122.
    FILTER(NOT EXISTS { ?society (wdt:P749|wdt:P463|wdt:P361) []. })
  } UNION {
    ?society (wdt:P31/(wdt:P279*)) wd:Q43229;
      (wdt:P749|wdt:P463|wdt:P361) wd:Q1069175.
    FILTER(NOT EXISTS { ?society wdt:P31 wd:Q1968122. })
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,sl". }
}
ORDER BY (?societyLabel)
Try it!