Use open data with sparql

69
Use Open Data with SPARQL jig.jp co,. ltd. denari01 Use Open Data with SPARQL jig.jp co,. ltd. denari01

Transcript of Use open data with sparql

Page 1: Use open data with sparql

Use Open Datawith

SPARQLjig.jp co,. ltd.

denari01

Use Open Datawith

SPARQLjig.jp co,. ltd.

denari01

Page 2: Use open data with sparql

先に本発表の結論

Page 3: Use open data with sparql

SPARQLで オープンデータアプリ開発が

捗るゥ!!

Page 4: Use open data with sparql

オープンデータ

1

Page 5: Use open data with sparql

オープンデータ

5

ざっくり言えば

地方自治体がCC BY(とか)で 公開しているデータ

1

Page 6: Use open data with sparql

オープンデータ

6

CC is Creative Commons

CC BY = 出典元さえ明記すれば 自由に使ってOK~♪

1

Page 7: Use open data with sparql

オープンデータ

7

CC BYでめっちゃお金のニオイのするデータが!! ↓

出典元だけどっかに書いといて ビジネスチャンス掴む!!

1

Page 8: Use open data with sparql

オープンデータ

8

市のWebサイトに 適当に作ったPDF 置いときました

CC BYです~

1

Page 9: Use open data with sparql

オープンデータ

9

え、PDFっすか。 使うの面倒臭そう。イラネ。

1

Page 10: Use open data with sparql

オープンデータ

10

え、PDFっすか。 使うの面倒臭そう。イラネ。

CC BY = 出典元さえ明記すれば 自由に使ってOK~♪

1

Page 11: Use open data with sparql

オープンデータ

11

え、PDFっすか。 使うの面倒臭そう。イラネ。

CC BY = 出典元さえ明記すれば 自由に使ってOK~♪

矛盾的なSomething

1

Page 12: Use open data with sparql

使いやすいデータ

2

Page 13: Use open data with sparql

使いやすいデータ

13

2

Page 14: Use open data with sparql

使いやすいデータ

14

2

Page 15: Use open data with sparql

使いやすいデータ

15

え、PDFっすか。 使うの面倒臭そう。 でも公開してくれて ありがとうね

2

Page 16: Use open data with sparql

使いやすいデータ

16

Excelかぁ… フォーマットよく わからんけど 構造化されててまだマシ

2

Page 17: Use open data with sparql

使いやすいデータ

17

ちゃんとオープンなフォーマット!! わかりやすい!!使いやすいゾ!!

2

Page 18: Use open data with sparql

使いやすいデータ

18

大概このへんぐらいまでやってりゃ アプリ作る気にはなる(んじゃない?)

2

Page 19: Use open data with sparql

使いやすいデータ

19

??

2

Page 20: Use open data with sparql

使いやすいデータ

20

It’s LinkedOpen Data

2

Page 21: Use open data with sparql

使いやすいデータ

21

ふわっとしたこと言います⚠

ちゃんと説明しきれる自信がない…

2

Page 22: Use open data with sparql

使いやすいデータ

22

避難所データの例

避難所の名前 緯度経度

2

Page 23: Use open data with sparql

使いやすいデータ

23

2

データ (A小学校)

データ (B中学校)

Page 24: Use open data with sparql

使いやすいデータ

24

似てるから identifierが欲しい

2

データ (A小学校)

データ (B中学校)

Page 25: Use open data with sparql

使いやすいデータ

25

データ (A小学校)

データ (B中学校)

URIを振っちゃおう →一意に判別可能に

http://hogeho.ge/hinan/a~~~ http://hogeho.ge/hinan/b~~~

2

Page 26: Use open data with sparql

使いやすいデータ

26

データ (A小学校)

http://hogeho.ge/hinan/a~~~避難所の名前 緯度経度

いろんなプロパティを 持っている

2

Page 27: Use open data with sparql

使いやすいデータ

27

データ (A小学校)

http://hogeho.ge/hinan/a~~~

このデータの種類は?? 避難所データ

施設の名前は??“A小学校”

緯度経度は??

緯度経度 データ

35.1234567緯度は??

135.1234567経度は??

2

Page 28: Use open data with sparql

使いやすいデータ

28

データ (A小学校)

http://hogeho.ge/hinan/a~~~

避難所データデータ

(B中学校)

http://hogeho.ge/hinan/b~~~

Linked

2

Page 29: Use open data with sparql

使いやすいデータ

29

<rdf:Description rdf:about="http://odp.jig.jp/jp/shizuoka/shimada/236#%~~"> <geo:lat rdf:datatype="http://www.w3.org/2001/XMLSchema#float">34.846963</geo:lat> <geo:long rdf:datatype="http://www.w3.org/2001/XMLSchema#float">138.122395</geo:long> <rdfs:label xml:lang="ja">五和小学校</rdfs:label>

<rdf:type rdf:resource="http://purl.org/jrrk#EmergencyFacility"/> </rdf:Description>

RDFで実現可能

2

Page 30: Use open data with sparql

SPARQLとは?

3

Page 31: Use open data with sparql

31

RDFデータを検索するために 設計されたクエリ言語

SPARQLとは?3

Page 32: Use open data with sparql

SPARQLとは?

32

データ (A小学校)

http://hogeho.ge/hinan/a~~~

rdf:type (このデータの種類)

jrrk:emergency Facility

rdfs:label (名前)

“A小学校”

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>PREFIX jrrk:<http://purl.org/jrrk#>

