Download presentation
Presentation is loading. Please wait.
Published byAbigayle Johnston Modified over 8 years ago
1
RDF & SPARQL Introduction Dongfang Xu Ph.D student, School of Information, University of Arizona Sept 10, 2015
2
Catalog Semantic Web RDF RDF Schema SPARQL
3
Semantic Web The Limits of today’s Web (2.0): 1.High recall and low precision; 2. Low recall and even on recall; 3. Results are highly sensitive to vocabulary. 4. Single Web pages. Reference: Antoniou, G., & Van Harmelen, F. (2008). A semantic web primer (2 nd ed.). Cambridge, Mass: MIT press.
4
Semantic Web What can be done?
5
Semantic Web The Semantic Web Technologies (standard technologies ): 1.Format the web content. 2.Relate the data Machine-processable web information
6
Semantic Web Physiotherapy Agilitas Physiotherapy Centre Lisa Davenport Steve Matthews Kelly Townsend
7
XML & RDF David Billing David Billing”> Discrete Mathematics David Billing Discrete Mathematics XML does not provide any means of talking about the semantics (meaning) of data
8
Catalog Semantic Web RDF RDF Schema SPARQL
9
What is RDF? A data model for objects (“resources”) and relations between them; Provides a simple semantics for the data model; The model can be represented in an xml syntax. Basic building block is an object-attribute-value triple, called statement. RDF
10
<River id="Yangtze" xmlns="http://www.geodesy.org/river"> 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea XML Modify the following XML document so that it is also a valid RDF document: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/river#"> <rdf:Description rdf:ID="Yangtze" 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea RDF Yangtze.xml Yangtze.rdf "convert to"
11
RDF Data Model As you read the RDF literature you may see the following terminology: Subject: this term refers to the item that is playing the role of the resource. predicate: this term refers to the item that is playing the role of the property. Object: this term refers to the item that is playing the role of the value. Subject Object predicate Resource Value property Equivalent! <rdf:Description rdf:ID="Yangtze" 6300 kilometers
12
RDF resource A Resource is any object identifiable by a URI. 1.Resources can use any URI, e.g.: http://www.example.org/file.xml#element(home) http://www.example.org/file.html#home http://www.example.org/file2.xml#xpath1(//q[@a=b]) 2. URI-s can also use different forms: CIT11111 =(http://www.example.org/file.xml# CIT11111) 3525346 3. The resource is defined like below, with Usually means referencing an existing resource; means creating a new resource;
13
RDF resource Discrete Mathematics David Bill Associate Professor Resource reference
14
RDF property & value Property value must be a Literal or a Resource Discrete Mathematics property Value
15
RDF element 1.Root element <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cd="http://www.recshop.fake/cd#"> 2. Description element define resource 3. Property eelement define attribute 4. Bag/Seq/Alt element define a few attributes within the property. See more: http://www.w3schools.com/webservices/ws_rdf_main.asp
16
Catalog Semantic Web RDF RDF Schema SPARQL
17
RDF Schema RDF schema is a vocabulary description language for describing properties and classes of RDF resources, with a semantics for generalization hierarchies of such properties and classes. RDF Schema is a primitive ontology language. RDFS will use RDF itself to define the semantics of particular domain.
18
RDF Schema
19
Catalog Semantic Web RDF RDF Schema SPARQL
20
SPARQL is the query language to search resource & value; It is based on matching graph patterns ( like RDF triple pattern, but the resource and value can be variable) ?res uni:phone ?pho use “?” to define variable, for both string and numeric type Like in SQL, it has a Select-From-Where structure.
21
SPARQL PREFIX rdf: PREFIX uni: (namespace make quries shorter and easier to read) Select ?X Where { ?x uni: phone : 520-543-2340. }
22
SPARQL Select ?X ?Y Where { ?x uni: phone ?y }
23
SPARQL Select ?name ?Y Where { ?X rdf:type uni:Lecturer; uni: name ?name. ?X uni: phone ?Y. }
24
SPARQL Select ?name ?Y Where { ?X rdf:type uni:Lecturer; uni: name ?name. ?X uni: phone ?Y. OPTIONAL{?X uni:phone ?Y} }
25
SPARQL Select ?Y Where { ?X rdf:type uni:Lecturer; uni: name :David Bill. ?C uni: phone ?Y. Filter(?X=?C) }
26
SPARQL
30
1.SPARQL has several query forms. 2.The CONSTRUCT query form returns an RDF graph.
31
SPARQL More resources: http://www.w3.org/TR/rdf-sparql-query/#docResultDesc http://rdf.myexperiment.org/howtosparql https://jena.apache.org/tutorials/sparql.html
32
Thank you! Q&A
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.