Motivation - Virginia Tech

Download Report

Transcript Motivation - Virginia Tech

RDF and DAML
 Resource Description Framework (RDF) is
a knowledge representation language
represented in XML. It is a WWW
Consortium Recommendation.
 The DARPA Agent Markup Language
(DAML) is an extension of RDF to serve as
the basis for ontology-based computing
over the Web: the Semantic Web.
Motivation
• Dynamically identify and understand
information sources
• Provide interoperability between agents in a
semantic manner
• Enable distributed extensible network of
ontologies
• Current tools such as HTML, XML not
sufficient to express semantics, relationships
between classes
DAML+OIL <-> RDF
• DAML+OIL ontology is a set of RDF
statements
– http://www.daml.org/2001/03/daml+oil.daml
• Ontology can actually include arbitrary RDF
statements
• RDF schema uses XML syntax, but could
theoretically use any other syntax
XML
• Makes use of tags just like HTML, but
arbitrary
<aTag>...</aTag> <anEmptyTag/>
<anotherTag with="an
attribute">...</anotherTag> <aTag>with
<anemptyTag/> inside it</aTag>
<tags>and<moreTags>and<yetmoreTags>an
d...</yetmoreTags></moreTags></tags>
• Tags can be defined semantically in a DTD
RDF
• RDF document is a collection of assertions in
subject verb object (SVO) form
Within the obligatory RDF declaration (typically a
tag that begins something like <rdf:RDF ...), each
topmost element is the subject of a sentence. The
next level of enclosed elements represent
verb/object pairs for this sentence:
<Class ID="Male"> <subClassOf
resource="#Animal"/> </Class> Male is a
subclass of Animal.
<Class ID="Female"> <subClassOf
resource="#Animal"/> <disjointWith
resource="#Male"/> </Class> Female is a
subclass of Animal AND Female is disjoint from
Male. The single subject -- Female -- is used to
begin each of the verb-object assertions
<subClassOf resource="#Animal"/> and
<disjointWith resource="#Male"/>
Basic RDF object types
• Resources
– All things being described by RDF expressions
– Identified by URI plus optional anchor id
– E.g., <disjointWith resource="#Male"/>
• Properties
– A specific aspect, characteristic, attribute, or
relation used to describe a resource
– has a specific meaning, defines its permitted
values, the types of resources it can describe, and
its relationship with other properties
Basic RDF object types cont.
• Statements
– A specific resource together with a named
property plus the value of that property for that
resource is an RDF statement
– Called the subject, the predicate, and the object
– property value can be another resource or it can
be a literal(string or other primitive data type)
– http://www.w3.org/RDF/
Simple Example
• Ora Lassila is the creator of the resource
http://www.w3.org/Home/Lassila
<rdf:RDF
xmlns:rdf=“http://www.w3.org/1999/02/22rdf-syntax-ns#”
xmlns:s="http://description.org/schema/">
<rdf:Description
about="http://www.w3.org/Home/Lassila">
<s:Creator>Ora Lassila</s:Creator>
</rdf:Description> </rdf:RDF>
Simple Example cont.1
• Now, consider the case that we want to say something
more about the characteristics of the creator of this
resource. In prose, such a sentence would be:
The individual whose name is Ora Lassila, email
<[email protected]>, is the creator of
http://www.w3.org/Home/Lassila.
The intention of this sentence is to make the value of the
Creator property a structured entity. In RDF such an entity
is represented as another resource. The sentence above
does not give a name to that resource; it is anonymous, so
in the diagram below we represent it with an empty oval:
Simple Example cont.2
The structured entity of the previous example can also be
assigned a unique identifier. To continue the example,
imagine that an employee id is used as the unique identifier
for a "person" resource. The URIs that serve as the unique
keys for each employee (as defined by the organization)
might then be something like
http://www.w3.org/staffId/85740. Now we can write the
two sentences:
The individual referred to by employee id 85740 is named
Ora Lassila and has the email address [email protected].
The resource http://www.w3.org/Home/Lassila was created
by this individual.
Abbreviated Syntax Form 1
• Usable for properties that are not repeated
within a description and where the values of
those properties are literals
• the properties may be written as XML
attributes <rdf:RDF> <rdf:Description
about="http://www.w3.org/Home/Lassila"
s:Creator="Ora Lassila" /> </rdf:RDF>
• Side effect: might be viewed differently in
browser
Abbreviated Syntax Form 2
• Works for nested Description elements
<rdf:RDF> <rdf:Description about="http://www.w3.org/Home/Lassila">
<s:Creator rdf:resource="http://www.w3.org/staffId/85740"/> </rdf:Description>
<rdf:Description about="http://www.w3.org/staffId/85740">
<v:Name>Ora Lassila</v:Name>
<v:Email>[email protected]</v:Email>
</rdf:Description> </rdf:RDF>
equal to
<rdf:RDF> <rdf:Description about="http://www.w3.org/Home/Lassila">
<s:Creator rdf:resource="http://www.w3.org/staffId/85740" v:Name="Ora
Lassila" v:Email="[email protected]" /> </rdf:Description> </rdf:RDF>
Abbreviated Syntax Form 3
• description element containing a type
property
<rdf:Description about="http://www.w3.org/Home/Lassila"> <s:Creator>
<rdf:Description about="http://www.w3.org/staffId/85740">
<rdf:type resource="http://description.org/schema/Person"/>
<v:Name>Ora Lassila</v:Name>
<v:Email>[email protected]</v:Email>
</rdf:Description> </s:Creator> </rdf:Description>
equal to
<rdf:Description about="http://www.w3.org/Home/Lassila"> <s:Creator>
<s:Person about="http://www.w3.org/staffId/85740">
<v:Name>Ora Lassila</v:Name>
<v:Email>[email protected]</v:Email>
</s:Person> </s:Creator> </rdf:Description>
Basic Serialization Syntax
Basic RDF serialization syntax takes the form:
[1] RDF ::= ['<rdf:RDF>'] description* ['</rdf:RDF>']
[2] description ::= '<rdf:Description' idAboutAttr? '>' propertyElt*
'</rdf:Description>'
[3] idAboutAttr ::= idAttr | aboutAttr
[4] aboutAttr ::= 'about="' URI-reference '"'
[5] idAttr ::= 'ID="' IDsymbol '"'
[6] propertyElt ::= '<' propName '>' value '</' propName '>' | '<'
propName resourceAttr '/>'
[7] propName ::= Qname [8] value ::= description | string
[9] resourceAttr ::= 'resource="' URI-reference '"'
[10] Qname ::= [ NSprefix ':' ] name
[11] URI-reference ::= string, interpreted per [URI]
[12] IDsymbol ::= (any legal XML name symbol)
[13] name ::= (any legal XML name symbol)
[14] NSprefix ::= (any legal XML namespace prefix)
[15] string ::= (any XML text, with "<", ">", and "&" escaped)
RDF/XML
Ora Lassila is the creator of the resource
http://www.w3.org/Home/Lassila. is
represented in RDF/XML as:
<rdf:RDF> <rdf:Description
about="http://www.w3.org/Home/Lassila
"> <s:Creator>Ora Lassila</s:Creator>
</rdf:Description> </rdf:RDF>
RDF schema
• Different from XML DTD: syntax vs.
semantics
• Defines Class, Property, subClassOf,
subPropertyOf, domain, range, and
some others
• http://www.w3.org/TR/rdf-schema/
http://www.w3.org/TR/REC-rdf-syntax/
Why RDF Is Not Enough
• Only range/domain constraints on
properties (need others)
• No properties of properties (unique,
transitive, inverse, etc.)
• No equivalence, disjointness, etc.
• No necessary and sufficient conditions
(for class membership)
• No defined semantics
DAML basics
• Setting up the namespaces
<rdf:RDF
xmlns:rdf =http://www.w3.org/1999/02/22-rdfsyntax-ns#
xmlns:rdfs=http://www.w3.org/2000/01/rdfschema#
xmlns:daml=http://www.daml.org/2000/12/daml
+oil#
xmlns =“http://www.daml.org/2000/12/daml+oilex#”
DAML basics cont.1
• Assert an ontology
<daml:Ontology rdf:about=“”>
<daml:versionInfo>$Id: daml+oil-ex.daml,v
1.4 2001/01/11 20:33:52 mdean Exp
$</daml:versionInfo>
<rdfs:comment>
An example ontology
</rdfs:comment> <daml:imports
rdf:resource=“http://www.daml.org/2000/12/da
ml+oil/> </daml:Ontology>
DAML basics cont.2
• Define classes
<rdfs:Class rdf:ID="Animal">
<rdfs:label>Animal</rdfs:label>
<rdfs:comment>
This class of animals is illustrative of a number
of ontological idioms. </rdfs:comment>
</rdfs:Class>
<rdfs:Class rdf:ID="Male">
<rdfs:subClassOf rdf:resource="#Animal"/>
</rdfs:Class>
DAML basics cont.3
• Define classes
• <rdfs:Class rdf:ID="Female">
<rdfs:subClassOf
rdf:resource="#Animal"/>
<daml:disjointWith
rdf:resource="#Male"/> </rdfs:Class>
<rdfs:Class rdf:ID="Man">
<rdfs:subClassOf
rdf:resource="#Person"/>
DAML basics cont.4
• Define properties
• <rdf:Property rdf:ID="hasParent">
• <rdfs:domain rdf:resource="#Animal"/>
<rdfs:range rdf:resource="#Animal"/>
</rdf:Property>
• <rdf:Property rdf:ID="hasFather">
<rdfs:subPropertyOf
rdf:resource="#hasParent"/> <rdfs:range
rdf:resource="#Male"/> </rdf:Property>
DAML basics cont.5
• Define restrictions
<rdfs:Class rdf:ID="Person">
<rdfs:subClassOf rdf:resource="#Animal"/>
<rdfs:subClassOf>
<daml:Restriction> scope difference
<daml:onProperty rdf:resource="#hasParent"/>
<daml:toClass rdf:resource="#Person"/>
</daml:Restriction> </rdfs:subClassOf>
<rdfs:subClassOf>
<daml:Restriction daml:cardinality="1">
<daml:onProperty rdf:resource="#hasFather"/>
</daml:Restriction> </rdfs:subClassOf>
</rdfs:Class>
DAML basics cont.6
About tag <rdfs:Class rdf:about="#Animal">
<rdfs:comment>
Animals have exactly two parents, ie:
If x is an animal, then it has exactly 2 parents
(but it is NOT the case that anything that has 2
parents is an animal).
</rdfs:comment> <rdfs:subClassOf>
<daml:Restriction daml:cardinality="2">
<daml:onProperty
rdf:resource="#hasParent"/>
</daml:Restriction> </rdfs:subClassOf>
DAML basics cont.7
• Max, min cardinality (min default=0)
<rdfs:Class rdf:about="#Person">
<rdfs:subClassOf> <daml:Restriction
daml:maxcardinality="1">
<daml:onProperty
rdf:resource="#hasSpouse"/>
</daml:Restriction>
</rdfs:subClassOf> </rdfs:Class>
DAML basics cont.8
• UniqueProperty (cardinality=1),
• Transitive <daml:UniqueProperty
rdf:ID="hasMother"> <rdfs:subPropertyOf
rdf:resource="#hasParent"/> <rdfs:range
rdf:resource="#Female"/>
</daml:UniqueProperty>
<daml:TransitiveProperty
rdf:ID="hasAncestor">
<rdfs:label>hasAncestor</rdfs:label>
</daml:TransitiveProperty>
DAML basics cont.9
• one of
<rdf:Property rdf:ID="hasHeight"> <rdfs:range
rdf:resource="#Height"/> </rdf:Property>
<rdfs:Class rdf:ID="Height">
<daml:oneOf rdf:parseType="daml:collection">
<Height rdf:ID="short"/>
<Height rdf:ID="medium"/>
<Height rdf:ID="tall"/>
</daml:oneOf> </rdfs:Class>
DAML basics cont.10
• hasValue, intersectionOf
<rdfs:Class rdf:ID="TallThing">
<daml:sameClassAs> <daml:Restriction>
<daml:onProperty rdf:resource="#hasHeight"/>
<daml:hasValue rdf:resource="#tall"/>
</daml:Restriction> </daml:sameClassAs>
</rdfs:Class>
<rdfs:Class rdf:ID="TallMan">
<daml:intersectionOf rdf:parseType="daml:collection">
<rdfs:Class rdf:about="#TallThing"/>
<rdfs:Class rdf:about="#Man"/> </daml:intersectionOf>
</rdfs:Class>
DAML basics cont.11
• instances
<Person rdf:ID="Adam">
<rdfs:label>Adam</rdfs:label>
<rdfs:comment>Adam is a person.
</rdfs:comment>
<hasHeight rdf:resource=“#medium”/>
</Person>