3

Page 33: Use open data with sparql

SPARQLとは?

33

データ (A小学校)

http://hogeho.ge/hinan/a~~~

http://www.w3.org/1999/02/22-rdf-syntax-ns#type (このデータの種類)

http://purl.org/jrrk#emergency

Facility

http://www.w3.org/2000/01/rdf-schema#label (名前)

“A小学校”

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX jrrk:<http://purl.org/jrrk#>

3

Page 34: Use open data with sparql

34

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX jrrk:<http://purl.org/jrrk#>

SELECT ?name { ?s rdf:type jrrk:EmergencyFacility; rdfs:label ?name. }

SPARQLとは?3

Page 35: Use open data with sparql

SPARQLとは?

35

データ (A小学校)

http://hogeho.ge/hinan/a~~~

rdf:type (このデータの種類)

jrrk:emergency Facility

rdfs:label (名前)

“A小学校”

SELECT ?name { ?s rdf:type jrrk:EmergencyFacility; rdfs:label ?name. }

3

Page 36: Use open data with sparql

SPARQLとは?

36

SPARQLのクエリを投げたら jsonを返してくれないかなあ

3

Page 37: Use open data with sparql

SPARQLとは?

37

SPARQLのクエリを投げたら jsonを返してくれないかなあ

Apache Jena Fuseki

3

One of “SPARQL Endpoint”

Page 38: Use open data with sparql

SPARQLとは?

38

http://hogeho.ge/?query=~~~~~~URLパラメータにクエリを入れる

データがかえってくるjson / jsonp / xml / csv and more…

3

Page 39: Use open data with sparql

SPARQLとは?

39

It’s 弊社製品!!

3

Page 40: Use open data with sparql

SPARQLとは?

40

3

Page 41: Use open data with sparql

SPARQLとは?

41

Apache Jena Fuseki (を、ちょっといじった奴)

3

Page 42: Use open data with sparql

SPARQLとは?

42

http://sparql.odp.jig.jp/api/v1?query=~~~~~~URLパラメータにクエリを入れる

データがかえってくるjson / jsonp / xml / csv and more…

3

Page 43: Use open data with sparql

Let’s Play!!

4

Page 44: Use open data with sparql

Let’s Play!!

44

http://sparql.odp.jig.jp/api/v1?query=~~~~~~GO!!

4

Page 45: Use open data with sparql

無理。

Page 46: Use open data with sparql

46

SPARQLとは?

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX jrrk:<http://purl.org/jrrk#>

SELECT ?name { ?s rdf:type jrrk:EmergencyFacility; rdfs:label ?name. }

4

Page 47: Use open data with sparql

Let’s Play!!

47

そもそもRDFがよくわからん そもそもSPARQLがよくわからん どんな語彙(URI)を用いれば必要なデータが見れるか

4

Page 48: Use open data with sparql

Let’s Play!!

48

http://developer.odp.jig.jp/

4

Page 49: Use open data with sparql

Let’s Play!!

49

微妙。http://developer.odp.jig.jp/

4

Page 50: Use open data with sparql

Let’s Play!!

50

Qiiなんとかっていうサービスに 割と神がいる!!

4

Page 51: Use open data with sparql

Let’s Play!!

51

神々が書いたクエリを見て、 わかった気になる

実際に書いてみる

4

Page 52: Use open data with sparql

Let’s Play!!

52

ドキュメント、ググればすぐ出る!!

4

Page 53: Use open data with sparql

Let’s Play!!

53

ドキュメント、ググればすぐ出る!!

長いから 「分かった気になってから」

「かいつまんで」

4

Page 54: Use open data with sparql

Let’s Play!!

54

あとは実際にクエリを書いて レスを見る作業を何度かやるのが早い

4

Page 55: Use open data with sparql

Let’s Play!!

55

弊社、ちゃんと環境用意してます(にっこり)

4

Page 56: Use open data with sparql

Let’s Play!!

56

やってみよう!!http://sparql.odp.jig.jp/

4

Page 57: Use open data with sparql

Let’s Play!!

57

4

Page 58: Use open data with sparql

Let’s Play!!

58

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX jrrk:<http://purl.org/jrrk#>

SELECT ?name { ?s rdf:type jrrk:EmergencyFacility; rdfs:label ?name. }

このあたりがわかるようなモノ

4

Page 59: Use open data with sparql

Let’s Play!!

59

ブログからアクセス可能です

4

Page 60: Use open data with sparql

宣伝

4.5

Page 61: Use open data with sparql

宣伝

61

4.5

It’s 弊社製品!!

Page 62: Use open data with sparql

宣伝

62

4.5

観光地データ ゴミ収集関係データ 避難所 人口(変化データも) 駐車場 オープンBeacon

公共トイレ ご当地ソング 投票場所 医療機関 公共Wi-Fi 西山動物園の動物

Page 63: Use open data with sparql

宣伝

63

4.5

対応地域、割と広い?

Page 64: Use open data with sparql

宣伝

64

4.5

統計局と組んだ!!人口データなどは日本全国分アリ

Page 65: Use open data with sparql

宣伝

65

4.5

Page 66: Use open data with sparql

宣伝

66

4.5

ぜひ 「いいお話」 しましょう

Page 67: Use open data with sparql

まとめ

5

Page 68: Use open data with sparql

まとめ

68

5

SPARQLで オープンデータアプリ開発が

捗るゥ!!

Page 69: Use open data with sparql

おわり@denari01