SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, TOOLS, CASES AND BEST PRACTICES
Luka Pavlič University of Maribor
Faculty of Electrical Engineering and Computer Science
SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, - - PowerPoint PPT Presentation
SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, TOOLS, CASES AND BEST PRACTICES Luka Pavli University of Maribor Faculty of Electrical Engineering and Computer Science Johannes Kepler Universitt Linz , October 2010 Luka
Faculty of Electrical Engineering and Computer Science
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 2
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 3
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 4
Oracle 10g Plugin
Inte g rira n re pozitorij Inte g rira n re pozitorij storite v
takso no mije + o nto lo gije + fo lkso no mije
L
L
pove zova nje , kla sific ira nje
sto ritev / viro v / po datko v / upo rabniko v
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 5
WWDot
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 6
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 7
OBDPR
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 8
OBDPR
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 9
OSSP
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 10
OSSP
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 11
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 12
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 13
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 14
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 15
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 16
d t l
Web as we know it – concepts and technologies Semantics: how to present knowledge Ontologies and metadata: how to organize knowledge Ontologies and metadata: how to organize knowledge Standard XML-based technologies (XML, XML schema, XPath, XSLT…)
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 17
j pp
http://www.w3.org/2001/sw/ http://www.w3.org/standards/semanticweb/ http://www.w3.org/standards/semanticweb/ http://semanticweb.org/wiki/Main_Page
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 18
http://www.w3schools.com/semweb/default.asp
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 19
We are pretty good at generating data.
Modern IT enables generating and storing HUGE
WWW anables that data to be globaly accessible.
What about using it?
Do people want more data? NO! They want more
Easier way to produce knowledge based on data =
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 20
Ask Google about weather in Linz! What is the answer?
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 21
Example: domain oriented searching
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 22
Most data is represented as humen readable
Data organization: anarchy, URI based (WWW) Hard to find access mantain data Hard to find, access, mantain data So: is having data enough?
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 23
The idea: WHAT IF the machines would “know” the
Semantic web: let the data be understandable to
Data with meaning! Data + meaning knowledge
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 24
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 25
How to use knowledge? Infering! Explicitly stated knowledge implicit knowledge Examples:
All A are B. All B are C. All A are C. John is Jane’s son. ? ? ?
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 26
We need a formal way to represent knowledge. Options:
“IF…THEN” rules frameworks frameworks semantic nets
concepts predicate logic …
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 27
Useful when we need automated infering. IF condition THEN goal
goal IF condition Example:
IF (specie has hair) THEN (specie is a mamal) Specie is a mamal IF specie has hair
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 28
To represent structure and hierarchy.
Name Name Surname
Age Address Education …
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 29
Concepts and relationships. Subject Predicate Object.
W “li k”
We “link” unknown concepts to known ones! Semantic nets, supported by ontologies, are used in
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 30
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 31
WTF…
Let’s link unknown concept with knows ones
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 32
Let’s link unknown concept with knows ones
has
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 33
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 34
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 35
…is all about METADATA
Metadata = data about data! John is person John is person. John likes to smoke. John is married to Jane John is married to Jane. John owns Tom Tom is a Cat Tom is a Cat. …
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 36
Web of Data Giant Global Graph
Data Web W b 3 0 Web 3.0 Linked Data Web Semantic Data Web … …
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 37
Machine should “understand” data: formal knowledge
We need applications that uses knowledge →
Semantics + web + intelligent services
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 38
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 39
Describing/annotating human readable content, Describing web services,
Describing web-based services, EIA – data level integration, Easier searching for KNOWLEDGE Easier searching for KNOWLEDGE, IS upgrade, Knowledge integration in knowledge systems Knowledge integration in knowledge systems
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 40
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 41
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 42
In semantic web, ontologies are used to define
To Annotate. To enable infering To enable infering.
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 43
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 44
Difference between:
Contolled Vocabulary Taxonomy Thesaur Ontology Ontology
What is Folksonomy?
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 45
* Knowledge Management
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 46
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 47
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 48
Que stion
hasAnswe r
Answe r T e stCase
S l ti answe r isR e late dT
native T
c ase Solution l T applysT
Pa tte r n
isMe mbe r Of [tr ansitive ] isPar tOf applysT
nOf [tr ansitive ] isMe mbe r Of [tr ansitive ] [ ]
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 49
[tr ansitive ]
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 50
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 51
Ontologies are also semantic nets! They can also be formally represented with nets. The result: formally represented knowledge, that
Gruber (1993) defines ontology as
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 52
Individuals Classes Attributes R l ti Relations Restrictions Rules Axioms Axioms
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 53
We need STANDARDIZATION!
How to identify individuals How to describe individuals Common vocabularies Writing meaning
W3C’s semantic web activity standarize those
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 54
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 55
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 56
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 57
First specifications in 1998 It defines sctructure and syntax of XML documents
Also DTD (Document Type Definition) Also DTD (Document Type Definition)
Additional specifications:
Namespaces Stylesheet linking
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 58
<Element> Content </Element> <emptyElement></emptyElement> <emptyElement /> <emptyElement / >
First or main element in document is called root First or main element in document is called root
Be aware of proper nesting of elements!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 59
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 60
Inside elements, there can be multiple name = “value”
There can be 0, 1 or more attributes per element
Predefined attributes: xml:lang – default en-US xml:space – prevent or not trimming of the element’s
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 61
Every XML document should be well formed! Sintacticly valid Sintacticly valid Valid with DTD or Schema (if presented) Be aware: One and only one root element Proper names of the elements Proper nestings Case sensitive! Case sensitive! Attribute values inside quote-marks DTD, Schema!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 62
Good start:
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 63
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 64
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 65
" " <?xml version="1.0"?> <people xmlns:p=“http://www.example.com/People” xmlns:c=“http://www.example.com/Countries” > xmlns:c http://www.example.com/Countries <person id=“1”> <p:name>Luka</p:name> <livesIn> <country> < >Sl i </ > <c:name>Slovenia</c:name> </country> </livesIn> / </person> </people>
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 66
Rules for XML content Simple and complex elements, restrictions
Datatypes, we can specify our own datatypes C
Cardinality Sets,...
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 67
<? l i "1 0" di "UTF 8"?> <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/NewXMLSchema" xmlns:tns="http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> < l T "P "> <complexType name="Person"> <sequence> <element name="name" type="string"></element> <element name="livesIn" type="tns:Country"></element> </ > </sequence> </complexType> <complexType name="Country"> <sequence> < l t " " t " t i "></ l t> <element name="name" type="string"></element> </sequence> </complexType> <complexType name="PeopleType"> < i O ="1" O =" b d d"> <sequence minOccurs="1" maxOccurs="unbounded"> <element name="Person" type="tns:Person" /> </sequence> </complexType> < l t ="P l " t ="t P l T "></ l t> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 68 <element name= People type= tns:PeopleType ></element> </schema>
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#"
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 69
RDF – XML documents, valid with RDF namespace! RDF enables us to write semantic nets! Concepts, relations… are identified with URIs! Concepts, relations… are identified with URIs!
You can state “anything” about “everything” – it’s an
you have to integrate the data to use it wisely
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 70
Identifiers: URI Triples: RDF=XML
Ontologies: RDF Schema=RDF about classes,
Ontologies: OWL=RDF Schema+++
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 71
Subject Predicate Object URI URI URI/literal This is how we build nets!
Has name
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 72
created
created
Is described in
Has name
Has name
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 73
created
RESOURCE
Is described in
PROPERTY
Has name Has name
VALUE
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 74
A set of RDF triples is called a RDF NET More options on storage:
N-Triples Turtle Turtle XML/RDF
XML is recomended
RDF in XML is usually called RDF document
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 75
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description>
Root element: <rdf:RDF>
</rdf:RDF>
Root element: <rdf:RDF>
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 76
<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> Namespaces:
xmlns:rdf specifies that we use in rdf elements from
"http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:book specifies, that we use in book elements from
"http://semweb.linz/book/”
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 77
<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> Base namespace: xml:base means that every identifier is from namespace
"http://semweb.linz/”
Remember: identifiers are URI!!! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 78
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description>
Element <rdf:Description> stands for RDF
</rdf:RDF>
Element <rdf:Description> stands for RDF
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 79
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" p xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description> Predicates: <book:author>, <book:title> in </rdf:RDF> Predicates: <book:author>, <book:title> in
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 80
<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> This document states 3 triples:
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 81
Author created Story is described in Has name Book Arthur Clarke . . . <rdf:Description rdf:about="Author"> <publ:hasName>Artur C. Clarke</publ:hasName> <publ:created> 2001: A Space has name <rdf:Description rdf:about=“Story"> <publ:isDescribedIn> <rdf:Description rdf:about=“Book"> <publ:hasName>2001: A Space Odyssey</publ:hasName> Odyssey p p y y p </rdf:Description> </ publ:isDescribedIn > </rdf:Description> </publ:created> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 82 </publ:created> </rdf:Description> . . .
Element <rdf:Bag> Element <rdf:Seq>
Element <rdf:Alt>
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 83
Common syntax - OK Common semantics (classes, relationship types…)
RDFS OWL OWL
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 84
RDF shema (RDFS) enables simple ontologies We can use it primarly for taxonomies
Classes Inheritance
Relations (simple ones)
W3C specification
RDFS WAS a recomentation, todays choice is OWL… …but: OWL still includes some RDFS elements!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 85
Set of predefined predicates:
class property subClassOf
subPropertyOf domain range range …
with predefined semantics! with predefined semantics! standardized in 2004
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 86
vocabulary for classes:
rdfs:Class (a resource is a class) rdf:type (a resource is an instance of a class) rdfs:subClassOf (a resource is a subclass of another
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 87
vocabulary for properties:
rdfs:Property (a resource is a property) rdfs:domain (denotes the first component of a property) rdfs:range (denotes the second component of a
rdfs:subPropertyOf (expresses ISA between properties) rdfs:subPropertyOf (expresses ISA between properties)
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 88
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 89
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 90
<?xml version="1.0"?> 1
Ontology is RDF d t
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://semweb.linz/people"> 2
Ontology (taxonomy) namespace RDF document, rdf:RDF
<rdfs:Class rdf:ID=“Student"> <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class>
Defines a class #Person is actually
http://semweb.linz/people #Person
3 4 <rdfs:Class rdf:ID=“Employee"> <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class> ... </rdf:RDF> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 91
Element <rdfs:Class> is used to define a class rdf:ID class name Content are class relations
All relations are connected with logical AND All relations are connected with logical AND
<rdfs:Class rdf:ID=“Employee"> Class name <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class> AND
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 92
Hierarchy of classes One can also define multiple occurances of subClassOf! 0: = subClassOf rdfs:Resource 1: we defined super-class M
lti l i h it !
Many: multiple inheritance! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 93
Defining relations (predicates, properties…) rdf:ID – name of relation Content:
Domain: which class does it apply to Domain: which class does it apply to Range: Possible value
Property name <rdf:Property rdf:ID=“friendOf"> <rdfs:domain rdf:resource="#Strudent"/> Property name AND <rdfs:range rdf:resource="#Student"/> </rdf:Property> AND
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 94
Domain is only object type! (URI) Range can either be data or object type! There can also be many occurances of rdfs:range/rdfs:domain 0: Not specified; any 1: specified range type Multiple: value has to be valid to ALL occurances! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 95
Use it when
You need to define
Taxonomies Properties
Y
You need simple infering (e.g. inheritance)
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 96
problems with meta-data:
(#a rdf:type #C) (#C rdf:type #R) (#R rdf:type #a)
(#C df t
(#C rdf:type #C)
are correct (formally meaningful) RDF statements but no intuitive semantics!!!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 97
SPARQL = RDF query language http://www.w3.org/TR/rdf-sparql-query/
You need its implementation in order to use it (e.g.
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 98
Semantic net:
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 99
Search for: “Blog URL from author with name Jon
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?url FROM <http://on-the.net/bloggers.rdf> p // / gg WHERE { ?author foaf:name “Jon Foobar” . ?author foaf:weblog ?url ?author foaf:weblog ?url . }
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 100
PREFIX - “namespace” alias SELECT – set of variables to query FROM – sources, in some implementations optional WHERE - conditions ?author foaf:name “Jon Foobar” – all “Jon Foobar”
authors
?avtor foaf:weblog ?url
all authors URLs
?avtor foaf:weblog ?url – all authors URLs
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?url FROM <http://on-the.net/bloggers.rdf> WHERE { ?author foaf:name “Jon Foobar” .
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 101
?author foaf:weblog ?url . }
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?ime ?slika WHERE { WHERE { ?author foaf:name ?name . OPTIONAL { ? th f f d i ti ?i ?author foaf:depiction ?image . } . }
name | image
Marjan Heričko | <http://lisa.uni-mb.si/images/osebje/MarjanHericko.jpg> Luka Pavlič | Tatjana Welzer | <http://lisa.uni-mb.si/images/osebje/TatjanaWelzer.jpg>
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 102
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?ime ?email WHERE { WHERE { ?author foaf:name ?name . { { ? th f f b ? il } UNION { ?author foaf:mbox ?email } UNION { ?author foaf:mbox_sha1sum ?email } } }
name | email
| <mailto:marjan.hericko@uni-mb.si> Vili Podgorelec | “92ab30f82de1ecea9c32ae033fd3fc9cd9b44308” Luka Pavlič | <mailto:luka.pavlic@uni-mb.si>
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 103
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?authorfoaf:name ?name. FILTER regex(?name, “v”, “i”) FILTER regex(?name, v , i ) }
name
Luka Pavlič
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 104
PREFIX foaf <http // mlns com/foaf/0 1/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX info: <http://somewhere/peopleInfo#> SELECT ?name ?age WHERE { ?author foaf:name ?name. ?author info:age ?age. FILTER (?age>= 18) }
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 105
Sorting
ORDER BY LIMIT – only specified number of results OFFSET – where to start when returning results
CONSTRUCT, DESCRIBE –build RDF from results
ASK – returns true if there is a result from SPARQL
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 106
We use Jena framework Module ARQ – ”query engine”
Packake com.hp.hpl.jena.query Use class QueryFactory Use class QueryFactory Simple constructing, executing and itarating trough
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 107
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 108
PREFIX PREFIX abc: <http://mynamespace.com/exampleOntology#> SELECT ?capital ?country WHERE { WHERE {
?x abc:cityname ?capital. ?y abc:countryname ?country. ?x abc:isCapitalOf ?y.
?y abc:isInContinent abc:africa. }
Variables are outlined through the "?" prefix ("$" is also possible). Variables are outlined through the ? prefix ( $ is also possible). The ?capital and the ?country will be returned. The SPARQL query processor returns all hits matching the pattern
f h f RDF l
"property orientation" (class matches can be conducted solely
through class attributes/properties)
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 109
g /p p )
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 110
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 111
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 112
Create model. * Write model. * Use model. * T
Try some queries. *
*see code examples and comments!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 113
Open so rce librar Open-source library http://jena.sourceforge.net/ http://www.hpl.hp.com/semweb/
HP Labs Semantic Web Research Supports: RDF, RDFS, OWL, SPARQL, RDQL, N3,
Functionalities: RDF API OWL API OWL API Read and wrte of RDF in RDF/XML, N3 and N-Triples Managing persistent nets
RDQL RDF l
RDQL – RDF query language It can be easily extended – see example code! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 114
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 115
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 116
DAML OIL RDF(S) DAML+OIL DAML = DARPA Agent Markup Language OIL = Ontology Inference Layer
OWL versions:
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 117
RDFS:
range domain subPropertyOf
They are valid in OWL also! Additives!
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 118
Properties can be of multiple types
Symetrical: A r B ⇒ B r A Transitive: A r B and B r C ⇒ A r C Functional
Only one property value per instance
Inverse: A r B ⇒ B r’ A Inverse: A r B ⇒ B r A Inverse functional
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 119
Luka Pavlič (luka.pavlic@uni-mb.si) University of Maribor, Faculty of Electrical Engineering and Computer Science
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 120
You will be graded:
50% written test (Nov. 5th 2010) 50% project work (inovativness will be graded better!)
You have to select a project BEFORE you start You have to select a project BEFORE you start
Send documentation and code to
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 122
Documentation:
Name, surname, email Title Short abstract: what is your project about, what is
Code: Code:
RDF, RDFS, OWL documents J
Java code / web pages / demo / …
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 123
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 124
Create ontology about musicians, use data from
Use DBPedia services (http://dbpedia.org) in your
Prepare ontology, supporting knowledge of your
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 125
Prepare ontology about People and their behaviour.
Capture data from your favorite social network
Create ontology on courses, in your study programme.
You can also propose a project – be innovative ;)
Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 126