65
スキーマとURI LODI 加藤文彦 Linked Open Data連続講義第4回 2014-06-23

スキーマとURI

Embed Size (px)

DESCRIPTION

2014-06-23 にLOD連続講義第4回にて話した内容

Citation preview

Page 1: スキーマとURI

スキーマとURILODI 加藤文彦

Linked Open Data連続講義第4回 2014-06-23

Page 2: スキーマとURI

これまで

• 第2回: データモデルや語彙

• 第3回: RDFというグラフデータモデル

• 今回: URI, IRI, HTTP, スキーマ, RDF語彙

2

Page 3: スキーマとURI

URI

3

Page 4: スキーマとURI

リソース• Webではあらゆるものがリソースとして抽象化

• Webページ,画像,動画,...

• 人物,組織,単語,概念,関係,...

4

子供

執筆

発行日

誕生日出版社

所在地

Page 5: スキーマとURI

URI: Uniform Resource Identifier• リソースの識別子

• 世界中で特定可能な仕組み

• http://fumi.me

• http://fumi.me/foaf#me

• mailto:[email protected]

• tel:+81-3-4212-2658

• urn:isbn:9784764904279

5

Page 6: スキーマとURI

http URI• LODではリソースURIにhttp(s)://ではじまるURIを推奨

• 原則1-2: 参照解決可能にするため

• Webページと同じ

http://headlines.yahoo.co.jp/hl?a=20140607-00000032-asahi-soci#ynDetailscheme authority path query fragment

Page 7: スキーマとURI

IRI: Internationalized Resource Identifier

• URIは仕様上ASCII前提

• IRI = 国際化されたURI

• http://横浜.みんな/関内

• authority: 国際化ドメイン名 (IDN)

• path: UTF-8文字列

• 最新の関連仕様は全てIRIに統一

• タイトルがURIなのでURIで通すが言及ない限り全部IRIと解釈

Page 8: スキーマとURI

http://www.w3.org/TR/webarch/8

Page 9: スキーマとURI

http://dbpedia.org/resource/Matsuyama,_Ehime

表現

識別

9

Page 10: スキーマとURI

http://dbpedia.org/resource/Matsuyama,_Ehime

表現

識別

表現

10

Page 11: スキーマとURI

Content-negotiation

•あるリソースに対する表現をHTTPリクエストで折衝する仕組み

• HTML5とXHTML5 • JPEGとSVGの画像

Page 12: スキーマとURI

1. request /resource/Japan

2. return an HTML document for /resource/Japan

http://dbpedia.orgWeb Browser

% curl -ILH 'Accept: text/html' http://dbpedia.org/resource/JapanHTTP/1.1 303 See OtherDate: Thu, 04 Jul 2013 09:30:17 GMTContent-Type: text/html; charset=UTF-8Content-Length: 0Connection: keep-aliveServer: Virtuoso/07.00.3203 (Linux) i686-generic-linux-glibc212-64 VDBAccept-Ranges: bytesLocation: http://dbpedia.org/page/Japan!HTTP/1.1 200 OKDate: Thu, 04 Jul 2013 09:31:07 GMTContent-Type: text/html; charset=UTF-8Content-Length: 2023382Connection: keep-aliveVary: Accept-Encoding.....!

Page 13: スキーマとURI

1. request /resource/Japan

2. return a turtle document for /resource/Japan

http://dbpedia.orgLOD Agent

@prefix yago-res: <http://mpii.de/yago/resource/> .@prefix dbpedia: <http://dbpedia.org/resource/> .yago-res:Japan owl:sameAs dbpedia:Japan .<http://data.nytimes.com/59436095099277148161> owl:sameAs dbpedia:Japan .<http://data.nytimes.com/66220885916538669281> owl:sameAs dbpedia:Japan .@prefix dbpedia-owl: <http://dbpedia.org/ontology/> .dbpedia:Ayumi_Hamasaki dbpedia-owl:hometown dbpedia:Japan ; dbpedia-owl:birthPlace dbpedia:Japan .dbpedia:Nippon_Columbia dbpedia-owl:distributingCompany dbpedia:Japan ; dbpedia-owl:distributingLabel dbpedia:Japan ; dbpedia-owl:country dbpedia:Japan .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix yago: <http://dbpedia.org/class/yago/> .dbpedia:Japan rdf:type yago:EastAsianCountries , owl:Thing .@prefix ns6: <http://schema.org/> .dbpedia:Japan rdf:type ns6:Country , yago:CountriesBorderingThePhilippineSea , yago:Empires , yago:IslandCountries , yago:StatesAndTerritoriesEstablishedIn660BC , dbpedia-owl:Country , dbpedia-owl:PopulatedPlace , ns6:Place , yago:CountriesBorderingThePacificOcean .@prefix ns7: <http://umbel.org/umbel/rc/> .dbpedia:Japan rdf:type ns7:Country , ns7:PopulatedPlace , dbpedia-owl:Place , yago:OECDMemberEconomies .

