The Web Ontology Language & Ontologies

manyfarmswalkingInternet and Web Development

Oct 21, 2013 (3 years and 8 months ago)

87 views

 
The  Web  Ontology  Language  
&  
Ontologies  
 
Jochem  Liem  
Informa:cs  Ins:tute  
SIKS  Basic  Course:  Knowledge  Modeling
 
     
7/8  December  2010
 
Knowledge  Representa:on  


What  kind  of  AI  applica:on  would  you  
develop  if  you  could  use  the  knowledge  of  
Wikipedia?    


Or  even  the  knowledge  on  the  web?  


Strong  AI  (General  AI)  


Human-­‐like  Intelligence  


Common-­‐Sense  Reasoning  


Weak  AI  (Applied  AI)  


Natural  Language  Understanding  


Knowledge-­‐Based  Systems  (explana:ons)  


Medical  diagnosis  


Intelligent  Tutoring  Systems  
Seman:c  Web  Vision  


Web  of  Documents  -­‐>  
Web  of  Data  


Web  as  a  universal  
medium  for  data,  
informa:on,  and  
knowledge  exchange  


In  the  database  view:  
Don

t  just  publish  your  
data,  but  also  publish  
your  schema.  
The  Seman:c  Web  Vision  


Applica:ons:    


Improved  web  search  (e.g.  informa:on  retrieval)  


Business  to  Business  (shared  vocabulary)  


Personal  (mul:-­‐)agents  (shopping,  appointments)  


Natural  Language  Understanding  


Applica:ons  within  Science:  


Formalise  domain  knowledge  


Share  and  reuse  domain  knowledge  


Infer  new  knowledge  
Seman:c  Web  Layer  Cake  
XML  Schema  
Uniform  Resource  Iden:fier  (URI)  


String  on  characters  that  iden:fy  a  resource  
on  the  web.  


Consists  of:  


