Title: This material was developed with financial help of the WUSA fund of Austria.
1This material was developed with financial help
of the WUSA fund of Austria.
2Semantic Web
Content
- XML (eXtended Markup Language)
- RDF (Resource Description Framework)
- OWL (Ontology Web Language)
3Markup Languages
4History of Markup Languages
- text based software applications requirement
The text contained within the documents were
marked up using textual commands, explaining
how to print the document.
- development of GML (Generalized Markup Language)
Integrated text editing
Formatting and information retrieval
Separated formatting from the documents text
5History of Markup Languages
- development of SGML (Standard GML)
Text description language (structure and content)
International standard in 1986
Base for other markup languages (HTML, XML)
- development of XML (eXtended Markup Language)
Data description language (structure)
Enables data exchange on a global basis
6History of Markup Languages
OWL
RDF
XML
HTML
SGML
1990
2000
2010
1970
7Parts of SGML Document
specifies which characters and delimiters may
appear
- DTD (Document Type Definition)
syntax of markup constructs
document elements
element hierarchy
possible sequence of tags
required number of element occurrences
describes the semantic to be ascribed to the
markup
contain data and markup
contain a reference to the DTD to be used for
interpretation
8Pieces of Electronic Document
9Markup Language Pyramid
? Semanticsreasoning
? Relational Data
? Data Exchange
10The Relationship between SGML, HTML and XML
complete document language
can define other markup languages
subset of SGML
work with Web data
also can define other markup languages
display data
specific DTD of SGML
11Developing Semantic Web
- XML enables data exchange but says nothing about
meaning
- Goal is to provide reasoning rules
- Development roadmap, stepping stone
knowledge representation
Inference
ontology
search
12Ontology
Programs have to know that two terms have the
same meaning. Solution is collection of
information called ontology.
- Ontology document that defines the relations
between terms.
Ontologylttaxonomy, inference rulesgt Taxonomyltcl
asses,relationsgt
Example If a city code is associated with a
state code, and an address uses that city code,
than that address has the associated state
code. A program could deduce, that an ETF
address, being in Belgrade, must be in Serbia
which is in the SCG and therefore should be
formatted to SCG standards.
13Family of XML Markup Languages
14XML Introduction
- designed to describe data
Someone must write a piece of software to send,
receive or display it.
- cross-platform, software and hardware independent
ltnotegt lttogtTomalt/togt ltfromgtSuzanalt/fromgt
ltheadinggtReminderlt/headinggt ltbodygtDon't
forget me this weekend!lt/bodygt lt/notegt
15XML Introduction
not predefined
case-sensitive
properly nested hierarchy (without overlapping)
- XML can separate data from HTML
- Mayor portions of the XML document (six
ingredients)
1. XML Declaration (required)
2. Document Type Definition (or XML Schema)
3. Elements (required)
4. Attributes
5. Entity
6. Notations
16Namespaces and URIs
- namespaces provide a method to avoid element
name - conflicts
xmlnsnamespace-prefix"namespaceURI"
- URI (Uniform Resource Identifier) is a string of
characters - which identifies Internet Resource.
URI ensure that concepts are not just words in a
document, but are tied to a unique definition
that everyone can find on the Web.
lthtable xmlnsh"http//www.w3.org/TR/html4/"gt
lthtrgt lthtdgtAppleslt/htdgt
lthtdgtBananaslt/htdgt lt/htrgt lt/htablegt
- using a default namespace
lttable xmlns"http//www.w3.org/TR/html4/"gt
lttrgt lttdgtAppleslt/tdgt lttdgtBananaslt/tdgt
lt/trgt lt/tablegt
171 XML Declaration
lt?xml version1.0 encoding ISO-8859-1?gt ltnote
gt lttogtTomalt/togt ltfromgtSuzanalt/fromgt
ltheadinggtReminderlt/headinggt ltbodygtDon't
forget me this weekend!lt/bodygt lt/notegt
- announcement to XML processor that
- the document is marked up in XML
182 Document Type Definition (DTD)
- structural description of the XML document
- used for validating XML document
Referring to a DTD is a request that the parser
compare the document instance to a document
model.
- defines a legal building blocks of XML document
lt?xml version1.0 encoding ISO-8859-1?gt lt!DOC
TYPE note SYSTEM "note.dtd"gt ... (internal
definition)
or (for internal DTD) lt!DOCTYPE root_element
element_declarationgt
192 Internal DTD, Example
lt?xml version"1.0"?gt lt!DOCTYPE note
lt!ELEMENT note (to,from,heading,body)gt
lt!ELEMENT to (PCDATA)gt lt!ELEMENT from
(PCDATA)gt lt!ELEMENT heading (PCDATA)gt
lt!ELEMENT body (PCDATA)gt gt ltnotegt
lttogtTomalt/togt ltfromgtSuzanalt/fromgt
ltheadinggtReminderlt/headinggt ltbodygtDon't
forget me this weekendlt/bodygt lt/notegt
202 External DTD, Example
lt?xml version"1.0"?gt lt!DOCTYPE note SYSTEM
"note.dtd"gt ltnotegt lttogtTomalt/togt
ltfromgtSuzanalt/fromgt ltheadinggtReminderlt/heading
gt ltbodygtDon't forget me this weekendlt/bodygt
lt/notegt
lt!- note.dtd --gt lt!ELEMENT note
(to,from,heading,body)gt lt!ELEMENT to (PCDATA)gt
lt!ELEMENT from (PCDATA)gt lt!ELEMENT heading
(PCDATA)gt lt!ELEMENT body (PCDATA)gt
212 XML Schema Definition (XSD)
lt!- note.xsd --gt lt?xml version"1.0"?gt
ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSc
hema" targetNamespace"http//www.w3schools.co
m" xmlnshttp//www.w3schools.comgt
ltxselement name"note"gt ltxscomplexTypegt
ltxssequencegt ltxselement name"to"
type"xsstring"/gt ltxselement
name"from" type"xsstring"/gt
ltxselement name"heading" type"xsstring"/gt
ltxselement name"body"
type"xsstring"/gt lt/xssequencegt
lt/xscomplexTypegt lt/xselementgt lt/xsschemagt
elements defined in note.xsd came from
w3schools
Complex element (have attributes or other
elements)
default namespace
decimal, integer, boolean, date, time
Simple elements (contain only text)
222 XML Schema Definition (XSD)
- XML document has a reference to an XML schema
lt?xml version"1.0"?gt ltnote xmlns"http//www.w3
schools.com" xmlnsxsi"http//www.w3.org/2001/XML
Schema-instance" xsischemaLocation"http//www.w3
schools.com note.xsd"gt lttogtTovelt/togt
ltfromgtJanilt/fromgt ltheadinggtReminderlt/headinggt
ltbodygtDon't forget me this weekend!lt/bodygt
lt/notegt
232 XML Schema Restrictions
ltxselement name"password"gt ltxssimpleTypegt
ltxsrestriction base"xsstring"gt
ltxspattern value"a-zA-Z0-98"/gt
lt/xsrestrictiongt lt/xssimpleTypegt lt/xselement
gt
ltxselement name"age"gt ltxssimpleTypegt
ltxsrestriction base"xsinteger"gt
ltxsminInclusive value"0"/gt
ltxsmaxInclusive value"100"/gt
lt/xsrestrictiongt lt/xssimpleTypegt lt/xselement
gt
- restrictions on a set of values
- restrictions on a series of values
243 XML Elements
- building blocks of a document
- nested hierarchy (parent children relation)
- names must not start with xml, XML
4 XML Attributes
- can be used to give an element a unique ID
ltnotegt ltdategt ltdaygt12lt/daygt
ltmonthgt11lt/monthgt ltyeargt2002lt/yeargt
lt/dategt lttogtTomalt/togt ltfromgtSuzanalt/fromgt
ltheadinggtReminderlt/headinggt ltbodygtDon't
forget me this weekend!lt/bodygt lt/notegt
ltnote date"12/11/2002" to"Toma" fromSuzana"
heading"Reminder" body"Don't forget me this
weekend!"gt lt/notegt
ltnote day"12" month"11" year"2002" to"Toma"
fromSuzana" heading"Reminder" body"Don't
forget me this weekend!"gt lt/notegt
25XML Family Tree
XML Validation Languages
XML Location Languages
DTD
XML Schema
DOM
SAX
XPATH
XPOINTER XLINK
XML Display Languages
XML Web Services Languages
XSL
XSLT
XSL-FO
SOAP
WSDL
UDDI
26Resource Description Framework (RDF)
27(No Transcript)
28- XML -gt RDF provide extra machine understandable
layer
Property
Resource
Value
Predicate
Subject
Object
has the title
The book
War and Peace
lt?xml version1.0?gt ltrdfRDF
xmlnsrdfhttp//www.w3.org/1999/02/22-rdf-syntax
-ns xmlnsdchttp//purl.org/dc/elements/1.1/
gt ltrdfDescription rdfabouthttp//www.ama
zon.com/booksgt ltdctitlegtWar and
Peacelt/dctitlegt ltrdfDescriptiongt lt/rdfRDFgt
Predicate
Subject
Object
29"there is a Person identified by
http//www.w3.org/ People/EM/contactme, whose
name is Eric Miller, whose email address is
em_at_w3.org, and whose title is Dr."
30Four important facts about RDF triplets
1. Each RDF triple is made up of S, P, O.
2. Each RDF triple is complete and unique fact.
3. Subject is uri reference or blank node
(represent a resource that isnt currently
identified). Predicate is uriref. Object
is uri reference, blank node or literal.
4. Each RDF triple can be joined to other RDF
triples, but still retains its own unique
meaning, regardless of complexity.
31Container Vocabulary
ltrdfBaggt
used to describe a list of values that is
intended to be unordered.
ltrdfSeqgt
used to describe a list of values that is
intended to be ordered (For example, in
alphabetical order)
ltrdfAltgt
used to describe a list of alternative values
(the user can select only one of the values).
32ltrdfBaggt example
lt?xml version"1.0"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnscd"http//www.recshop.fake/cd"gt
ltrdfDescription rdfabout"http//www.recshop
.fake/cd/Beatles"gt ltcdartistgt
ltrdfBaggt ltrdfligtJohnlt/rdfligt
ltrdfligtPaullt/rdfligt ltrdfligtGeorgelt/rdfligt
ltrdfligtRingolt/rdfligt lt/rdfBaggt
lt/cdartistgt lt/rdfDescriptiongt lt/rdfRDFgt
33"Course 6.001 has the students Amy, Mohamed,
Johann, Maria, and Phuong" ltrdfBaggt example
34ltrdfAltgt example
lt?xml version"1.0"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnscd"http//www.recshop.fake/cd"gt
ltrdfDescription rdfabout"http//www.recsh
op.fake/cd/Beatles"gt ltcdformatgt
ltrdfAltgt ltrdfligtCDlt/rdfligt
ltrdfligtRecordlt/rdfligt
ltrdfligtTapelt/rdfligt lt/rdfAltgt
lt/cdformatgt lt/rdfDescriptiongt lt/rdfRDFgt
35Serialization (RDF in XML)
- RDF/XML is used for transporting, interchange,
collection - and merging of data from multiple models
- RDF/XML parsers does not use DTD or XML Schema
- to ensure that RDF/XML is valid
- There is no way to stop many individuals from
- independently assigning URIs to represent
There could be many resources that represent the
same tree ! ! ! ! ! !
36RDF Schema
- focused on defining taxonomies (class hierarchy)
- can express classes and their relations
(subClassOf)
- defines properties and associate them with
classes
- Three most important RDF concepts
rdfsResource
rdfsClass
rdfProperty
37RDF Schema Class Example
lt?xml version"1.0"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.org/2000/01/r
df-schema" xmlbase"http//example.org/schema
s/vehicles"gt ... ltrdfsClass rdfID"MiniVan"gt
ltrdfssubClassOf rdfresource"Van"/gt
ltrdfssubClassOf rdfresource"PassengerVehicle"/
gt lt/rdfsClassgt lt/rdfRDFgt
38RDF Schema Property Example
ltrdfProperty rdfID"registeredTo"gt
ltrdfsdomain rdfresource"MotorVehicle"/gt
ltrdfsrange rdfresource"Person"/gt
lt/rdfPropertygt ltrdfProperty
rdfID"rearSeatLegRoom"gt ltrdfsdomain
rdfresource"PassengerVehicle"/gt ltrdfsrange
rdfresource"xsdinteger"/gt lt/rdfPropertygt
The registeredTo property applies to any
MotorVehicle and its value is a Person
39RDF Schema Instance Example
lt?xml version"1.0"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsex"http//example.org/schemas/vehi
cles" xmlbase"http//example.org/things"gt
ltexPassengerVehicle rdfID"johnSmithsCar"gt
ltexregisteredTo rdfresource"http//www.example
.org/staffid/85740 /gt ltexrearSeatLegRoom
rdfdatatype"xsdinteger"gt127lt/exrearSeatLegRo
omgt lt/exPassengerVehiclegt lt/rdfRDFgt
Person type
Instance is described in a separate document from
the schema.
40Web Ontology Language (OWL)
41"Tell me what wines I should buy to serve with
each course of the following menu. And, by the
way, I don't like Sauternes."
- we must go beyond keywords and specify the
meaning
OWL is not a message format. It is a knowledge
representation.
- provides three sublanguages
42OWL Sublanguages
classification hierarchy
simple constraint features
- OWL DL (Description Logic)
maximum expressiveness and decidability of
reasoning system
restrictions such as type separation (a class can
not also be an individual or property, a
property can not also be an individual or class)
syntactic freedom of RDF
(class can be treated simultaneously as a
collection of individuals and as an
individual in its own right)
43Ontology Headers
ltrdfRDF xmlnsowl "http//www.w3.org/2002/07/ow
l" xmlnsrdf "http//www.w3.org/1999/02/22-rdf-
syntax-ns" xmlnsrdfs"http//www.w3.org/2000/01/
rdf-schema" xmlnsxsd http//www.w3.org/2001/XM
LSchema xmlnsvin "http//www.w3.org/TR/2004/REC
-owl-guide- 20040210/wine xmlnsfood"http
//www.w3.org/TR/2004/REC-owl-guide-
20040210/food"gt ltowlOntology rdfabout""gt
ltrdfscommentgtAn example OWL ontologylt/rdfscommen
tgt ltowlpriorVersion rdfresource
"http//www.w3.org/TR/2003/PR-owl-guide-20031215/w
ine"/gt ltowlimports rdfresource
"http//www.w3.org/TR/2004/REC-owl-guide-20040210/
food"/gt ltrdfslabelgtWine Ontologylt/rdfslabelgt
...
Importing another ontology brings the entire set
of assertions provided by that ontology into the
current ontology
44Classes
Each user-defined class is implicitly a subclass
of owlThing.
ltowlClass rdfID"Winery"/gt ltowlClass
rdfID"Region"/gt ltowlClass rdfID"ConsumableTh
ing"/gt
Within this document, the Region class can now be
referred to using Region, e.g.
rdfresource"Region"
ltowlClass rdfID"Wine"gt ltrdfssubClassOf
rdfresource"foodPotableLiquid"/gt
ltrdfslabel xmllang"en"gtwinelt/rdfslabelgt
ltrdfslabel xmllang"fr"gtvinlt/rdfslabelgt ...
lt/owlClassgt ltowlClass rdfID"Pasta"gt
ltrdfssubClassOf rdfresource"EdibleThing" /gt
... lt/owlClassgt
45Individuals
ltRegion rdfID"CentralCoastRegion" /gt
Identical in the meaning to the example below
ltowlThing rdfID"CentralCoastRegion" /gt
ltowlThing rdfabout"CentralCoastRegion"gt
ltrdftype rdfresource"Region"/gt lt/owlThinggt
rdftype is an RDF property that ties an
individual to a class of which it is a member
46Properties
- DATATYPE PROPERTIES, relations between instances
of classes and RDF literals and XML Schema
datatypes
ltowlClass rdfID"VintageYear" /gt
ltowlDatatypeProperty rdfID"yearValue"gt
ltrdfsdomain rdfresource"VintageYear" /gt
ltrdfsrange rdfresource"xsdpositiveInteger"/gt
lt/owlDatatypePropertygt
- OBJECT PROPERTIES, relations between instances
of two classes
ltowlObjectProperty rdfID"locatedIn"gt
ltrdfsdomain rdfresource"http//www.w3.or
g/2002/07/owlThing" /gt ltrdfsrange
rdfresource"Region" /gt lt/owlObjectPropertygt
47Properties of Individuals
ltRegion rdfID"SantaCruzMountainsRegion"gt
ltlocatedIn rdfresource"CaliforniaRegion" /gt
lt/Regiongt
- locatedIn is object property defined for Region
instances
ltVintageYear rdfID"Year1998"gt ltyearValue
rdfdatatype"xsdpositiveInteger"gt 1998
lt/yearValuegt lt/VintageYeargt
- yearValue is datatype property defined for
VintageYear - instances
48Property Characteristics
1. Transitive property
P(x,y) and P(y,z) implies P(x,z)
locatedIn is transitive property
ltowlObjectProperty rdfID"locatedIn"gt
ltrdftype rdfresource"owlTransitiveProperty"
/gt ltrdfsdomain rdfresource"owlThing" /gt
ltrdfsrange rdfresource"Region" /gt
lt/owlObjectPropertygt ltRegion
rdfID"SantaCruzMountainsRegion"gt ltlocatedIn
rdfresource"CaliforniaRegion" /gt lt/Regiongt
ltRegion rdfID"CaliforniaRegion"gt
ltlocatedIn rdfresource"USRegion" /gt lt/Regiongt
49Property Characteristics
2. Symmetric Property
P(x,y) iff P(y,x)
adjacentRegion is symmetric property
ltowlObjectProperty rdfID"adjacentRegion"gt
ltrdftype rdfresource"owlSymmetricProperty"
/gt ltrdfsdomain rdfresource"Region" /gt
ltrdfsrange rdfresource"Region" /gt
lt/owlObjectPropertygt ltRegion
rdfIDSumadijaRegion"gt ltlocatedIn
rdfresource"SerbiaRegion" /gt
ltadjacentRegion rdfresource"PomoravljeRegion"
/gt lt/Regiongt
50Property Characteristics
3. Functional Property
P(x,y) and P(x,z) implies yz
hasVintageYear is functional property
ltowlClass rdfID"VintageYear" /gt
ltowlObjectProperty rdfID"hasVintageYear"gt
ltrdftype rdfresource"owlFunctionalProperty"
/gt ltrdfsdomain rdfresource"Vintage" /gt
ltrdfsrange rdfresource"VintageYear" /gt
lt/owlObjectPropertygt
One individual of Vintage must have strictly one
value of VintageYear.
51Property Characteristics
4. InverseOf Property
P(x,y) iff P(y,x)
ltowlObjectProperty rdfID"hasMaker"gt
ltrdftype rdfresource"owlFunctionalProperty"
/gt lt/owlObjectPropertygt ltowlObjectProperty
rdfID"producesWine"gt ltowlinverseOf
rdfresource"hasMaker" /gt lt/owlObjectPropertygt
52Ontology Mapping
- hardest part of ontology
- development
- tool support is necessary
- Some important OWL primitives
equivalentClass, equivalentProperty,
sameAs, differentFrom, AllDifferent
53Equivalent Classes and Properties
- combined ontologies must not be
- contradictory
- entailments from two ontologies
- are combined
ltowlClass rdfIDo1caffe"gt ltowlequivalentCla
ss rdfresourceo2bar"/gt lt/owlClassgt
indicate that two classes have precisely the same
instances
To tie together properties in a similar fashion,
we use owlequivalentProperty.
We can use owlsameAs between two classes to
indicate that they are identical in every way (in
OWL Full), treating them as individuals.
54Identity between Individuals
- sameAs declaring two individuals to be the same
ltWine rdfID"MikesFavoriteWine"gt ltowlsameAs
rdfresource"StGenevieveTexasWhite" /gt lt/Winegt
- differentFrom opposite to sameAs
ltWineSugar rdfID"Dry" /gt ltWineSugar
rdfID"Sweet"gt ltowldifferentFrom
rdfresource"Dry"/gt lt/WineSugargt ltWineSugar
rdfID"OffDry"gt ltowldifferentFrom
rdfresource"Dry"/gt ltowldifferentFrom
rdfresource"Sweet"/gt lt/WineSugargt
If we erred, and asserted that a wine was both
Dry and Sweet, without the differentFrom elements
above, this would imply that Dry and Sweet are
identical contradiction.
55Set Operators
required element
ltowlClass rdfID"WhiteWine"gt
ltowlintersectionOf rdfparseType"Collection"gt
ltowlClass rdfabout"Wine" /gt
ltowlRestrictiongt ltowlonProperty
rdfresource"hasColor" /gt ltowlhasValue
rdfresource"White" /gt lt/owlRestrictiongt
lt/owlintersectionOfgt lt/owlClassgt
defining members of new class
includes both the extensions SweetFruit
NonSweetFruit
ltowlClass rdfID"Fruit"gt ltowlunionOf
rdfparseType"Collection"gt ltowlClass
rdfabout"SweetFruit" /gt ltowlClass
rdfabout"NonSweetFruit" /gt lt/owlunionOfgt
lt/owlClassgt
selects all individuals that do not belong to a
certain class
56OWL for Services (OWL-S)
57- Web Service is a software system identified by a
URI
- it uses public interfaces and bindings described
by Markup Language
- definition and function can be discovered by
other software systems
- software agents exchange information in the form
of messages - (Request Receive MEP Message Exchange
Pattern)
58OWL-S Primer
- OWL-S uses OWL to define a set of classes and
properties - specific to the description of a service
- OWL-S is designed to perform next tasks
Task Description
Discovery Locating Web Services.
Invocation Execution of service by an agent or other service.
Interoperation Breaking down interoperability barriers and automatic insertion of message parameter translations.
Composition New services through automatic selection, composition and interoperation of existing services.
Verification Verify service properties.
Execution monitoring Tracking the execution of composite tasks and identifying failure cases of different exe-traces.
59Upper Ontology for Services
- OWS-S define a set of classes and properties
specific to - the description of services.
Service
presents
supports
described by
ServiceModel
ServiceProfile
ServiceGrounding
What does the service provide for and require
of agents?
How does it work?
How to access to service?
60Creating Ontology for Web Service
1. Describe individual programs
Describe the individual programs that comprise
the service. The process model provides a
declarative description of a programs
properties.
2. Describe the grounding for each atomic process
3. Describe compositions of the atomic processes
Describe the composite process which is a
composition of its atomic processes
4. Describe a simple process for a service
(optional)
5. Profile description
Provide a declarative advertisement for the
service. It is partially populated by the process
model.
61Semantic Search
62Designing a Search Agent
1. Initialization
agent should setup all variables, structures, and
arrays, method of searching
2. Perception
centered on using the knowledge provided to
contact a site and retrieve the information from
that location. It should identify if the target
is present and identify paths to other URL
3. Action
determines if the goal has been met. If it is not
it has to determine the next step this is the
intelligence of the agent
4. Effect
63Search Algorithms
those that have no information about number of
steps or the path cost from the current state to
the goal breadth first, depth first
heuristic searches have the information about the
goal (estimated path cost to it or step away)
best-first, hill-climbing, A...
How much can we trust that search engine
understand what we want ? ?
64Using RDF and OWL for Search Engines
- ontologies are mapping semantically same things
- text categorization based on ontology mapping
Comparing each element of an ontology with each
element of the other ontology, and than
determines a similarity metric.
Example of similarity metric
Instance is randomly chosen from the universe
(A,B). P(A,B) is the probability that the
instance belongs to A and B...
- similarity with relational databases leads to a
global - semantic web database
65Related links
- http//www.w3schools.com/default.asp
The End