% curl -ILH 'Accept: text/turtle' http://dbpedia.org/resource/JapanHTTP/1.1 303 See OtherDate: Thu, 04 Jul 2013 09:36:52 GMTContent-Type: text/turtle; qs=0.7Content-Length: 0Connection: keep-aliveServer: Virtuoso/07.00.3203 (Linux) i686-generic-linux-glibc212-64 VDBTCN: choiceVary: negotiate,acceptLink: <http://mementoarchive.lanl.gov/dbpedia/timegate/http://dbpedia.org/resource/Japan>; rel="timegate"Location: http://dbpedia.org/data/Japan.ttl!HTTP/1.1 200 OKDate: Thu, 04 Jul 2013 09:36:52 GMTContent-Type: text/turtle; charset=UTF-8Content-Length: 1967774Connection: keep-alive......

Page 14: スキーマとURI

“Cool URIs”•リソース識別子としてのURIとリソース表現(文書)のURIを区別する •2つの代表的なソリューション • 303 リダイレクト •リソースURIを参照したときに適切なリソース表現URIへ303 (See Other) でリダイレクト •パターン •一つのGeneric Documentにリダイレクトした後にcontent-negotiation • Generic Documentなしで直接content-negotiationしてリダイレクト

•ハッシュURI • ’#’(fragment identifier)付きのURIをリソース識別子とする •パターン • ‘#’なしのURIがリソース表現のURI • ‘#’なしのURIでcontent-negotiationをした後にリソース表現IRIを返答

14

Page 15: スキーマとURI

http://dbpedia.org/resource/Matsuyama,_Ehime

http://dbpedia.org/page/Matsuyama,_Ehime

http://dbpedia.org/data/Matsuyama,_Ehime.ttl

303 redirect Accept: text/html

303 redirect Accept: text/turtle

303リダイレクト例: DBpedia

15

Page 16: スキーマとURI

200 OK Accept: text/html

200 OK Accept: application/rdf+xml

http://www.w3.org/People/Berners-Lee/card

#以下削除

HTML Doc

RDF/XML Doc

http://www.w3.org/People/Berners-Lee/

card#i

ハッシュ例: TimBL

16

Page 17: スキーマとURI

http://www.w3.org/2009/08/skos-reference/skos.html

http://www.w3.org/TR/skos-reference/skos.rdf

303 redirect Accept: text/html

303 redirect Accept: application/rdf+xml’

http://www.w3.org/2004/02/skos/core

#以下削除http://www.w3.org/

2004/02/skos/core#Concept

ハッシュ+303例: SKOS

17

Page 18: スキーマとURI

303 or Hash•Hashが向いているもの •小さく安定的な複数リソースのセット •例: 語彙ファイル •直接ファイルを置きたい場合 •例: foaf文書,HTML(+RDFa)文書

• 303が向いているもの •大きなデータセット •例: DBpedia • データ全体を使いたい人向けに同時にデータダンプやSPARQL Endpointも提供したほうがよい

18

Page 19: スキーマとURI

http://dbpedia.org/resource/Matsuyama,_Ehime

表現

識別

表現

http://dbpedia.org/data/Matsuyama,_Ehime.ttl

http://dbpedia.org/page/Matsuyama,_Ehime

識別

識別

19

Page 20: スキーマとURI

URIの省略• URIで識別するのは良いがとにかく長い

• シリアライズ形式毎に省略記法が用意されている

• 例: http://example.org/ex/テスト => ex:テスト

• Turtle

• @prefix ex: <http://example.org/ex/>

• RDF/XML

• xmlns:ex=“http://example.org/ex/“

• JSON-LD

