Presentation is loading. Please wait.

Presentation is loading. Please wait.

QQ群:三人行(语义有你) 150461365 SPARQL 陈 涛 2016/4/1.

Similar presentations


Presentation on theme: "QQ群:三人行(语义有你) 150461365 SPARQL 陈 涛 2016/4/1."— Presentation transcript:

1 QQ群:三人行(语义有你) SPARQL 陈 涛 2016/4/1

2 提纲 SPARQL语法分析 SPARQL Endpoint案例分享 以家谱知识库为例 Data Mashup

3 SPARQL语法分析

4 SPARQL SPARQL Protocol And Rdf Query Language SPARQL for triple store
SQL for relationship database

5 Triple Store Oracle NoSQL AllegroGraph OpenLink Virtuoso Stardog
Others 4store | BigData | TDB | MarcLogic

6 RDF Benefits RDF-based solutions, have benefits such as the following:
A simple and uniform standard data model.. A powerful standard query language. Standardized data interchange formats. JSON-LD RDF/XML N-Triples Turtle

7 SPARQL Form

8 查询模式 SELECT - 返回全部或者部分查询结果中的变量; ASK - 返回TRUE或FALSE,判断查询结果是否存在;
DESCRIBE - 返回查询结果中资源的RDF Graph; CONSTRUCT - 依据查询结果中的三元组变量,返回 新的RDF Graph。

9

10 查询所有人 fn Becky smith John Smith Matt Jones
PREFIX vcard: < SELECT ?fn WHERE { ?s vcard:FN ?fn. } ORDER BY ?fn fn Becky smith John Smith Matt Jones Sarah Jones

11 查询Family为Jones的人 fn Matt Jones Sarah Jones
PREFIX vcard: < SELECT ?fn WHERE { ?s vcard:FN ?fn ; vcard:N ?n . ?n vcard:Family ‘Jones’ . } ORDER BY ?fn fn Matt Jones Sarah Jones

12 图模式 Basic Graph Patterns, where a set of triple patterns must match
Group Graph Pattern, where a set of graph patterns must all match Optional Graph patterns, where additional patterns may extend the solution Alternative Graph Pattern, where two or more possible patterns are tried Patterns on Named Graphs, where patterns are matched against named graphs

13 29

14 查询所有人及年龄 PREFIX vcard: < SELECT ?fn ?age WHERE { ?s vcard:FN ?fn. ?s vcard:AGE ?age . } ORDER BY ?fn fn age Sarah Jones 29

15 查询所有人及年龄 PREFIX vcard: < SELECT ?fn ?age WHERE { ?s vcard:FN ?fn. OPTIONAL {?s vcard:AGE ?age .} } ORDER BY ?fn fn age Becky smith John Smith Matt Jones Sarah Jones 29

16 结果修饰 结果修饰符能够影响查询的返回结果,从而使查 询在作用范围的广度和作用效果的程度上都有显 著地增强。结果修饰符主要包含以下几种:
DISTINCT REDUCED ORDER BY OFFSET 和 LIMIT

17 Syntax for Literals “chat” 'chat'@fr with language tag "fr"
"xyz"^^< 1, which is the same as "1"^^xsd:integer 1.3, which is the same as "1.3"^^xsd:decimal 1.0e6, which is the same as "1.0e6"^^xsd:double true, which is the same as "true"^^xsd:boolean

18 ASK PREFIX vcard: < ASK { ?s vcard:FN ‘John Smith’. } ?s vcard:FN ‘Jack Smith’. true false

19 DESCRIBE PREFIX bibo: <http://purl.org/ontology/bibo/>
DESCRIBE ?s WHERE { ?s bibo:issn ‘ ’ . } ?s 美国 Trends in … WOS:000350…

20

21 CONSTRUCT PREFIX bibo: <http://purl.org/ontology/bibo/>
CONSTRUCT {?s dc:author ‘John Smith’ .} WHERE { ?s bibo:issn ‘ ’ . } ?s John Smith 美国 Trends in … WOS:000350…

22 不会返回资源的所有信息 只返回Construct中要求的信息

23 SPARQL Endpoint案例分享

24 SPARQL Endpoint SPARQL Endpoint in the semantic web world - and is the way in which the data on the semantic web is published to the outside world in a query enabled form. A SPARQL endpoint enables users (human or other) to query a knowledge base via the SPARQL language.

25 家谱知识库 SPARQL Endpoint

26

27 RESTful调用 http://data.library.sh.cn:8890/sparql Client需要提交的参数:
default-graph-uri= query=select * where {?s bf:label ?name. filter contains(str(?name), ‘陈’)} format=json

28

29 Data Mashup

30 Leucovorin亚叶酸

31

32 Leucovorin亚叶酸

33

34 独立 开放 关联

35 Give a little, Get a little!


Download ppt "QQ群:三人行(语义有你) 150461365 SPARQL 陈 涛 2016/4/1."

Similar presentations


Ads by Google