User:Mzaki

From Wikidata
Jump to navigation Jump to search
ja-N この利用者は日本語母語としています。
en-2 This user has intermediate knowledge of English.
Wikimedia FoundationThis user has created a global account. Mzaki's main account is on Wikipedia.
QuickStatements logoThis user uses QuickStatements.
This user loves OpenRefine.

住所関係[edit]

欧米のやり方[edit]

located on street (P669)house number (P670)で修飾する(ほかにfloor number (P5423)room number (P7532)が使えそう)か、streetの項目がなければ単純にstreet address (P6375)を使う。

Notman House (Q11845348)
51 Sherbrooke Street West, Montreal, Quebec
located in the administrative territorial entity (P131)
Normal rank Le Plateau-Mont-Royal (Q1810072)
0 references
add reference


add value
City Center Residents Association (Q113870805)
street address (P6375)
Normal rank 611 South Charles Street #645, Baltimore, MD 21230 (英語)
located on street (P669) Charles Street (Q2449172)
house number (P670) 611
room number (P7532) 645
postal code (P281) 21230
post town (P4595) Baltimore, MD
0 references
add reference


add value
Pavlo Tychyna Museum (Q12119962)
street address (P6375)
Normal rank вул. Терещенківська, 5; кв. 1-3 (ウクライナ語)
0 references
add reference


add value

学校関係[edit]

覚え書き[edit]

PetScan[edit]

SPARQLクエリ[edit]

日本の学校項目で使用されているプロパティ[edit]

#title:Properties for Japanese school items
SELECT ?prop (Sample(?propLabel) AS ?label) (COUNT(?prop) AS ?count)
WHERE
{
  {
    SELECT DISTINCT ?item ?prop WHERE {
      hint:Query hint:optimizer "None" .
      ?item wdt:P11127 ?code; ?p ?propvalue.
      ?prop wikibase:directClaim ?p .
    }
  } .
  OPTIONAL { ?prop rdfs:label ?propLabel filter (lang(?propLabel) = "ja") }
}
GROUP BY ?prop
ORDER BY DESC(?count)
Properties for Japanese school items

一貫校の中学と高校の対応状況[edit]

SELECT DISTINCT ?school ?schoolLabel ?sitelink ?class ?classLabel ?city ?cityLabel ?prefLabel ?chu ?chuLabel ?chuCode ?ko ?koLabel ?koCode ?code WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ja". }
  {?school wdt:P31 wd:Q21655594. BIND(wd:Q21655594 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q97379116. BIND(wd:Q97379116 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11484207. BIND(wd:Q11484207 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 ?ko.
    ?ko wdt:P31 wd:Q56351315.
    OPTIONAL { ?ko wdt:P11127 ?koCode. }
    OPTIONAL { ?ko wdt:P1386 ?code. }
  }
}
LIMIT 1000
Try it!

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

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
Try it!

一貫校の幼稚園と小学校の対応状況[edit]

SELECT DISTINCT ?school ?schoolLabel ?sitelink ?class ?classLabel ?city ?cityLabel ?prefLabel ?yo ?yoLabel ?yoCode ?sho ?shoLabel ?shoCode WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ja". }
  {?school wdt:P31 wd:Q11484202. BIND(wd:Q11484202 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11484204. BIND(wd:Q11484204 AS ?class) }
  UNION
  {?school wdt:P31 wd:Q11484207. BIND(wd:Q11484207 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 ?yo.
    ?yo wdt:P31 wd:Q106688647.
    OPTIONAL { ?yo wdt:P11127 ?yoCode. }
  }
  OPTIONAL {
    ?school wdt:P527 ?sho.
    ?sho wdt:P31 wd:Q5358913.
    OPTIONAL { ?sho wdt:P11127 ?shoCode. }
  }
}
ORDER BY ?school
LIMIT 1000
Try it!

wikidataにマッピングされているコード数(学校種別)[edit]

#title:mapping counts of MEXT school code (P11127) by school type
SELECT ?group (COUNT(?mext) AS ?count) WHERE {
  ?school p:P11127 ?st.
  ?st wikibase:rank ?rank;
    ps:P11127 ?mext.
  FILTER(?rank != wikibase:DeprecatedRank)
  BIND(SUBSTR(?mext, 1 , 2 ) AS ?group)
}
GROUP BY ?group
ORDER BY (?group)
mapping counts of MEXT school code (P11127) by school type

マッピングミス(非推奨ランク)のコードとその正解[edit]

#title:deprecated mappings of MEXT school code (P11127)
SELECT ?mismatch ?mismatchLabel ?mext ?item ?itemLabel ?rank WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ja". }
  ?mismatch p:P11127 ?st1.
  ?st1 wikibase:rank wikibase:DeprecatedRank;
    ps:P11127 ?mext.
  OPTIONAL {
    ?item p:P11127 ?st2.
    ?st2 wikibase:rank ?rank;
      ps:P11127 ?mext.
    FILTER(?rank != wikibase:DeprecatedRank)
  }
}
ORDER BY (?mext)
deprecated mappings of MEXT school code (P11127)

学校法人にリンクしているプロパティ[edit]

#title:Relations connecting to Incorporated Educational Institution as tail entity
SELECT ?prop (Sample(?propLabel) AS ?label) (COUNT(?prop) AS ?count)
WHERE
{
  {
    SELECT DISTINCT ?item ?prop WHERE {
      hint:Query hint:optimizer "None" .
      ?item ?p wd:Q11448283.
      ?prop wikibase:directClaim ?p .
    }
  } .
  OPTIONAL { ?prop rdfs:label ?propLabel filter (lang(?propLabel) = "ja") }
}
GROUP BY ?prop
ORDER BY DESC(?count)
Relations connecting to Incorporated Educational Institution as tail entity

曖昧さ回避関係[edit]

SELECT (SAMPLE(?pagetitle) AS ?title) ?item  

WITH {
  SELECT ?pagetitle ?item WHERE {  
    wd:Q4167410 wdt:P910 ?category .
    ?link schema:about ?category; schema:isPartOf <https://ja.wikipedia.org/>; schema:name ?title .
    SERVICE wikibase:mwapi {
	   bd:serviceParam wikibase:api "Generator" .
       bd:serviceParam wikibase:endpoint "ja.wikipedia.org" .
       bd:serviceParam mwapi:gcmtitle ?title .
       bd:serviceParam mwapi:generator "categorymembers" .
       bd:serviceParam mwapi:gcmnamespace "0" .
#       bd:serviceParam mwapi:gcmstartsortkeyprefix "T" .
       bd:serviceParam mwapi:gcmlimit "max" .
      # out
      ?pagetitle wikibase:apiOutput mwapi:title  .
      ?item wikibase:apiOutputItem mwapi:item .
    } 
    MINUS { ?item wdt:P31/wdt:P279* wd:Q4167410; }
  }
} AS %results

WHERE {
  INCLUDE %results .
  ?redirect owl:sameAs ?item .
}
GROUP BY ?item
Try it!