Protocol  (h\p://,  
ssh
://,  file://,  mailto://)  


Host  (
www.google.com
)  


Port  (:80)  


Path  (/
ig
/)  


Search  (?refresh=1)  


Fragment  (#Calendar)  
XML  Namespaces  


Namespaces  are  used  to  uniquely  iden:fy  named  
elements  and  a\ributes  in  an  XML  document.  


XML  can  contain  element  or  a\ribute  names  
from  more  than  one  XML  vocabulary.    


If  each  vocabulary  is  given  a  namespace  then  the  
ambiguity  between  iden:cally  named  elements  
or  a\ributes  can  be  resolved.  


h\p://www.w3.org/2001/XMLSchema#string  


xmlns:xsd
="h\p://www.w3.org/2001/
XMLSchema#"  


xsd:string
 
Linked  Data  


Data  interconnected  via  
URIs
 on  the  Web  


DBpedia
 -­‐  a  dataset  containing  extracted  data  from  Wikipedia;  it  
contains  about  2.18  million  concepts  described  by  218  million  triples,  
including  abstracts  in  11  different  languages  


DBLP  Bibliography  -­‐  provides  bibliographic  informa:on  about  scien:fic  
papers;  it  contains  about  800,000  ar:cles,  400,000  authors,  and  
approx.  15  million  triples  


GeoNames
 provides  RDF  descrip:ons  of  more  than  6,500,000  
geographical  features  worldwide.  


Revyu
 -­‐  a  Review  service  consumes  and  publishes  Linked  Data,  
primarily  from  
Dbpedia
.  


US  Census  data  (2000)  –  geographic  informa:on,  popula:on  counts,  
counts  by  age,  sex,  and  race,  informa:on  on  commu:ng  :me  to  work,  
mean  income,  la:tude  and  longitude  of  the  region    (6.4  billion  triples)  
Examples  of  large  triple  stores  (10
9
 triples)    
h\p://esw.w3.org/LargeTripleStores  
Seman:c  Web  Layer  Cake  
XML  Schema  
eXtensible
 Markup  Language  (XML)  


Rules  to  encode  documents  


Unicode  Support  (support  for  all  languages)  


APIs  available  in  almost  all  programming  
languages  


Notable  examples:  RSS,  Atom,  SOAP,  XHTML,  
(Microsoo)  Office  Open  XML,  (
OpenOffice
)  
OpenDocument
 
XML  Data  Model  
<?xml version="1.0"
encoding="UTF-8"?>
<recipe>

<title>


Grilled Cheese Sandwich

</title>

<ingredient name=“bread”
amount=”2”

unit=”slices”/>

<ingredient>


<name>cheese</name>


<amount>6</amount>


<unit>slices</unit>

</ingredient>

<preparation>


<step>Combine bread and cheese


</step>

</preparation>
</recipe>
Recipe  
Title  
Cheese  
Sandwich  
Ingredient  
Ingredient  
Bread  
Name  
Amount  
Unit  
2  
slices  
Cheese  
Name  
Amount  
Unit  
6  
slices  
Prepara:on  
Step  
Combine  
bread  and  
cheese  
XML  Path  Language  (
Xpath
)  


XPath
:  


Query  language  for  nodes  in  XML  document  


Examples:  


Q:  
/Recipe/Ingredient/
Name(text
)


A:  
[
Bread,Cheese
]


Q:  
/Recipe/Preparation/Step[1](text)


A:  
[Combine bread and cheese]


Q:  
/Recipe/
Ingredient[Amount
>6]/Name(text)


A:  
[Cheese]
Document  Type  Defini:on  (DTD)  


Well-­‐formed  XML  


DTD  is  a  set  of  
markup  
declara,ons
 that  define  
a  
document  type  for  
SGML-­‐family  markup  
languages  (XML/HTML/
SGML)  


SGML  (Standard  
Generalized  Markup  
Language)  


ISO  Standard  
<!ELEMENT Recipe (Title+,
Ingredient+, Preparation*)>
<!ELEMENT Ingredient (Name,
Amount,Unit
)>
<!ELEMENT
Preparation(Step
+)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Amount (#PCDATA)>
<!ELEMENT Unit (#PCDATA)>
<!ELEMENT
Step(#PCDATA
)>
XML  Schema  
<?xml version="1.0"?>
<
xs:schema

xmlns:xs
="http://
www.w3.org/2001/XMLSchema”>
<
xs:element
name=”Recipe">

<
xs:complexType
>


<
xs:sequence
>



<
xs:element
ref="Title"/>



<
xs:element
ref="Ingredient"/>



<
xs:element

ref="Preparation"/>


</
xs:sequence
>

</
xs:complexType
>
</
xs:element
>
<
xs:element
name="Title"



type="
xs:string
"/>
<
xs:element
name="Name"
type="
xs:string
"/>
<
xs:element
name="Amount"
type="
xs:positiveInteger
"/>
<
xs:element
name="Unit"
type="
xs:string
"/>
<
xs:element
name="Step"
type="
xs:string
"/>
</
xs:schema
>


Define  the  structure  of  XML  
document  


Requirement  of  elements  


Defines  
datatypes
 (string,  
boolean
,  number,  date,  URI)  


XML  must  be  well-­‐formed  


XML  is  valid  if  it  conforms  to  
the  XML  Schema  
Seman:c  Web  Layer  Cake  
XML  Schema  
Resource  Descrip:on  Framework  
(RDF)  


Data  model  


Consists  of  triples:  


(subject,  predicate,  object)  


Results  in  labeled  directed  mul:-­‐graph  


Different  serializa:ons  (file  formats)  


E.g.  XML  syntax  
RDF  Data  Model  


(Cheese Sandwich Recipe,
has_ingredient,cheese
)


(Cheese Sandwich Recipe,
has_ingredient,bread
)


(Cheese Sandwich Recipe,
has_preparation,Cheese

Sandwich Preparation)


(Cheese Sandwich
Preparation,
combine,rdf:List1)


(rdf:List1,
rdf:first
,
bread)


(rdf:List1,
rdf:rest
:
rdf:List2)


(rdf:List2,
rdf:first
,
cheese)


(rdf:List2,
rdf:rest
,
rdf:nil
)
Cheese    
Sandwich  
Recipe  
bread  
cheese  
has_ingredient
 
Cheese    
Sandwich  
Prepara:on  
bread  
rdf:List1  
rdf:List2  
rdf:nil
 
cheese  
has_prepara:on
 
combine  
rdf:first
 
rdf:first
 
rdf:rest
 
rdf:rest
 
RDF  IN  XML  
<?xml version="1.0"?>
<
rdf:RDF


xmlns:rdf
="http://www.w3.org/1999/02/22-rdf-
syntax-ns#"

xmlns:r
="http://
www.recipe.org/recipes.rdf
#">
<
rdf:Description

rdf:about
="Cheese Sandwich
Recipe">

<
r:hasIngredient
>


<
rdf:Description

rdf:about
="Bread" />

</
r:hasIngredient
>

<
r:hasIngredient
>


<
rdf:Description

rdf:about
="Cheese" />

</
r:hasIngredient
>
</
rdf:Description
>
</
rdf:RDF
>
RDF  IN  XML  (variant)  
<?xml version="1.0"?>
<
rdf:RDF


xmlns:rdf
="http://www.w3.org/1999/02/22-rdf-
syntax-ns#"

xmlns:r
="http://
www.recipe.org/recipes.rdf
#">
<
rdf:Description

rdf:about
="Cheese Sandwich Recipe">

<
r:hasIngredient
>


<
rdf:Description

rdf:about
="Bread" />

</
r:hasIngredient
>
</
rdf:Description
>
<
rdf:Description

rdf:about
="#Cheese Sandwich
Recipe">

<
r:hasIngredient
>


<
rdf:Description

rdf:about
="Cheese" />

</
r:hasIngredient
>
</
rdf:Description
>
</
rdf:RDF
>
RDF  has  different  XML  
serializa:ons.  
Xpath
 does  not  work  
Seman:c  Web  Layer  Cake  
XML  Schema  
SPARQL  Query  Language  


SPARQL:  


SPARQL  Protocol  and  RDF  Query  Language  


Query  language  for  the  Seman:c  Web  


SPARQL  Query:  


Triple  Pa\erns  


Conjunc:ons/Disjunc:ons  


Other  pa\erns  
SPARQL  Queries  


Query  consists  of  a  set  of  triples  in  which  
variables  are  used  (Turtle  nota:on)  


Retrieval  is  matching  with  RDF  graph  


Example:  


{Cheese Sandwich Recipe,
has_ingredient
, ?ingredient}


{?Recipe,
has_ingredient
, Tomato.
?Recipe,
has_ingredient
, Basil}
SPARQL  Nota:on  


URIs
:    


Full  
URIs
:  
http://
www.recipe.org/
recipes.rdf#:has_ingredient



Namespaces:  
r:has_ingredient



Variables:  


?
VariableName



Blank  nodes:  


[]
 or  
_:
VariableName



Literals:  


"Text between double quotes"
SPARQL:  Example  
PREFIX
dbpp
: <http://
dbpedia.org
/
property/>
PREFIX
dbp
: <http://
dbpedia.org
/
resource/>
SELECT DISTINCT ?Series {
?Series
dbpp:starring

dbp:Hugh_Laurie
.
?Series
dbpp:starring

dbp:Stephen_Fry

}
 
Answers:  
Blackadder
,  A  bit  of  Fry  and  Laurie,  
Jeeves
 and  
Wooster,  etc.  
Note  the  '.'  between  
each  line!  
SPARQL:  Same  subject  (;)  
PREFIX
dbpp
: <http://
dbpedia.org
/
property/>
PREFIX
dbp
: <http://
dbpedia.org
/
resource/>
SELECT DISTINCT ?Series{
?Series
dbpp:starring

dbp:Hugh_Laurie
;

dbpp:starring

dbp:Stephen_Fry

}
 
Answers:  
Blackadder
,  A  bit  of  Fry  and  Laurie,  
Jeeves
 and  
Wooster,  etc.  
Use  ';'  to  specify  further  proper:es  
of  the  same  subject.  
SPARQL:  Example  
PREFIX
dbpp
: <http://
dbpedia.org
/property/>
PREFIX
dbp
: <http://
dbpedia.org
/resource/>
PREFIX
dbpo
: <http://
dbpedia.org
/ontology/>
SELECT DISTINCT ?Name {
dbp:Karl_Marx

dbpp:influenced
?Person.
?Person
rdfs:label
?Name.
FILTER (
lang(?Name
)="en" )
}
"Vladimir
Lenin"@en

"Leon
Trotsky"@en

"Michel
Foucault"@en

"
Che

Guevara"@en

SPARQL:  Blank  Node  ([])  
PREFIX
dbpp
: <http://
dbpedia.org
/property/>
PREFIX
dbp
: <http://
dbpedia.org
/resource/>
PREFIX
dbpo
: <http://
dbpedia.org
/ontology/>
SELECT DISTINCT ?Name {
dbp:Karl_Marx

dbpp:influenced
[
rdfs:label
?
Name].
FILTER (
lang(?Name
)="en" )
}
"Vladimir
Lenin"@en

"Leon
Trotsky"@en

"Michel
Foucault"@en

"
Che

Guevara"@en

"Mao
Zedong"@en

SPARQL:  Regular  Expressions  
PREFIX
dbpp
: <http://
dbpedia.org
/property/>
PREFIX
dbp
: <http://
dbpedia.org
/resource/>
PREFIX
dbpo
: <http://
dbpedia.org
/ontology/>
SELECT DISTINCT ?Abstract {
dbp:Karl_Marx

dbpp:influenced
?Person.
?Person
dbpp:abstract
?Abstract
FILTER (
lang(?Abstract
)="en" )
FILTER (
regex(?Abstract,"Trotsky
") )
}
"Leon Trotsky (November 7, 1879 – August 21,
1940), born Lev
Davidovich
Bronstein, was a
Bolshevik revolutionary and Marxist theorist.
He was one of the leaders of the Russian
October Revolution, second only to Lenin.
(…)"@en
Seman:c  Web  Layer  Cake  
XML  Schema  
Resource  Descrip:on  Format  Schema  
(RDFS)  


Knowledge  Descrip:on  Representa:on  
Language  


Intended  to  structure  RDF  resources  


Notable:  


rdfs:Class



rdfs:subClassOf



rdfs:label



rdfs:comment



rdfs:domain



rdfs:range

Web  Ontology  Language  (OWL)  


Knowledge  Representa:on  Language  for  
authoring  
ontologies
 


Based  on  Descrip:on  Logics  


Development  defined  model  theory  for  RDFS  


One  of  the  fundamental  technologies  for  the  
Seman:c  Web  


Can  be  wri\en  down  in  RDF/XML/Abstract  
Syntax  
OWL  in  XML  
<
owl:ObjectProperty

rdf:ID
="
has_ingredient
"/>
<
owl:Class

rdf:ID
="Recipe">

<
rdfs:subClassOf
>


<
owl:Restriction
>



<
owl:onProperty
="#
has_ingredient
"/>



<
owl:allValuesFrom

rdf:about
="Ingredient"/>


</
owl:Restriction
>

</
rdfs:subClassOf
>
</
owl:Class
>
has
_
i
ngr
e
di
e
nt
!
R
R
e
c
i
pe
!
!
has
_
i
ngr
e
di
e
nt
I
ngr
e
di
e
nt
OWL  in  RDF  
Recipe  
[]  
owl:Restric:on
 
owl:Class
 
has_ingredient
 
Ingredient  
rdf:type
 
rdf:type
 
rdfs:subClassOf
 
owl:onProperty
 
owl:allValuesFrom
 
owl:ObjectProperty
 
rdf:type
 
OWL:  Abstract  Syntax  
Class(r:Ingredient
)
ObjectProperty(r:has_ingredient
)
Class(r:Recipe
partial

Restriction(



r:has_ingredient




AllValuesFrom(r:Ingredient
)



)
)
Seman:c  Web  Layer  Cake  
XML  Schema  
Ontology  


Two  meanings:  


Literally:  science  of  being  (existence)  


Classifica:on  hierarchy  of  the  world  


It  is  the  study  of  the  nature  of  being,  
existence
,  or  
reality  in  general  and  of  its  
basic  categories
 and  their  
relaAons
,  with  par:cular  emphasis  on  determining  
what  en::es  exist  or  can  be  said  to  exist,  and  how  
these  can  be  
grouped
 and  related  within  an  ontology  
(typically,  a  hierarchy  subdivided  according  to  
similari:es  and  differences).  
Aristotle’s  Categories  


Substance  


Quan:ty  


Quality  


Rela:on  


Place  


Time  


Posi:on  


State  


Ac:on  


Affec:on  
Aristotle.    
Categories  (~  350  B.C.)  
The  School  of  Athens  
Raffaello  San:  (1509)  
Top  Ontology  (~1900)  
Sowa.  Knowledge    
Representa:on  (1999)  
Inspired  by    
Peirce  and  Whitehead  
Knowledge  Representa:on  in  Ar:ficial  
Intelligence  
b  
a  
c  
c  
b  
Ini:al  State:  I  =  {clear(a),  
on(a,b),  on(b,T),  clear(c),  
on(c,T)}  
Goal:  G  =  {on(b,c)}  
Terry  Winograd’s  SHRDLU  natural  language  understanding  computer  program  (MIT,  
1968-­‐1970)  
Wordnet
 &  (
Open)Cyc
 


Wordnet
 


150,000  words  


nouns,  verbs,  adjec:ves  and  adverbs  


Hypernyms
/hyponyms  (general/specific)  


Synonym/Antonym  (same/opposite)  


(
Open)Cyc
 


47,000  concepts  and  306,000  facts  


Common  sense  knowledge  


Barack  Hussein  Obama  II
 is  a  president  of  the  US    


All  trees  are  plants.  


Paris  is  the  capital  of  France.  
h\p://wordnet.princeton.edu/  
h\p://www.cyc.com/  
Web  of  Life  
"Imagine  an  electronic  page  for  
each  species  of  organism  on  
Earth,  available  everywhere  by  
single  access  on  command."    
 
 
 
-­‐  Edward  O.  Wilson  
h\p://www.eol.org/
 
h\p://www.ted.com/index.php/talks/e_o_wilson_on_saving_life_on_earth.html
 
Ontology  Defini:ons  


Thomas  Gruber:  ”An  ontology  is  an  explicit  
specifica:on
 of  a  conceptualiza:on”  


Piet  
Borst
:  ”An  ontology  is  a  formal  
specifica:on
 of  a  shared  conceptualiza:on”  


Asunción  
Gómez-­‐Pérez
:  
Consenuated
 
Knowledge  


I  prefer:  A  formal  ontology  is  a  
consenuated
 
vocabulary  represented  in  a  language  that  
allows  automa:c  reasoning.  
Ontology  
Prac:cal  Session  in  Week  4:
 
 


SPARQL  


Learn  to  get  data  from  
DBpedia
 using  SPARQL.  


Retrieve  all  lines  on  the  blackboard  wri\en  by  
Bart  Simpson  at  the  beginning  of  each  episode  


Web  Ontology  Language/Descrip:on  Logic  


Pizza  Ontology  Tutorial  


Animal  Ontology  


Will  likely  be  adapted  due  to  new  format  
Prac:cal  Session  Week  4:  


Next  week  (week  47)  


Thursday  25  November  15.00  –  18.00    


Room  F2.04  


Expect  more  Wednesday  mee:ngs  to  be  
moved  due  to  conferences/project  mee:ngs