Semantic web

34
SPARQL: Query Language for RDF 研究 鍾聖彥 指導師 許慶 教授

description

 

Transcript of Semantic web

Page 1: Semantic web

SPARQL: Query Language for RDF

研究⽣生 鍾聖彥 指導⽼老師 許慶⽣生 教授

Page 2: Semantic web

Sir Tim Berners-Lee• Born 8 June 1955

• British computer scientist.

• The inventor of the World Wide Web.(WWW)

• The concept of the Semantic Web is the brainchild of the original creator of the World- Wide Web.(1998)

• Web 3.0.

Page 3: Semantic web

This NeXT Computer was used by Berners-Lee at CERN and became the world's first web server

Page 4: Semantic web

Semantic WebAn extension of the World Wide Web that allows computers to intelligently search, combine, and process Web content based on the meaning that this content has to humans.(Pascal Hitzler, Markus Krotzsch, and Sebastian Rudolph 2010). !

The idea behind the Semantic Web is 'to weave a Web that not only links documents to each other but also recognises the meaning of the information in those documents.' (Frauenfelder 2001);

—Tim Berners-Lee, 2006

Page 5: Semantic web

–Tim Berners-Lee, 2006

「…….,Web 2.0 and access to a semantic Web integrated across a huge space of data, you'll have access to an unbelievable data resource

…」(Web 3.0)

Page 6: Semantic web

Semantic Meaning

Page 7: Semantic web

RDF (Resource Description Framework)• Formal language for describing structured information.

• The goal of RDF is to enable applications to exchange data on the Web while still preserving their original meaning.

• RDF consequently is often viewed as the basic representation format for developing the Semantic Web.

• Based on a very simple graph-oriented data schema.

• A first official specification was published in 1999 by the W3c.

Page 8: Semantic web

描述的事物 A 描述事物的具體屬性(property) B 描述的作為該屬性的值的事物 C

「A有⼀一個B是C來表⽰示」

語法

Page 9: Semantic web

RDF Description of a person named Eric Miller

Whose name is Eric Miller, whose email address is [email protected], and whose title is Dr.

Page 10: Semantic web

Therefore, the following "subject, predicate, object" RDF triples can be expressed: http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#fullName, "Eric Miller" http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#mailbox, [email protected] http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#personalTitle, "Dr." http://www.w3.org/People/EM/contact#me, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2000/10/swap/pim/contact#Person

RDF graph

Page 11: Semantic web

The XML Serialization of RDF

Page 12: Semantic web

What is SPARQL?• pronounced as sparkle

• RDF query and inference languages

• SQL-like language

• Accordingly simple RDF graphs are used as fundamental query patterns.

• One of the key technologies of the semantic web.!

• Represented using Turtle (Terse RDF Triple Language)

• SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns

Page 13: Semantic web

Data Descriptions

Page 14: Semantic web

Result Descriptions

Page 15: Semantic web

Like…

Page 16: Semantic web

SPARQL可以讓使⽤用者寫出廣域上不含糊的詢問。 舉例來說,以下的詢問可以取得世界上所有⼈人的姓名與Email:

Page 17: Semantic web

What are all the country capitals in Africa?

Page 18: Semantic web

Writing a Simple QueryNTriple寫法

Page 19: Semantic web

Multiple Matches

Page 20: Semantic web

The result of a query is a solution sequence, corresponding to the ways in which the query's graph pattern matches the data.

Multiple Matches

Page 21: Semantic web

Multiple Matches

This is a basic graph pattern match; all the variables used in the query pattern must be bound in every solution.

Page 22: Semantic web

Matching RDF Literals Matching Literals with

Numeric Types

Language Tags

Arbitrary Datatypes

Page 23: Semantic web

Matching Literals with Language Tags

Page 24: Semantic web

Matching Literals with Numeric Types

Integers in a SPARQL query indicate an RDF typed literal with the datatype xsd:integer.

For example: 42 is a shortened form of "42"^^<http://www.w3.org/2001/XMLSchema#integer>.

!

Page 25: Semantic web

Matching Literals with Arbitrary Datatypes

Page 26: Semantic web

Building RDF Graphs

The SELECT query form returns variable bindings.

The CONSTRUCT query form returns an RDF graph.

The graph is built based on a template which is used to generate RDF triples based on the results of matching the graph pattern of the query.

Page 27: Semantic web
Page 28: Semantic web

RDF Term ConstraintsRestricting the Values of Strings

SPARQL FILTER functions like regex can test RDF literals. regex matches only plain literals with no language tag. regex can be used to match the lexical forms of other literals by using the str function.

Page 29: Semantic web
Page 30: Semantic web

RDF Term Constraints Restricting Numeric Values

Page 31: Semantic web
Page 32: Semantic web

Other Term Constraints

Page 33: Semantic web

ReferencePascal Hitzler, Markus Krotzsch, and Sebastian Rudolph (2010). Foundations of Semantic Web Technologies. Taylor and Francis Group, ISBN-10: 142009050X, ISBN-13: 978-1420090505. !http://semwebtw.openfoundry.org/2010/Talks/0319-semweb-kennyluck/ !http://www.linkeddatatools.com/downloads !http://viziquer.lumii.lv/ !https://wiki.base22.com/display/btg/SPARQL+Query+Examples !http://en.wikipedia.org/wiki/GeoSPARQL !http://www.w3.org/DesignIssues/Semantic.html !http://openisdm.iis.sinica.edu.tw/index.php/resource-repository/general-data-processing/documents/17-rdf !http://www.w3.org/TR/rdf-sparql-query/#sparqlSyntax

Page 34: Semantic web

End