• “@context” { “ex”: “http://example.org/ex/“ }

Page 21: スキーマとURI

省略記法の良くあるミス• 省略されたURIと完全なURIは構造的には明示的に区別できない

• (なんで区切り文字を’:’にしたのか)

• ex:テストは ex: というprefixと テストの組み合わせの省略されたURIなのか,exというschemeのURIなのか

• Turtle

• 完全なURIは <>で囲む.省略記法は<>で囲まない

• ○ <http://xmlns.com/foaf/0.1/name>, foaf:name

• × <foaf:name> <= “foaf:name” というURIだと解釈される

• RDF/XML

• rdf:aboutやrdf:resource(XML属性)の値には省略記法で書けない.要素には書ける(但し制約あり)

• ○ <rdf:Description rdf:about=“http://xmlns.com/foaf/0.1/Person”>

• × <rdf:Description rdf:about=“foaf:Person”>

Page 22: スキーマとURI

http://ja.dbpedia.org/resource/夏目漱石識別

識別

http://viaf.org/viaf/56614190

22

Page 23: スキーマとURI

http://ja.dbpedia.org/resource/夏目漱石識別

識別

http://viaf.org/viaf/56614190

owl:sameAs

23

@prefix owl: <http://www.w3.org/2002/07/owl#> <http://ja.dbpedia.org/resource/夏目漱石> owl:sameAs <http://viaf.org/viaf/56614190> . <http://viaf.org/viaf/56614190> owl:sameAs <http://ja.dbpedia.org/resource/夏目漱石> .

Page 24: スキーマとURI

Schema

24

Page 25: スキーマとURI

語彙とスキーマ• RDFにおける語彙

• 用語: クラスとプロパティ

• 語彙: クラスとプロパティの集合

• クラス: リソースが属するグループ (分類・概念)

• プロパティ: リソースの属性,リソース間の関係

• スキーマ言語

• RDFで用いる語彙を定義する方法

• RDFS: 基本的な言語

• OWL: より詳細に知識を表現するための言語

• 実際にはRDFSやOWLもRDF語彙

25

Page 26: スキーマとURI

クラス• リソースのグループを作るなんらかの概念

• 型(type)とも言う

• インスタンス: クラスに属するリソース

• ex:タロー rdf:type ex:犬 .

• ex:タロー がインスタンス,ex:犬がクラス

• あるインスタンスが別のインスタンスのクラスになれる

• rdfs:Class a rdfs:Class .

26

Page 27: スキーマとURI

クラスの階層構造

• クラスは階層構造を持てる

• ex:犬 rdfs:subClassOf ex:動物 .

• ex:タロー a ex:犬 .

• ex:タロー a ex:動物 . が導出される

27

Page 28: スキーマとURI

プロパティ• リソースの属性やリソース間の関係

• プロパティもリソース (rdf:Propertyのインスタンス)

• プロパティの前後にくるリソースのクラスを指定可能

• ex:タロー ex:like ex:ハナコ .

• ex:like a rdf:Property; rdfs:domain ex:動物; rdfs:range rdfs:Resource .

28

Page 29: スキーマとURI

プロパティの階層構造

• プロパティも階層構造を持てる

• ex:love rdfs:subPropertyOf ex:like

• ex:ハナコ ex:love ex:ジロー

29

Page 30: スキーマとURI

既存語彙vs独自語彙A. 案

1. 使いまわせる語彙を使用

2. 見つからないものは独自に定義

B. 案

1. とりあえず全部独自に定義

2. 後から既存語彙にマッピング

Page 31: スキーマとURI

語彙のマッピング• クラスが同一: owl:equivalentClass

• プロパティが同一: owl:equivalentProperty

• サブクラス: rdfs:subClassOf

• サブプロパティ: rdfs:subPropertyOf

• 逆関係: owl:inverseOf

Page 32: スキーマとURI

よく使われる語彙• Dublin Core

• FOAF

• SKOS

• Schema.org

• GEO

• CC

• VoID

Page 33: スキーマとURI

Dublin Core• Dublin Core Metadata Initiativeによる策定

• リソースを記述するための基本語彙

• 元々書誌から派生

• DCMES: Dublin Core Metadata Element Set, Version 1.1

• DCTERMS: DCMI Metadata Terms

33

Page 34: スキーマとURI

Dublin Core Metadata Element Set, Version 1.1

• “Simple Dublin Core”

• 15の基本プロパティ

• http://dublincore.org/documents/dces/

34

@prefix dc: <http://purl.org/dc/elements/1.1/> @prefix ex: <http://example.org/ex/> !ex:001 dc:title “ファイブスター物語 1” ; dc:date “1987-05-21” ; dc:creator “永野 護” .

Page 35: スキーマとURI

<http://purl.org/dc/elements/1.1/title> dcterms:hasVersion <http://dublincore.org/usage/terms/history/#title-006> ; dcterms:issued "1999-07-02"^^<http://www.w3.org/2001/XMLSchema#date> ; dcterms:modified "2008-01-14"^^<http://www.w3.org/2001/XMLSchema#date> ; a rdf:Property ; rdfs:comment "A name given to the resource."@en ; rdfs:isDefinedBy <http://purl.org/dc/elements/1.1/> ; rdfs:label "Title"@en ; skos:note "A second property with the same name as this property has been declared in the dcterms: namespace (http://purl.org/dc/terms/). See the Introduction to the document \"DCMI Metadata Terms\" (http://dublincore.org/documents/dcmi-terms/) for an explanation."@en .

Page 36: スキーマとURI

DCMI Metadata Terms• DCMESの後継

• DCMESを全て引き継いだ上で再定義・拡張

36

@prefix dcterms: <http://purl.org/dc/terms/> @prefix ex: <http://example.org/ex/> !ex:001 dcterms:title “ファイブスター物語 1” ; dcterms:issued “1987-05-21” ; dcterms:creator ex:永野護 ; dcterms:publisher ex:角川書店 .

Page 37: スキーマとURI

dcterms:issued dcterms:hasVersion <http://dublincore.org/usage/terms/history/#issued-003> ; dcterms:issued "2000-07-11"^^<http://www.w3.org/2001/XMLSchema#date> ; dcterms:modified "2008-01-14"^^<http://www.w3.org/2001/XMLSchema#date> ; a rdf:Property ; rdfs:comment "Date of formal issuance (e.g., publication) of the resource."@en ; rdfs:isDefinedBy <http://purl.org/dc/terms/> ; rdfs:label "Date Issued"@en ; rdfs:range rdfs:Literal ; rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/date>, dcterms:date . !dcterms:creator dcterms:description "Examples of a Creator include a person, an organization, or a service."@en ; dcterms:hasVersion <http://dublincore.org/usage/terms/history/#creatorT-002> ; dcterms:issued "2008-01-14"^^<http://www.w3.org/2001/XMLSchema#date> ; dcterms:modified "2010-10-11"^^<http://www.w3.org/2001/XMLSchema#date> ; a rdf:Property ; rdfs:comment "An entity primarily responsible for making the resource."@en ; rdfs:isDefinedBy <http://purl.org/dc/terms/> ; rdfs:label "Creator"@en ; rdfs:range dcterms:Agent ; rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/creator>, dcterms:contributor ; owl:equivalentProperty <http://xmlns.com/foaf/0.1/maker> .

Page 38: スキーマとURI

DCMES vs DCTERMS

• 基本的には後継であるDCTERMSを使うべき

• DCMESとの互換性

• URI

• range

38

Page 39: スキーマとURI

FOAF: Friend of a Friend• 人についての語彙

• 有志による策定

• http://www.foaf-project.org

@prefix foaf: <http://xmlns.com/foaf/0.1/> @prefix dcterms: <http://purl.org/dc/terms/> @prefix ex: <http://example.org/ex/> !ex:永野護 a foaf:Person ; foaf:name “永野 護”@ja, “Mamoru Nagano”@en ; foaf:nick “クリス”@ja, “Chris”@en ; foaf:homepage <http://automaticflowers.ne.jp> .

Page 40: スキーマとURI

(http://xmlns.com/foaf/spec/index.rdf) !<rdfs:Class rdf:about="http://xmlns.com/foaf/0.1/Person" rdfs:label="Person" rdfs:comment="A person." vs:term_status="stable"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class" /> <owl:equivalentClass rdf:resource="http://schema.org/Person" /> <owl:equivalentClass rdf:resource="http://www.w3.org/2000/10/swap/pim/contact#Person" /> <rdfs:subClassOf><owl:Class rdf:about="http://xmlns.com/foaf/0.1/Agent"/></rdfs:subClassOf> <rdfs:subClassOf><owl:Class rdf:about="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing" rdfs:label="Spatial Thing"/></rdfs:subClassOf> <rdfs:isDefinedBy rdf:resource="http://xmlns.com/foaf/0.1/"/> <owl:disjointWith rdf:resource="http://xmlns.com/foaf/0.1/Organization"/> <owl:disjointWith rdf:resource="http://xmlns.com/foaf/0.1/Project"/> </rdfs:Class>

Page 41: スキーマとURI

Schema.org• 検索エンジン各社が共同で整備する広範囲の語彙

• http://schema.org

• W3Cのグループ: [email protected]

• 有志によるスキーマが公開

• http://schema.rdfs.org

• 公式版のスキーマもあるが文法ミスだらけなので参考程度

@prefix schema: <http://schema.org/> @prefix ex: <http://example.org/ex/> !ex:GTM a schema:Movie ; schema:director ex:永野護 ; schema:author ex:永野護 ; schema:actor ex:川村万梨阿 ; schema:productionCompany ex:オートマチック・フラワーズ・スタジオ ; schema:publisher ex:角川書店 ; schema:datePublished “2012-11-01” .

Page 42: スキーマとURI

(http://schema.rdfs.org/all.tll) !schema:Organization a rdfs:Class; rdfs:label "Organization"@en; rdfs:comment ""@en; rdfs:subClassOf schema:Thing; rdfs:isDefinedBy <http://schema.org/Organization>; !schema:address a rdf:Property; rdfs:label "Address"@en; rdfs:comment "Physical address of the item."@en; rdfs:domain [ a owl:Class; owl:unionOf (schema:Person schema:Place schema:Organization) ]; rdfs:range schema:PostalAddress; rdfs:isDefinedBy <http://schema.org/Person>; rdfs:isDefinedBy <http://schema.org/Place>; rdfs:isDefinedBy <http://schema.org/Organization>; .

Page 43: スキーマとURI

% curl -H 'Accept: application/ld+json' http://schema.org { "@context": { "@vocab": "http://schema.org/", "acceptsReservations": { "@type": "@id" }, "additionalType": { "@type": "@id" }, "applicationCategory": { "@type": "@id" }, "applicationSubCategory": { "@type": "@id" }, "arrivalTime": { "@type": "DateTime" }, "availabilityEnds": { "@type": "DateTime" }, "availabilityStarts": { "@type": "DateTime" }, "availableFrom": { "@type": "DateTime" }, …

Page 44: スキーマとURI

Schema.orgと他の語彙• Schema.orgの影響は大きい

• GoodRelationsの取り込み

• ECサイト用語彙

• 既存語彙からのマッピング

• FOAF, DBpedia等は既に対応済

• 他のマッピング案

• http://schema.rdfs.org/mappings.html

• 色々間違っているので参考程度

Page 45: スキーマとURI

SKOS: Simple Knowledge Organization System

• 概念階層の記述用語彙

• W3C勧告

• シソーラス,タクソノミ,分類,件名標目,トピック

• 階層関係が厳密でない: 下位概念のものが上位概念も満たすとは限らない

• skos:broader, skos:narrower, skos:related (これらは推移的ではない)

• RDFS/OWL

• 用語間の包摂関係: 下位概念は上位概念も満たす

Page 46: スキーマとURI

SKOSによる異なる概念間のマッピング

• 完全に同等: skos:exactMatch

• 近い: skos:closeMatch

• 関係がある: skos:relatedMatch

• 広い: skos:broadMatch

• 狭い: skos:narrowMatch

Page 47: スキーマとURI

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix owl: <http://www.w3.org/2002/07/owl#>. @prefix skos: <http://www.w3.org/2004/02/skos/core#>. @prefix xl: <http://www.w3.org/2008/05/skos-xl#>. @prefix rda: <http://RDVocab.info/ElementsGr2/>. @prefix frbrent: <http://RDVocab.info/uri/schema/FRBRentitiesRDA/>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. @prefix ndl: <http://ndl.go.jp/dcndl/terms/>. @prefix dct: <http://purl.org/dc/terms/>. !<http://id.ndl.go.jp/auth/ndlsh/00574798> rdf:type <http://www.w3.org/2004/02/skos/core#Concept>; dct:modified "2011-10-27T23:59:59"; dct:created "1980-06-20"; xl:prefLabel [xl:literalForm "人工知能";ndl:transcription "ジンコウチノウ"@ja-Kana,"Jinkochino"@ja-Latn]; rdfs:label "人工知能"; dct:source "電子計算機と人間 / ドナルド・G. フィンク 著 ; 高橋秀俊, 石田晴久 訳","広辞苑 第5版"; skos:exactMatch <http://id.ndl.go.jp/auth/bsh4/00536700>; skos:inScheme <http://id.ndl.go.jp/auth#topicalTerms>; xl:altLabel [xl:literalForm "人工頭脳";ndl:transcription "ジンコウズノウ"@ja-Kana,"Jinkozuno"@ja-Latn],[xl:literalForm "AI"],[xl:literalForm "Artificial intelligence"]; skos:historyNote "人工頭脳→人工知能 (20031218)"; skos:closeMatch <http://id.loc.gov/authorities/subjects/sh85008180>; skos:relatedMatch <http://id.ndl.go.jp/class/ndlc/M121>,<http://id.ndl.go.jp/class/ndc9/007.13>; skos:related <http://id.ndl.go.jp/auth/ndlsh/00567826>,<http://id.ndl.go.jp/auth/ndlsh/00569072>,<http://id.ndl.go.jp/auth/ndlsh/01017770>,<http://id.ndl.go.jp/auth/ndlsh/01182274>; skos:broader <http://id.ndl.go.jp/auth/ndlsh/00575008>; skos:narrower <http://id.ndl.go.jp/auth/ndlsh/00576312>,<http://id.ndl.go.jp/auth/ndlsh/01165604>; owl:sameAs <http://id.ndl.go.jp/auth/ndlsh/人工知能>. <http://id.ndl.go.jp/auth/ndlsh/00567826> rdfs:label "問題解決". <http://id.ndl.go.jp/auth/ndlsh/00569072> rdfs:label "パターン認識". <http://id.ndl.go.jp/auth/ndlsh/01017770> rdfs:label "オントロジー (情報科学)". <http://id.ndl.go.jp/auth/ndlsh/01182274> rdfs:label "ソフトコンピューティング". <http://id.ndl.go.jp/auth/ndlsh/00575008> rdfs:label "情報科学". <http://id.ndl.go.jp/auth/ndlsh/00576312> rdfs:label "エキスパートシステム". <http://id.ndl.go.jp/auth/ndlsh/01165604> rdfs:label "ニューラルネットワーク".

Page 48: スキーマとURI

(http://www.w3.org/TR/skos-reference/skos.rdf) !<rdf:Description rdf:about="#broader"> <rdfs:label xml:lang="en">has broader</rdfs:label> <rdfs:isDefinedBy rdf:resource="http://www.w3.org/2004/02/skos/core"/> <skos:definition xml:lang="en">Relates a concept to a concept that is more general in meaning.</skos:definition> <rdfs:comment xml:lang="en">Broader concepts are typically rendered as parents in a concept hierarchy (tree).</rdfs:comment> <skos:scopeNote xml:lang="en">By convention, skos:broader is only used to assert an immediate (i.e. direct) hierarchical link b etween two conceptual resources.</skos:scopeNote> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> <rdfs:subPropertyOf rdf:resource="#broaderTransitive"/> <owl:inverseOf rdf:resource="#narrower"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> </rdf:Description>

Page 49: スキーマとURI

geo: Basic Geo Vocabulary• 基本位置情報語彙: 世界測地系(WGS84)

• W3Cコミュニティ

• http://www.w3.org/2003/01/geo/

@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> @prefix ex: <http://example.org/ex/> !ex:さくらWORKS<関内> a geo:SpatialThing ; geo:lat “35.44658”^^xsd:float ; geo:long “139.63782”^^xsd:float .

Page 50: スキーマとURI

(http://www.w3.org/2003/01/geo/wgs84_pos) !<rdfs:Class rdf:about="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing"> <rdfs:label>SpatialThing</rdfs:label> <rdfs:comment>Anything with spatial extent, i.e. size, shape, or position. e.g. people, places, bowling balls, as well as abstract areas like cubes. </rdfs:comment> </rdfs:Class> !<rdf:Property rdf:about="http://www.w3.org/2003/01/geo/wgs84_pos#lat"> <rdfs:domain rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing" /> <rdfs:label>latitude</rdfs:label> <rdfs:comment>The WGS84 latitude of a SpatialThing (decimal degrees).</rdfs:comment> </rdf:Property> !NOTE: lat, long, altのrdfs:rangeはxsd:floatだがRDF/XMLでの便宜上定義は除いてある

Page 51: スキーマとURI

cc: Creative Commons• CCライセンスを記述するための語彙

• Creative Commons Rights Expression Language (CC REL)

• Creative Commonsによって管理

• http://creativecommons.org/CcREL

@prefix cc: <http://creativecommons.org/ns#> @prefix ex: <http://example.org/ex/> !ex:プレゼン資料 cc:attributionName “Fumihiro Kato” ; cc:attributionURL <http://fumi.me> ; cc:license <http://creativecommons.org/licenses/by/4.0> .

Page 52: スキーマとURI

<rdfs:Class rdf:about="http://creativecommons.org/ns#License"> <rdfs:label xml:lang="en-US">License</rdfs:label> <rdfs:comment xml:lang="en-US">a set of requests/permissions to users of a Work, e.g. a copyright license, the public domain, information for distributors</rdfs:comment> <rdfs:subClassOf rdf:resource="http://purl.org/dc/terms/LicenseDocument"/> </rdfs:Class> <rdf:Property rdf:about="http://creativecommons.org/ns#license"> <rdfs:range rdf:resource="http://creativecommons.org/ns#License"/> <rdfs:domain rdf:resource="http://creativecommons.org/ns#Work"/> <owl:sameAs rdf:resource="http://www.w3.org/1999/xhtml/vocab#license"/> <rdfs:subPropertyOf rdf:resource="http://purl.org/dc/terms/license"/> <rdfs:label xml:lang="en-US">has license</rdfs:label> </rdf:Property>

Page 53: スキーマとURI

VoID: Describing Linked Datasets with the VoID Vocabulary

• LODのデータセットを記述するための言語

• W3Cノート

• LODクラウド作るのにも使用されている @prefix void: <http://rdfs.org/ns/void#> . @prefix : <http://ja.dbpedia.org/void.ttl#> . !:DBpediaJA a void:Dataset ; dcterms:title "DBpedia Japanese"@en, "DBpedia Japanese"@ja ; dcterms:description "DBpedia Japanese provides RDF datasets extracted from Japanese Wikipedia" ; dcterms:creator <http://fumi.me/foaf#me> ; dcterms:publisher :LODAC ; dcterms:contributor :NII, :ROIS, :DBpediaCommunity ; dcterms:source <http://ja.dbpedia.org/page/Wikipedia> ; dcterms:created "2012-05-09"^^xsd:date ; dcterms:license <http://creativecommons.org/licenses/by-sa/3.0/> ; foaf:homepage <http://ja.dbpedia.org> ; foaf:page <http://datahub.io/dataset/dbpedia-ja> ; void:sparqlEndpoint <http://ja.dbpedia.org/sparql> ; void:triples 70790371 ; void:feature <http://www.w3.org/ns/formats/RDF_XML>, <http://www.w3.org/ns/formats/N3>, <http://www.w3.org/ns/formats/RDFa> .

Page 54: スキーマとURI

void:Dataset a rdfs:Class, owl:Class; rdfs:label "dataset"; rdfs:comment "A set of RDF triples that are published, maintained or aggregated by a single provider." . !void:Linkset a rdfs:Class, owl:Class; rdfs:label "linkset"; rdfs:comment "A collection of RDF links between two void:Datasets."; rdfs:subClassOf void:Dataset . !void:sparqlEndpoint a rdf:Property; rdfs:label "has a SPARQL endpoint at"; rdfs:domain void:Dataset .

Page 55: スキーマとURI

行政データ語彙

• W3C Government Linked Data Working Group

• DCAT

• ORG

• Data Cube

Page 56: スキーマとURI

DCAT: Data Catalog Vocabulary• データカタログ用語彙

• W3C勧告, http://www.w3.org/TR/vocab-dcat/

• 主にDCTermsやSKOSと組み合わせて使うことを想定

• CKANやSocrataといったソフトウェアが採用@prefix foaf: <http://xmlns.com/foaf/0.1/> @prefix dcterms: <http://purl.org/dc/terms/> @prefix dcat: <http://www.w3.org/ns/dcat#> @prefix ex: <http://example.org/ex/> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> !ex:dataset-1 a dcat:Dataset ; dcterms:title “横浜市 人口統計 2010年度版” ; dcat:keyword “統計” ; dcterms:issued “2011-03-31”^^xsd:date ; dcterms:publisher ex:横浜市 ; dcat:distribution [ a dcat:Distribution ; dcat:downloadURL <http://example.org/files/dataset-1.csv> ; dcterms:title “横浜市 人口統計 2010年度版 CSVデータ” ; dcat:mediaType “text/csv” ; dcat:byteSize 10000 ] .

Page 57: スキーマとURI

The Organization Ontology• 組織用語彙

• 組織構造,役職等

• W3C勧告, http://www.w3.org/TR/vocab-org/

vocab-orgからの実例 !<http://reference.data.gov.uk/id/department/co> rdf:type org:Organization , central-government:Department; skos:prefLabel "Cabinet Office" ; org:hasUnit <http://reference.data.gov.uk/id/department/co/unit/cabinet-office-communications> . <http://reference.data.gov.uk/id/department/co/unit/cabinet-office-communications> rdf:type org:OrganizationalUnit ; skos:prefLabel "Cabinet Office Communications" ; org:unitOf <http://reference.data.gov.uk/id/department/co> ; org:hasPost <http://reference.data.gov.uk/id/department/co/post/246> . !<http://reference.data.gov.uk/id/department/co/post/246> skos:prefLabel "Deputy Director, Deputy Prime Minister's Spokesperson/Head of Communications" . org:postIn <http://reference.data.gov.uk/id/department/co/unit/cabinet-office-communications> ; org:heldBy <#person161> .

Page 58: スキーマとURI

The RDF Data Cube Vocabulary• 統計データ用語彙

• W3C勧告, http://www.w3.org/TR/vocab-data-cube/

• SDMX (Statistical Data and Metadata eXchange) との互換性

eg:dsd1 a qb:DataStructureDefinition; rdfs:comment "shipments by time (multiple measures approach)"@en; qb:component [ qb:dimension sdmx-dimension:refTime; ], [ qb:measure eg-measure:quantity; ], [ qb:measure eg-measure:weight; ] . !eg:dataset1 a qb:DataSet; qb:structure eg:dsd1 . eg:obs1a a qb:Observation; qb:dataSet eg:dataset1; sdmx-dimension:refTime "2010-07-30"^^xsd:date; eg-measure:weight 1.3 ; eg-measure:quantity 42 ; .

Page 59: スキーマとURI

便利サイト

• Linked Open Vocabulary

• prefix.cc

• LOD Stats

• WebProtégé

Page 60: スキーマとURI

Linked Open Vocabulary• http://lov.okfn.org

• LODクラウドで使われている語彙についての調査

• VOAFとして提供

Page 61: スキーマとURI

<rdf:Description rdf:about="http://xmlns.com/foaf/0.1/"> <vann:preferredNamespacePrefix>foaf</vann:preferredNamespacePrefix> <vann:preferredNamespaceUri>http://xmlns.com/foaf/0.1/</vann:preferredNamespaceUri> <dcterms:title xml:lang="en">Friend of a Friend vocabulary</dcterms:title> <bibo:shortTitle xml:lang="en">FOAF</bibo:shortTitle> <voaf:classNumber>13</voaf:classNumber> <voaf:propertyNumber>62</voaf:propertyNumber> <foaf:homepage rdf:resource="http://www.foaf-project.org/"/> <voaf:extends rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos"/> <voaf:metadataVoc rdf:resource="http://www.w3.org/2003/06/sw-vocab-status/ns"/> <voaf:reliesOn rdf:resource="http://xmlns.com/wot/0.1"/> <voaf:specializes rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos"/> <voaf:hasEquivalencesWith rdf:resource="http://schema.org/"/> <voaf:extends rdf:resource="http://www.w3.org/2004/02/skos/core"/> <voaf:metadataVoc rdf:resource="http://purl.org/dc/elements/1.1/"/> <voaf:hasEquivalencesWith rdf:resource="http://purl.org/dc/terms/"/> <representedBy xmlns="http://lexvo.org/ontology#" rdf:resource="http://ckan.net/tag/format-foaf"/> </rdf:Description>

Page 62: スキーマとURI

prefix.cc

• よく使われるprefixとURIの対応関係をユーザ投票で順位付け

• いくつかの形式で出力

Page 63: スキーマとURI

LOD Stats

63

Page 64: スキーマとURI

WebProtégé

• Protégéは元々スタンドアローンで動く語彙作成アプリ

• Web版も大分機能充実

• 語彙公開にも使用可能

Page 65: スキーマとURI