Skip to content

Instantly share code, notes, and snippets.

@uedayou
Last active October 5, 2015 01:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uedayou/f9c72dcf208a59971b2e to your computer and use it in GitHub Desktop.
Save uedayou/f9c72dcf208a59971b2e to your computer and use it in GitHub Desktop.
WordBench京都10月号 WordPress × オープンデータ × データビジュアライゼーションハンズオン会 用メモ

ハンズオン WordPressとLODビジュアライズプラグイン“WP Sgv”

参考サイト

WP Sgv

SPARQL Creator

WP Sgv x SPARQL Creator

WP Sgv に入力する前に、SPARQLクエリを書き換えます。

select ?birthPlace  (count(?s) as ?num) where{
?s a <http://dbpedia.org/ontology/Comedian>.?s 
<http://dbpedia.org/ontology/birthPlace> ?birthPlace.}
group by ?birthPlace ORDER BY DESC(?num) limit 10
  1. “?birthPlace” と “where”の間に ★(count(?s) as ?num)★ を挿入
  2. “limit 100” を ★group by ?birthPlace ORDER BY DESC(?num) limit 10★に置き換え

参考SPARQLクエリ

http://ja.dbpedia.org/resources/大阪府 を 大阪府にする例(1)

select ?birthPlace  (count(?s) as ?num) where{
?s a <http://dbpedia.org/ontology/Comedian>.
?s <http://dbpedia.org/ontology/birthPlace> ?Place.
?Place rdfs:label ?birthPlace.}
group by ?birthPlace ORDER BY DESC(?num) limit 10

http://ja.dbpedia.org/resources/大阪府 を 大阪府にする例(2)

select ?birthPlace (count(?s) as ?num) where{
?s a <http://dbpedia.org/ontology/Comedian>.
?s <http://dbpedia.org/ontology/birthPlace> ?Place.
bind( substr(str(?Place), 32) as ?birthPlace) }
group by ?birthPlace ORDER BY DESC(?num) limit 10

円グラフで都道府県のみに限定した例

select ?birthPlace  (count(?s) as ?num) where{
?s a <http://dbpedia.org/ontology/Comedian>.
?s <http://dbpedia.org/ontology/birthPlace> ?Place.
?Place rdf:type <http://schema.org/Place>.
?Place rdfs:label ?birthPlace.}
group by ?birthPlace ORDER BY DESC(?num) 

検索すると面白いデータベース

DBpedia

京都が出てくる本のデータ

京都国際マンガミュージアムLOD

青空文庫LOD


※ 注意1

マンガミュージアム・青空文庫LODは“WP Sgv”でOutputを "json" から “jsonp” に変更してください。

※ 注意2

WP Sgv の 「チャートのオプション」を使うときは

'is3D':'true', 'title':'お笑い芸人の出身地'

のように書いてください。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment