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
City Center Residents Association (Q113870805)
Pavlo Tychyna Museum (Q12119962)
日本の学校項目で使用されているプロパティ[ 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
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!
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!
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)
#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
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!