Semantic web is… Semantic web is… � …is all about METADATA i ll b t METADATA � Metadata = data about data! M t d t = d t b t d t ! � 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
Semantic web is… Semantic web is… � Web of Data � Giant Global Graph p � 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
Semantic web is… Semantic web is… WWW WWW: globally connected library of documents. l b ll d l b f d vs. Semantic web: globally connected database. � Machine should “understand” data: formal knowledge representation → semantics → semantic nets � We need applications that uses knowledge → (intelligent)(web) services. � Semantics + web + intelligent services → semantic web Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 38
Semantic web is… Semantic web is… According to the original vision, the availability of machine-readable metadata would enable automated agents and other software to access the Web more intelligently. Web more intelligently. Be aware: one can use semantic web even on closed enterprises! Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 39
When to use semantic web? When to use semantic web? � Describing/annotating human readable content, D ibi / t ti h d bl t t � Describing web services, � Describing web-based services, D ibi b b d i � EIA – data level integration, � Easier searching for KNOWLEDGE � Easier searching for KNOWLEDGE, � IS upgrade, � Knowledge integration in knowledge systems � Knowledge integration in knowledge systems Basically: Basically: IS Integration & knowledge management Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 40
Bussiness case Bussiness case Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 41
Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 42
Ontologies Ontologies � In semantic web, ontologies are used to define meaning. � To Annotate. � To enable infering � To enable infering. Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 43
Classification Classification Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 44
Classification approaches in KM* Classification approaches in KM � Difference between: � Contolled Vocabulary � Taxonomy � Thesaur � Ontology � Ontology � What is Folksonomy? Wh t i F lk ? * Knowledge Management Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 45
Example Example Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 46
Example Example Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 47
Example Example Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 48
Example Example Que stion hasAnswe r T e stCase Answe r answe r c ase Solution S l ti mayBe Alte r native T o applysT o Answe rRe le va nc e isR e late dT o applysT l T o isPar tOf isMe mbe r Of Pa tte r n Pa tte rnContaine r [tr [ ansitive ] ] isMe mbe r Of isSubPatte r nOf [tr ansitive ] [tr [tr ansitive ] ansitive ] Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 49
Example Example Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 50
Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 51
To sum up To sum up � Ontologies are also semantic nets! O � � They can also be formally represented with nets. � The result: formally represented knowledge, that y p g , can be used in intelligent processes e.g. infering! � Gruber (1993) defines ontology as a formal explicit specification of a shared a formal explicit specification of a shared conceptualization. Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 52
Basically, they consist of Basically, they consist of � Individuals � Classes � Attributes � R l ti � Relations � Restrictions � Rules � Axioms � Axioms Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 53
How to use them? How to use them? � We need STANDARDIZATION! � How to identify individuals � How to describe individuals � Common vocabularies � Writing meaning � W3C’s semantic web activity standarize those technologies! (URI, XML, RDF, OWL) Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 54
W3C standards W3C standards Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 55
W3C standards W3C standards Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 56
Let’s get to “real bussiness”! Let s get to real bussiness ! Talk is cheap Talk is cheap, show me the code! show me the code! XML, XML Schema, URI RDF, RDFS, OWL, SPARQL , S, OW , S Q Jena Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 57
(very) Short intro to <XML/> (very) Short intro to <XML/> � 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
XML document elements XML document elements � <Element> Content </Element> C / � <emptyElement></emptyElement> � <emptyElement /> <emptyElement / > p y / p y / � First or main element in document is called root � First or main element in document is called root element � Be aware of proper nesting of elements! Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 59
Example – nestings Example nestings <person> <name>Luka</name> <surname>Pavlic</surname> P li / </person> <!-- improper nesting: --> <person> <name>Luka</name> <surname>Pavlic</person> </surname> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 60
Attributes Attributes � Inside elements, there can be multiple name = “value” d l h b l l “ l ” e.g. attributes � There can be 0, 1 or more attributes per element Th b 0 1 ib l <Person id=“12”>…</Person> / � Predefined attributes: � xml:lang – default en-US � xml:space – prevent or not trimming of the element’s content Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 61
Well formed XML Well formed XML � Every XML document should be well formed! E XML d t h ld b ll f d! � 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
More info on XML More info on XML � Good start: htt // http://www.w3schools.com/xml/default.asp 3 h l / l/d f lt http://www.w3.org/XML/ Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 63
Another example Another example <?xml version="1.0"?> <people> <person id=“1”> <name>Luka</name> <livesIn> <country> <name>Slovenia</name> </country> </livesIn> </person> </people> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 64
Another example Another example <?xml version="1.0"?> <people> <person id=“1”> <name>Luka</name> A need for destinguishing! A need for destinguishing! <livesIn> � namespaces <country> <name>Slovenia</name> </country> </livesIn> </person> </people> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 65
Another example Another example <?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> < <c:name>Slovenia</c:name> >Sl i </ > </country> </livesIn> / </person> </people> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 66
Namespaces – XML Schemas Namespaces XML Schemas � Rules for XML content � Simple and complex elements, restrictions p p , � Datatypes, we can specify our own datatypes � C � Cardinality di lit � Sets,... Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 67
Example Example <?xml version= "1.0" encoding="UTF-8"?> <? l i "1 0" di "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"> < <complexType name= "Person"> l T "P "> <sequence> <element name= "name" type="string"></element> <element name= "livesIn" type="tns:Country"></element> </ </sequence> > </complexType> <complexType name= "Country"> <sequence> <element name= "name" type="string"></element> < l t " " t " t i "></ l t> </sequence> </complexType> <complexType name= "PeopleType"> < <sequence minOccurs= "1" maxOccurs="unbounded"> i O = "1" O =" b d d"> <element name= "Person" type="tns:Person" /> </sequence> </complexType> < l <element name= People type= tns:PeopleType ></element> t = "P l " t ="t P l T "></ l t> </schema> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 68
Some “public” namespaces Some public namespaces � 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#" Good start for more info: http://www.w3schools.com/schema/default.asp p // / / p Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 69
Back to semantic web Back to semantic web � 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! e.g. http://www.something.com/someProject#someThing � You can state “anything” about “everything” – it’s an open session! i ! � � you have to integrate the data to use it wisely Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 70
Core Technologies Core Technologies � Identifiers: URI � Triples: RDF=XML p � Ontologies: RDF Schema=RDF about classes, inheritance inheritance… � Ontologies: OWL=RDF Schema+++ Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 71
RDF basics RDF basics � Subject � Predicate � Object � P � Ob S b d � URI � URI � URI/literal � This is how we build nets! subject j object bj predicate A th Author A h C Cl Arthur C. Clarke k Has name Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 72
RDF nets (1/2) RDF – nets (1/2) created created Author story Is described in story book 2001: A Space p Has name book b k Odyssey Has name Author Arthur Clarke Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 73
RDF nets (2/2) RDF – nets (2/2) RESOURCE created Author Story Is described in PROPERTY Has name book VALUE Has name Arthur Clarke Arthur Clarke 2001: A Space Odyssey Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 74
RDF storage RDF storage � A set of RDF triples is called a RDF NET � More options on storage: p g � N-Triples � Turtle � Turtle � XML/RDF � XML is recomended XML i d d � RDF in XML is usually called RDF document Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 75
RDF document (1/6) RDF document (1/6) <?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> </rdf:RDF> � Root element: <rdf:RDF> � Root element: <rdf:RDF> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 76
RDF document (2/6) RDF document (2/6) <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" l df "htt // 3 /1999/02/22 df t #" 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
RDF document (3/6) RDF document (3/6) <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" l df "htt // 3 /1999/02/22 df t #" 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
RDF document (4/6) RDF document (4/6) <?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> </rdf:RDF> � Element <rdf:Description> stands for RDF � Element <rdf:Description> stands for RDF triple about identifies speficied in rdf:about Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 79
RDF document (5/6) RDF document (5/6) <?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> </rdf:RDF> � Predicates: <book:author>, <book:title> in � Predicates: <book:author>, <book:title> in <book:genre> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 80
RDF document (6/6) RDF document (6/6) <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" l df "htt // 3 /1999/02/22 df t #" 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: http://semweb.linz/ID2001 http://semweb.linz/book#author “Arthur C. Clarke” � http://semweb.linz/ID2001 http://semweb.linz/book#title “2001: A Space Odyssey” � http://semweb.linz/ID2001 http://semweb.linz/book#genre “science fiction” � Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 81
RDF net – RDF document RDF net RDF document created Author Story Has name is described in Arthur Clarke Book . . . has name <rdf:Description rdf:about="Author"> <publ:hasName>Artur C. Clarke</publ:hasName> <publ:created> 2001: A Space <rdf:Description rdf:about=“Story"> Odyssey <publ:isDescribedIn> <rdf:Description rdf:about=“Book"> <publ:hasName>2001: A Space Odyssey</publ:hasName> p p y y p </rdf:Description> </ publ:isDescribedIn > </rdf:Description> </publ:created> </publ:created> </rdf:Description> . . . Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 82
RDF –container elements RDF container elements � Element <rdf:Bag> � Element <rdf:Seq> q � Element <rdf:Alt> Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 83
RDF “problems”? RDF problems ? � Common syntax - OK � Common semantics (classes, relationship types…) ( , p yp ) � RDFS � OWL � OWL Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 84
RDF shema RDF shema � RDF shema (RDFS) enables simple ontologies h ( S) bl l l � We can use it primarly for taxonomies � Classes � Inheritance � Relations (simple ones) R l ( l ) � W3C specification W3C ifi i http://www.w3.org/TR/rdf-schema/ � RDFS WAS a recomentation, todays choice is OWL… RDFS WAS t ti t d h i i OWL � …but: OWL still includes some RDFS elements! Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 85
RDF shema RDF shema � Set of predefined predicates: S f d f d d � class � property � subClassOf � subPropertyOf bP t Of � � domain � range � range � … � with predefined semantics! � with predefined semantics! � standardized in 2004 Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 86
RDFS: Specifying classes RDFS: Specifying classes � 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 ( resource) Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 87
RDFS: specifying properties RDFS: specifying properties � 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 g ( p property) � rdfs:subPropertyOf (expresses ISA between properties) � rdfs:subPropertyOf (expresses ISA between properties) Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 88
Example Example Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 89
RDFS Syntax RDFS Syntax Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 90
Class definition Class definition 1 Ontology is <?xml version="1.0"?> RDF d RDF document, t < rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" Ontology 2 rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" (taxonomy) xml:base="http://semweb.linz/people"> namespace < rdfs:Class rdf:ID=“Student"> Defines a class 3 <rdfs:subClassOf rdf:resource=" #Person "/> 4 #Person is actually </ rdfs:Class > http://semweb.linz/people #Person < rdfs:Class rdf:ID=“Employee"> <rdfs:subClassOf rdf:resource="# Person "/> </ rdfs:Class > ... </ rdf:RDF > Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 91
rdfs:Class rdfs:Class � 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 Class name < rdfs:Class rdf:ID=“Employee"> <rdfs:subClassOf rdf:resource=" #Person "/> AND </ rdfs:Class > Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 92
rdfs:subClassOf rdfs:subClassOf � Hierarchy of classes � One can also define multiple occurances of subClassOf! � 0 : = subClassOf rdfs:Resource � 1 : we defined super-class � M � Many : multiple inheritance! lti l i h it ! Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 93
rdf:Property rdf:Property � 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 Property name < rdf:Property rdf:ID=“friendOf"> < rdfs:domain rdf:resource ="#Strudent"/> AND AND < rdfs:range rdf:resource ="#Student"/> </ rdf:Property > Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 94
rdfs:range, rdfs:domain rdfs:range, rdfs:domain � 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
RDFS – easy and efficient RDFS easy and efficient � Use it when � You need to define � Taxonomies � Properties � Y � You need simple infering (e.g. inheritance) d i l i f i ( i h it ) Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 96
Be aware! Be aware! � problems with meta-data: � (#a rdf:type #C) � (#C rdf:type #R) � (#R rdf:type #a) ( yp ) or � (#C df t � (#C rdf:type #C) #C) � are correct (formally meaningful) RDF statements � but no intuitive semantics!!! Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 97
SPARQL SPARQL � SPARQL = RDF query language � http://www.w3.org/TR/rdf-sparql-query/ p // g/ / p q q y/ � You need its implementation in order to use it (e.g. Jena) Jena) Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 98
Example SPARQL query Example SPARQL query � Semantic net: Luka Pavli č : Semantic Web Technologies, JKU Linz, October 2010 99
Example SPARQL query Example SPARQL query � Search for: “Blog URL from author with name Jon Foobar!” 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
Recommend
More recommend