Upload
others
View
40
Download
0
Embed Size (px)
Citation preview
四原则:从技术实现的角度
• URI for everything.
•可解引(dereferenced)的HTTP URI, Cool URIs支持HTTP的内容协商机制(Content Negotiation)如带Hash的URI、303转向、Restful Web Services
•数据RDF化(RDFrize)。
•链接的RDF。
关系链接:foaf:knows
定位链接:HTTP URIs
词表链接:owl:equivalentClass,owl:equivalentProperty
303转向
测试地址:http://lod.library.sh.cn/test303/foafhttp://lod.library.sh.cn/test303/foaf.rdf
Best Practice Recipes for Publishing RDF Vocabularieshttp://www.w3.org/TR/swbp-vocab-pub/ by Diego Berrueta , Jon Phipps
发布(Publishing)的要素
•领域建模•词表映射•数据转换•数据关联•数据发布到Web决定采用何种License
•搭建服务可发现:提供关于数据的数据(void)可消费:提供标准开放的访问接口。静态RDF文件下载,Sparql endpoint, API…
•质量控制(数据验证器validators)
消费(consuming)的方式
•浏览(semantic browser)
•发现(discovery framework)
•抓取(semantic crawler)
•检索(sematic searchengin)
•混搭(mashup,apps)
•推理(reasoner)
•展现(visulization)
构建关联数据应用
网络爬虫模式
实时解引模式
联邦检索模式
* 所用到数据源的数量;* 对数据更新频率的需求如何;
* 用户交互或查询请求所需要的响应时间;
* 应用是否需要实时地发现更新的数据。
?
Linked Data: Evolving the Web into a Global Data Space, by Tom Heath and Christian Bizer
关联数据应用的体系架构
发布
• 数据转换:Anything To Triples (any23) RDFizers
• Doc2RDF 文档发布成关联数据:RDF Extension for Google Refine, CSV2RDF4LOD
• CMS2RDF数据随内容而生而变:Drupal
• RDB2RDF 关系数据库发布为关联数据:D2R(RDB2RDF_SurveyReport.pdf)
• Linked Data Server/framwork(整合发布服务器):Pubby,LMF关联媒体框架
消费
• 语义浏览器 Tabulator Disco
• 语义爬虫及语义搜索引擎(提供API)SWSE
• 联邦SPARQL搜索引擎FedX Federated SPAQRL Query Engine
• 关联发现整合平台 SILK, LIMES
• 客户端开发工具包 JavaScript:Tabulator AJAR library,PHP:Moriarty,Java:the SemanticWeb Client LibraryJena,LAMPP:SQUIN
• 混搭 Revyu DBpedia Mobile
• Music Mashup
词表及映射 数据转换(RDFizers) 数据发布 提供服务
FOAFSIOCDOAPDublin CoreSKOSReview VocabularyGoodRelationsMusic OntologyOrganization OntologyLODEschema.orgSIOC and others vocabulatiresDOAP and the GForgeontologyGeonames
R2R Framework
MARC/MODS -> RDFOAI-PMH -> RDFXSD -> OWLJPEG -> RDFMPEG-7/CS -> OWLEXIF -> RDFBitTorrent -> RDFEMail -> RDFBibTEX -> RDFPOM -> RDFJava -> RDFJavadoc -> RDFLDIF -> RDFiCal -> RDFRFC822 -> RDFGarmin -> RDFWWW Content -> RDFXLS -> RDFCSV -> RDFFlickr -> RDFD2RMAP D2RQany23… …
DrupalTriplifyD2R ServerVirtuoso OAI2LOD ServerJosekiPublishMyData
PubbyPagetLMFEldaPubbyLMFJosekiEldaMETAmorphosesLinked Data APITailis Platform
关联数据发布工具集锦
语义浏览器
客户端开发工具包
语义爬虫及搜索引擎
联邦SPARQL检索引擎
混搭 关联发现整合平台
razorbaseTabulatorDiscoOpenLinkData ExplorerZitgistRDF BrowserDBpediaMobileMarblesiLODFenfireObjectviewerzLinksSigmaQuick & Dirty RDF Browser
C based sparql-clientsparql-queryAJAX Client for SPARQLSPARQL ClientiSPARQLSPARQL Wrapper for PythonQuick and Dirty SPARQL BrowserJenaSemantic Web Client LibrarySQUINSemantic Web client for SWI PrologTabulator AJAR RDF library for Javascript
ldspider<sameAs.org>LOD Cloud CacheSig.ma
VisiNavFalconsSindiceWatsonYahoo! MicroSearchSemantic
Web Search Engine (SWSE)SwoogleSemantic Web SearchUriqr
FedXFederated SPAQRL Query EngineDARQ -Federated Queries with SPARQLiSPARQLSemantic
Discovery System
Revyu
DBpediaMobile
Music Mashup
SILKLIMES LDIF
DSNotifyTopBraidComposerSERIMISemMF
Yves Equivalence MinerMOAT: Meaning Of A Tag
关联数据消费工具集锦
Drupal
• RDFa
• RDF
• Schema.org
• Microdata
Drupal与语义网大事记
2001年 引入rdf.php
2007年年会 Drupal开源社区语义网群组成立
2007年10月 Drupal开源社区RDF项目成立
2008年年会宣布对关联数据的重视和支持,在Drupal6上支持关联数据的模块陆续公开发布并提供下载
2009年年会 所有支持关联数据的模块都开发完成并在年会上演示
2011年1月 Drupal7正式版发布,RDF相关模块作为核心模块
2011年5月 Drupal7的RDFx,SPARQL模块就绪
2011年6月 Drupal7支持schema.org
2011年6月 Drupal7支持Microdata
Drupal 7Core(R
DF)
Neologism
RDFx
SPAR
QL
Views
RESTf
ul WS
SPARQL
Schema.org
HTML中内嵌的Schema.org
可视化的本体建模
evoc
RDF UI
导入外部词汇表提供Web界面供管理员设置词表映射方案
支持SPARQL 查询
ARC2RDF索引SPARQL Endpoint
HTML中内嵌的RDFa
Drupal 7 中支持语义网的模块
输出RDF/XML, N3, Turtle,JSON
关联数据的消费
Pathauto
URI解决方案microdata微格式
Drupal的内容模型
内容类型
字段(field)
节点(Node)
BlogTitle
CreatorCreatedcontent
PersonFirstNameLastName
Emailknows
http://drupal.deri.ie/projectblogs/node/26
基于D7的上海市中心图书馆名录发布流程• 设置内容类型及其字段:图书馆
• 制订本地词表到外部词表的映射方案
• 导入外部词表
• 设置内容类型、字段到RDF 类和RDF 属性的映射
• 确定URI命名机制
• 对已有内容重建RDF索引
• 提供数据的消费接口:Restful Webservices服务和SPARQL Endpoint
词表映射
Org:Organization
foaf:name
dc:identifier
dc:type
foaf:img
vcard:geo
vcard:Email
foaf:phone
图书馆
dbpedia-owl:city
title
field_identifier
field_type
field_img
field_geo
field_adr
field_phone
Field_area
vcard:adr
field_email
body dc:description
URI 命名机制
• 域名: http://data.libnet.sh.cn:8080
• URI:域名+内部DOI(馆代码)
例:上海图书馆
http://data.libnet.sh.cn:8080/sl
Drupal 内容节点自动生成URI:
http://data.libnet.sh.cn:8080/node/3
Pathauto模块:URL重写-> http://data.libnet.sh.cn:8080/sl
RDF数据的生成和获取
• 随内容而生、而变
• 实时生成、随时变化 Save
• 一次索引、批量生成 Build RDF Index
• 内容节点:http://data.libnet.sh.cn:8080/node/3
• 相应的RDF数据http://data.libnet.sh.cn:8080/node/3.rdf
• http://data.libnet.sh.cn:8080/node/sl.rdf
Restful Web Services
• http://data.libnet.sh.cn:8080/sl.rdf
• http://data.libnet.sh.cn:8080/sl.xml
• http://data.libnet.sh.cn:8080/sl.n3
• http://data.libnet.sh.cn:8080/sl.json
小结
• 支持Cool URIs
• 支持内容协商
• 支持SPARQL Endpoint
• 全WEB界面,使用方便
• RDF实时生成
• 全模块化实现,无须了解数据库的内部结构
• CMS Drupal在内容生命周期管理和关联数据发布结合起来方面有很大的优势,尤其适用于不断生长不断交互的内容管理系统,但对那些遗留系统显得有些无能为力。
• 性能问题
• 客户端开发库ARC2停止维护
案例2:书目数据的FRBR化、RDF化关联书目数据的发布http://lod.library.sh.cn:8080/bib
平台:CentOS5.3+JDK1.6+Tomcat6+D2R Server 0.8.1+SQL Server2005参考:XC,西班牙国家图书馆
xc:locationn:1
rdarole:author1:n
ifla-frbr:P20011:n
ifla-frbr:P20031:n
ifla-frbr:P20041:n
Work
Expression
Manifestation
Person
Item
CoperateBody
结果DBPedia
viaf
选择D2R Server的原因
• Project founder Chris Bizer
• D2R Server 是一个 HTTP Server
• 将关系数据库内容发布成关联数据的一种工具。
图片来自:白海燕,梁冰.利用D2R实现关系数据库与关联数据的语义模式映射,现代图书情报技术,总第208/209期 2011年 第7/8期
用D2R Server发布的关联数据集
• Berlin DBLP Bibliography Server
• Hannover DBLP Bibliography Server
• 欧盟国家和地区数据库. http://www4.wiwiss.fu-berlin.de/eurostat/
• 欧洲研究和发展信息服务http://www4.wiwiss.fu-berlin.de/cordis/
• 欧洲就业服务http://www4.wiwiss.fu-berlin.de/eures/
• 欧洲研究领域人才数据库 http://www4.wiwiss.fu-berlin.de/euraxess/
D2R Server如何工作
• 提供一种可定制的映射文件:D2RQ Mapping 文件,该文件的作用是在访问关系型数据时将RDF 数据的查询语言 SPARQL 转换为 RDB 数据的查询语言 SQL,并将 SQL 查询结果转换为 RDF 三元组或者 SPARQL 查询结果数
据。这些数据可供传统浏览器浏览,也可用SPARQL检索,并返回RDF/XML,N3等格式的RDF数据。
• 并没有将关系型数据库发布成真实的 RDF 数据,而是使用D2RQ Mapping 文件将其映射成虚拟的 RDF 格式。
它的好处是可以适时地使以大型关系数据库为后端的应用系统可以提供语义服务,而不用事先将大量的关系型数据库内容存储在专用的RDF数据库中。
自动生成Mappping 文件
• generate-mapping [-u user] [-p password] [-d driver] [-l script.sql] [--[skip-](schemas|tables|columns) list] [--w3c] [-v] [-b baseURI] [-o outfile.ttl] [--verbose] [--debug] jdbcURL
定制Mapping文件Mapping 语言的基本语法• d2rq:ClassMap
代表 OWL Ontology 或者 RDFS Schema 中的一个或一组相似的 Class,它一般映射到关系数据库中的一个表。
• d2rq:PropertyBridge
代表 OWL Ontology 或者 RDFS Schema 中 Class 的属性,它一般映射到关系数据库中某个表的一列。
d2rq:ClassMap的重要属性• d2rq:Class:表示该 ClassMap 所对应 Class,其取值可以来自现有的 OWL Ontology 或者 RDFS Schema,也可以根据自己的数据特征定义本地的 Class;
• d2rq:UriPattern和d2rq:uriSqlExpression: 定义URI 模式,用来指导生成实例化资源的真实 URI。。
d2rq:PropertyBridge的重要属性• d2rq:belongsToClassMap: 表示该 propertyBridge 所属的 ClassMap;
• d2rq:property: 表示该 propertyBridge 所对应 property,其取值可以来自现有的 OWL Ontology 或者 RDFS Schema,也可以根据自己的数据特征定义新的 property;
• d2rq:column: 表示该 propertyBridge 关联的某个具体表中的列。
• d2rq:refersToClassMap: 表示该 propertyBridge 引用的其它 ClassMap,它的取值不是该 propertyBridge 所属ClassMap 对应表中的取值,而是从引用的 ClassMap 对应表中取值。该属性一般会跟随几个 d2rq:join 来指明关联的条件,d2rq:join 类似 sql 语句中的 where 条件。
原始数据库结构
数据库 表 字段 说明
bib metadata title ,author ,callno,content ,date ,publisher ,isbn,catagory ,place
书目数据库元数据表,来自于ILS系统,共300条。
slcs names uid,name,id 名人手稿馆规范人名表
relations uid,id,ralation,name,relationship
名人关系表
lib libraries name,type,address,phone,district,homepage… …
上海市中心图书馆名录
FRBR化的数据库结构(三库分开)
数据库 表 字段 说明
bib Works id,title,author,catagory 作品,来自于metadata表。153条
Expressions id,workid,type,laguage,contributor
内容表达,来自于metadata表。188条
Manifestations
id,expressionid,title,alternative,place,publisher,extent,dimensions,type,bib
载体表现,来自于metadata表。328条
Items id,bib,location,callno 单件,来自于metadata表。1102条
libraryid libid,libname 用于映射到机构
personid id,name 用于映射到人
Ontology name,label,type,definition 本地词汇表
slcs Person id,name,uid 人,规范人名表
Nicknames id,nickname,uid 昵称表
Relations id,uid,personid,relationship 名人关系表
Relationship id,relationship 关系类型表
lib Libraries libid,libname,adr,phone… 机构
数据库2-slcs
数据库3-lib
数据库1-bib
FRBRize内容表达-
Expressions
载体表现-Manifestations
作品-Works
单件-Items
metadata
person
relations
libraries
relationship
personid
FRBR Group 1书
libraryid
FRBR Group 2人
FRBR Group 2机构
D2RQ模型
map:db_bib ad2rq:Database
map:db_slcs ad2rq:Database
map:W_ClassMap(ifla-frbr:C1001)
map:E_ClassMap(ifla-frbr:C1002)
map:M_ClassMap(ifla-frbr:C1003)
map:I_ClassMap(ifla-frbr:C1004)
d2r:serve
r
map:P_ClassMap(foaf:Person)
map:N_ClassMap(shlod:Nickname)
map:R_ClassMap(rel:Relation)
map:I_ClassMap
W_title PropertyBridge
W_author PropertyBridge
W_catagory_PropertyBridge
E_title_PropertyBridge
E_type_PropertyBridge
E_language_PropertyBridgeE_contributor_PropertyBridge
M_title_PropertyBridgeM_alternative_PropertyBridge
M_publisher_PropertyBridge
M_place_PropertyBridge
M_extent_PropertyBridge
M_dimenssions_PropertyBridge
I_location_PropertyBridge
I_callno_PropertyBridge
map:db_lib ad2rq:Database
P_name_PropertyBridge
P_friendOf_PropertyBridge
P_nick_PropertyBridge
N_is foaf:nick of_PropertyBridge
R_relationSubject_PropertyBridge
R_relationObject_PropertyBridge
R_relationship_PropertyBridge
dc:title
rdarole:author
dc:catagory
dc:title
dc:typedcterms:language
rdarole:contributor
isRealizedThrough ifla-frbr:P2001
isEmbodimentOf ifla-frbr:P2004
isExemplifiedBy ifla-frbr:P2005
dcterms:title
dcterms:alternative
dcterms:publisher
rdvocab:placeOfProduction
xc:extent
xc:dimenssions
xc:callNumber
xc:location
foaf:name
rel:friendOf
Foaf:nick
shlod:relationSubject
shlod:relationship
shlod:relationObject
FRBR化的数据库结构(三库合一)
数据库 表 字段 说明
bib Works id,title,author,catagory 作品,来自于metadata表。153条
Expressions id,workid,type,laguage,contributor
内容表达,来自于metadata表。188条
Manifestations
id,expressionid,title,alternative,place,publisher,extent,dimensions,type,bib
载体表现,来自于metadata表。328条
Items id,bib,location,callno 单件,来自于metadata表。1102条
Ontology name,label,type,definition 本地词汇表
Person id,name,uid 人,规范人名表
Nicknames id,nickname,uid 昵称表
Relations id,uid,personid,relationship
名人关系表
Relationship id,relationship 关系类型表
Libraries libid,libname,adr,phone… …
机构
D2RQ模型
map:db_bib a
d2rq:Database
map:W_ClassMap(ifla-frbr:C1001)
map:E_ClassMap(ifla-frbr:C1002)
map:M_ClassMap(ifla-frbr:C1003)
map:I_ClassMap(ifla-frbr:C1004)
d2r:server
map:P_ClassMap(foaf:Person)
map:N_ClassMap(shlod:Nickname)
map:R_ClassMap(rel:Relation)
map:I_ClassMap
W_title PropertyBridge
W_author PropertyBridge
W_catagory_PropertyBridge
E_title_PropertyBridge
E_type_PropertyBridge
E_language_PropertyBridgeE_contributor_PropertyBridge
M_title_PropertyBridgeM_alternative_PropertyBridge
M_publisher_PropertyBridge
M_place_PropertyBridge
M_extent_PropertyBridge
M_dimenssions_PropertyBridge
I_location_PropertyBridge
I_callno_PropertyBridge
P_name_PropertyBridge
P_friendOf_PropertyBridge
P_nick_PropertyBridge
N_is foaf:nick of_PropertyBridge
R_relationSubject_PropertyBridge
R_relationObject_PropertyBridge
R_relationship_PropertyBridge
dc:title
rdarole:author
dc:catagory
dc:title
dc:typedcterms:language
rdarole:contributor
isRealizedThrough ifla-frbr:P2001
isEmbodimentOf ifla-frbr:P2004
isExemplifiedBy ifla-frbr:P2005
dcterms:title
dcterms:alternative
dcterms:publisher
rdvocab:placeOfProduction
xc:extent
xc:dimenssions
xc:callNumber
xc:location
foaf:name
rel:friendOf
Foaf:nick
shlod:relationSubject
shlod:relationship
shlod:relationObject
所用词汇集• @prefix shlod: <> .• @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .• @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .• @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .• @prefix dc: <http://purl.org/dc/elements/1.1/> .• @prefix dcterms: <http://purl.org/dc/terms/> .• @prefix foaf: <http://xmlns.com/foaf/0.1/> .• @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> .• @prefix org: <http://www.w3.org/ns/org#>.• @prefix dbpedia-owl: <http://dbpedia.org/ontology/>.• @prefix owl: <http://www.w3.org/2002/07/owl#>.• @prefix ifla-frbr: <http://iflastandards.info/ns/fr/frbr/frbrer/>.• @prefix rdarole: <http://RDVocab.info/roles/>.• @prefix rdvocab: <http://rdvocab.info/Elements/>.• @prefix xc: <http://www.extensiblecatolog.info/Elements/>.• @prefix rel: <http://purl.org/vocab/relationship/>.
本地资源及词表:http://lod.library.sh.cn:8080/bib/resource/
URI解决方案• d2rq:uriColumn “TableName.ColumnName”
• d2rq:uriPattern “Person/@@Person.id@@”
• d2rq:uriSqlExpression
Resource URI: http://lod.library.sh.cn:8080/SLCS/resource/PersonA000005
Resource URI: http://lod.library.sh.cn:8080/bib/resource/I1
设定条件的RDF链接
• d2rq:condition
Relations
uid id relationship
1 A0002 友
1 A0003 父
1 A0003 兄
Relations
uid id name
1 A0001 巴金
链向外部数据集
VIAF API:http://www.oclc.org/developer/documentation/virtual-international-authority-file-viaf/using-apiAutoSuggest (JSON)http://viaf.org/viaf/AutoSuggest?query=[searchTerms]&callback[optionalCallbackName]
DBPedia
viaf
RDB2RDF小结
•需对原有系统的数据结构非常了解
•数据源:定时更新数据库表;
OAI-PMH自动收割;
利用原表的Trigger实时生成数据;
•对多个数据库之间生成关联不够方便
•适合于遗留系统
•如何引入外部数据集的数据?
• 一、发布静态rdf文件http://xtykc.dlresearch.cn/foaf.rdf
http://www.cloudlibrary.info/foaf.html 林海青
• 二、单个本地RDF数据集,提供SPARQL Endpoint +Restful
Webservices
http://data.libnet.sh.cn:8080/
• 三、多个互相关联的本地RDF数据集http://lod.library.sh.cn:8080/bib/
• 四、数据云:多个相互关联的异地数据集 Data Hub
LOD/DBPedia/FreeBase
• 五、应用云:APIs,Apps,Mashups,Crawlers,SearchEngins
对于图书馆来说,不仅仅要摘云揽雾、为己所用,更应该成为广袤天空中的一朵又一朵云,融入云层之中,让自己有云可摘。
http://librarysalon.com/space-50-do-blog-id-11514.html