query-73e5ccd70cb693078f08c7be79205aa1

rq turtle/ttl

一貫校・併設校の小学と中学の対応状況

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?school ?schoolLabel ?sitelink ?class ?classLabel ?city ?cityLabel ?prefLabel ?chu ?chuLabel ?chuCode ?sho ?shoLabel ?shoCode WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ja". }
  {?school wdt:P31 wd:Q89612581. BIND(wd:Q89612581 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11458774. BIND(wd:Q11458774 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q97379116. BIND(wd:Q97379116 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11484207. BIND(wd:Q11484207 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11484204. BIND(wd:Q11484204 AS ?class) }
  OPTIONAL {
    ?sitelink schema:about ?school; schema:isPartOf <https://ja.wikipedia.org/>.
  }
  OPTIONAL {
    ?school (wdt:P131+) ?city.
    ?city (wdt:P31/(wdt:P279*)) wd:Q1054813.
  }
  OPTIONAL {
    ?school (wdt:P131+) ?pref.
    ?pref wdt:P31 wd:Q50337.
  }
  OPTIONAL {
    ?school wdt:P527 ?chu.
    ?chu wdt:P31 wd:Q55521176.
    OPTIONAL { ?chu wdt:P11127 ?chuCode. }
  }
  OPTIONAL {
    ?school wdt:P527 ?sho.
    ?sho wdt:P31 wd:Q5358913.
    OPTIONAL { ?sho wdt:P11127 ?shoCode. }
  }
}
LIMIT 1000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?chu"):::projected v7("?chuCode"):::projected v4("?city"):::projected v3("?class"):::projected v5("?pref") v1("?school"):::projected v8("?sho"):::projected v9("?shoCode"):::projected v3("?sitelink"):::projected a1((" ")) c7(["wd:Q11458774"]):::iri c10(["wd:Q11484204"]):::iri c16(["wd:Q1054813"]):::iri c21(["wd:Q5358913"]):::iri c9(["wd:Q11484207"]):::iri c19(["wd:Q55521176"]):::iri c8(["wd:Q97379116"]):::iri c6(["wd:Q89612581"]):::iri c2(["bd:serviceParam"]):::iri c4(["ja"]):::literal c13([https://ja.wikipedia.org/]):::iri c17(["wd:Q50337"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end 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; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c10 bind0[/"'wd:Q11484204'"/] bind0 --as--o v3 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c9 bind1[/"'wd:Q11484207'"/] bind1 --as--o v3 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c8 bind2[/"'wd:Q97379116'"/] bind2 --as--o v3 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c7 bind3[/"'wd:Q11458774'"/] bind3 --as--o v3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c6 bind4[/"'wd:Q89612581'"/] bind4 --as--o v3 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:about".-> v1 v3 --"schema:isPartOf"--> c13 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v4 v4 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c16 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v5 v5 --"wdt:P31"--> c17 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P527".-> v6 v6 --"wdt:P31"--> c19 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P11127".-> v7 end end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P527".-> v8 v8 --"wdt:P31"--> c21 subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v8 -."wdt:P11127".-> v9 end end