740 likes | 935 Views
Semantic Web and Knowledge Representation . Why Semantic Web. The current web is a worldwide network a huge information repository But made for human consumption only because information cannot be processed by machines Semantic Web making web-content machine-processable
E N D
Why Semantic Web • The current web is • a worldwide network • a huge information repository • But • made for human consumption only because • information cannot be processed by machines • Semantic Web • making web-content machine-processable • turning the Internet from a huge, world-wide repository of information for human consumption into a device for distributed, automated information processing • has to understand semantics or ontologies
Why Knowledge Representation • Separate domain knowledge module from the operational module • Configurable knowledge module • Share and reuse domain knowledge • Analyze domain knowledge
A formal, explicit specification of a shared conceptualization commonly accepted understanding What is ontology unambiguous definition of all concepts, attributes and relationships conceptual model of a domain machine-readability
What’s inside an ontology? • Concepts: Classes + Class-hierarchy • instances • Properties: often also called “Roles” or “Slots” • labeled instance-value-pairs • Axioms/Relations: • relations between classes (disjoint, covers) • inheritance (multiple? defaults?) • restrictions on slots (type, cardinality) • Characteristics of slots (symm., trans., …) • reasoning tasks: • Classification: Which classes does an instance belong to? • Subsumption: Does a class subsume another one? • Consistency checking: Is there a contradiction in my axioms/instances?
Why RDF • XML Schema is not enough for semantics • only describe Grammar, i.e. syntax of single documents • can not express inheritance for concepts • no means to express complex integrity constraints • in an unambigous way The author of ‘page.html‘ is Peter Morris <author> <fistName>Peter</fistName> <lastName>Morris</lastName> <documents> <uri>page.html</uri> </documents> </author> <document href=”page.html”> <author>Peter Morris</author> </document> What is the “correct” way of expressing it? Resource Description Framework (RDF) an infrastructure for the encoding, exchange and reuse of structured metadata
RDF Idea • RDF is intended to provide a simple way for making statements about resources • Resourcesobjects that are uniquely identified by an URI (Uniform Resource Identifier) • Anything can have a URI. • an entire Web page, • a whole collection of pages e.g. an entire Website, • object that is not directly accessible via the Web such as a printed book. • Propertyaspecific aspect, characteristic, attribute, or relation used to describe a resource has a specific meaning, defines its permitted values • Lives-In, CarColor, WorkFor, HasA, IncludedIn, hasAuthor… • Statementa specific resource together with a named property plus the value of that property for that resource. Each RDF statement can be written down as a triple(Subject, Property, Object) or a graph Value property Resource Resource
http://purl.org/dc/elements/1.1/creator http://www.polleres.net/page.html creationDate http://purl.org/dc/elements/1.1/language http://www.polleres.net/peter April 1,2004 English hasName Peter Morris A RDF Example <?xml version="1.0"?> <rdf:RDF xmlns:rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc = “http://purl.org/dc/elements/1.1/”> <rdf:Description rdf:about = “http://www.polleres.net/page.html”> <dc:creator> <rdf:Description rdf:about = “http://www.polleres.net/peter”> <hasName>Peter Morris</hasName> </rdf:Description> </dc:creator> </rdf:Description> </rdf:RDF>
<?xml version="1.0"?> <Resource-A> <property-A> <Resource-B> <property-B> <Resource-C> <property-C> Value-C </property-C> </Resource-C> </property-B> </Resource-B> </property-A> </Resource-A> value of property-B A General RDF Format value of property-A Convention: • A capital letter to start a type (class) name • A lowercase letter to start a property name
http://www.w3c.org/TR/rdf-syntax-grammar http://purl.org/dc/elements/1.1/title http://www.example.org/terms#editor RDF/XML Synatx Specification (Revised) http://www.example.org/terms#fullName http://www.example.org/terms#homePage http://purl.org/net/dajobe Dave Beckett Blank Node <?xml version="1.0"?> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:exterms=“http://www.example.org/terms#”> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"> <dc:title>RDF/XML Syntax Specification (Revised)</dc:title> <exterms:editor rdf:nodeID="abc"/> </rdf:Description> <rdf:Description rdf:nodeID="abc"> <exterms:fullName>Dave Beckett</exterms:fullName> <exterms:homePage rdf:resource="http://purl.org/net/dajobe/"/> </rdf:Description> </rdf:RDF>
<?xml version="1.0"?> <rdf:RDF xmlns:rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc = “http://purl.org/dc/elements/1.1/” xmlns:exterms="http://www.example.org/terms#“> <rdf:Description rdf:about = “http://www.polleres.net/page.html”> <dc:creator> <rdf:Description rdf:about = “http://www.polleres.net/peter”> <rdf:type rdf:resource="http://www.example.org/terms#Person"/> <name>Peter Morris</name> </rdf:Description> </dc:creator> </rdf:Description> </rdf:RDF> mississippi.xml Typed Node and rdf:type There is a Description about the resource http://www.plleres.net/peter. This resource is an instance of the Person type (class), This resource has the name Peter Morris .
<?xml version="1.0"?> <rdf:RDF xmlns:rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc = “http://purl.org/dc/elements/1.1/” xmlns:exterms="http://www.example.org/terms#“> <rdf:Description rdf:about = “http://www.polleres.net/page.html”> <dc:creator> <exterms:Person rdf:about =“http://www.polleres.net/peter”> <name>Peter Morris</name> </exterms:Person> </dc:creator> </rdf:Description> </rdf:RDF> mississippi.xml A Simpler Format
<?xml version="1.0"?> <rdf:RDF xmlns:rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc = “http://purl.org/dc/elements/1.1/” xmlns:exterms="http://www.example.org/terms/#” xmlns:base=“http://www.geongrid.org#”> <rdf:Description rdf:about = “index.html”> <dc:creator> <exterms:Person rdf:id =“nancy”> <name>Nancy</name> </exterms:Person> </dc:creator> </rdf:Description> </rdf:RDF> mississippi.xml rdf:ID Define a new resource http://www.geongrid.org#nancy rdf:ID for introducing a resource rdf:about for extending the information about a resource
RDF Containers • RDF provides 3 types of containers for a collection resources • rdf:Bag Unordered list of resources or literals as multiple values of a Property. • rdf:Sequence Sequence, ordered list of resources or literals as multiple values of Property. • rdf:Alt list of resources or literals that are alternatives for the (single) value of a Property. • Bag Example • The students in course 6.001 are Amy, Tim, and John rdf:Bag <rdf:Description about="http://.../courses/6.001"> <s:students> <rdf:Bag> <rdf:li resource=“http://.../students/Amy"/> <rdf:li resource="http://.../students/Tim"/> <rdf:li resource="http://.../students/John"/> </rdf:Bag> </s:students> </rdf:Description> rdf:type /course/6.001 /Student/Amy student rdf:_1 /Student/Tim rdf:_2 rdf:_3 /Student/John
RDF Collection Type <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://example.org/basket"> <ex:hasFruit rdf:parseType="Collection"> <rdf:Description rdf:about="http://example.org/banana"/> <rdf:Description rdf:about="http://example.org/apple"/> <rdf:Description rdf:about="http://example.org/pear"/> </ex:hasFruit> </rdf:Description> </rdf:RDF> http://www.w3.org/1999/02/22-rdf-syntax-ns#first Resource Collection Collection http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
RDF Schema (RDFS) Core Class • rdfs:Resource • rdfs:Literal • rdf:XMLLiteral • rdfs:Class • rdfs:Property • rdfs:DataType • rdfs:Container RDFS is a simple ontology language Name Space: http://www.w3.org/2000/01/rdf-schema Core Property • rdf:type • rdfs:subClassOf • rdfs:subPropertyOf • rdfs:domain • rdfs:range • rdfs:label • rdfs:comment
RDFS Example Property Resource Class type type subClassOf Vehicle producedBy Company subClassOf subClassOf LandVehicle SeaVehicle subClassOf subClassOf numberOfEngine Number HoverVehicle
RDFS Example (cont.) <rdf:RDF xmlns:rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs = “http://www.w3.org/2000/01/rdf-schema#” > <rdfs:Class rdf:ID=“Vehicle” > <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> </rdfs:Class> <rdfs:Class rdf:ID=“LandVehicle”> <rdfs:subClassOf rdf:resource=“#Vehicle”/> </rdfs:Class> <rdfs:Class rdf:ID=“SeaVehicle”> <rdfs:subClassOf rdf:resource=“#Vehicle”/> </rdfs:Class> <rdf:Description rdf:id=“Hovercraft”> <rdf:type resource=“http://www.w3.org/2000/01/rdf-schema#Class”/> <rdfs:subClassOf rdf:resource=“#LandVehicle”/> <rdfs:subClassOf rdf:resource=“#SeaVehicle”/> </rdf:Description> <rdfs:Class rdf:ID=“Company” /> <rdfs:Property rdf:ID=“producedBy”> <rdfs:domain rdf:resource=“#Vehicle” /> <rdfs:range rdf:resource=“#Company” /> </rdfs:Property> </rdf:RDF>
RDF/RDFS Recall from last lecture: RDF + RDFS: • RDF: triples for making assertions about resources • RDFS extends RDF with “schema vocabulary”, e.g.: • Class, Property • type, subClassOf, subPropertyOf • range, domain representing simple assertions, taxonomy + typing Vehicle producedBy subClassOf subClassOf Company LandVehicle SeaVehicle subClassOf subClassOf Number Hovercraft NumberOfEngines
Limitations of RDFS • RDFS too weak to describe resources in sufficient detail: • No localised range and domain constraints • Can’t say that the range of hasChild is person when applied to persons and elephant when applied to elephants • No existence/cardinality constraints • Can’t say that all instances of person have a mother that is also a person, or that persons have exactly 2 parents • No transitive, inverse or symmetrical properties • Can’t say that isPartOf is a transitive property, that hasPart is the inverse of isPartOf or that touches is symmetrical • No in/equality • Can’t say that a class/instance is the same as some other class/instance, can’t say that some classes/instances are definitely disjoint/different. • No boolean algebra • Can’t say that that one class is the union, intersection, complement of other classes, etc.
OWL-RDFS Relationship • Both use the same data model: • OWL extends the vocabulary and adds axioms • beware of the semantics! hasAuthor page.html “Dieter Fensel“ Resource(subject) Property (predicate) Value (object)
DAML OIL RDF DAML+OIL OWL Origins of OWL
OWL Language - Overview • Three species of OWL • OWL DL stays in Description Logic fragment • OWL Lite is “easier to implement” subset of OWL DL • OWL Full is union of OWL syntax and RDF • OWL DL based on Description Logic • In fact it is equivalent to SHOIN(Dn) DL • OWL DL Benefits from many years of DL research • Well defined semantics • Formal properties well understood (complexity, decidability) • Known reasoning algorithms • Implemented systems (highly optimised) • OWL full has all that and all the possibilities of RDF/RDFS which destroy decidability Full DL Lite
Description Logic Family • DLs are a family of logic based KR formalisms • Particular languages mainly characterized by: • Set of constructors for building complex concepts and roles from simpler ones • Set of axioms for asserting facts about concepts, roles and individuals • Examples: • “Female persons” • Person ⊓ Female • “Non-female persons” • Person ⊓Female • “Persons that have a child” • Person ⊓hasChild.Person • “Persons all of whose children are female” • Person ⊓hasChild.Female • “Persons that are employed or self-employed” • Person ⊓ (Employee ⊔ SelfEmployed) • “Persons the have at most one father“ • Person ⊓ ≤1.hasFather
concept ≡ definition{ concept ⊑ definition and definition ⊑ concept Necessary and Sufficient Conditions • Inclusion axioms provide necessary conditions: • concept ⊑ definition • Equivalence axioms provide necessary and sufficient conditions:
Classes: OWL vs. RDFS • OWL allows greater expressiveness, but • OWL (DL/Lite) puts certain constraints on the use of RDF • For instance: a class may not act as an instance of another (meta)class (the same holds for properties) OWL has got its own Class identifier OWL RDFS <rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </rdfs:Class> <owl:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </owl:Class>
RDF constructs What can you express in RDF/RDFS? Not too much… • rdfs:subClassOf … class hierarchy, necessary conditions (also equivalence is expressible because A ⊑ B and B ⊑ A A ≡ B) • rdf:type … class membership … OWL provides more expressive constructs to express the DL features! Employee ⊑ Person Employee(axel)
Union of Classes Instances of the Union of two Classes are either the instance of one or both classes Person ≡ Man ⊔ Woman <owl:Class rdf:ID=“Person"> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Woman" /> <owl:Class rdf:about="#Man" /> </owl:unionOf> </owl:Class>
Intersection of Classes Instances of the Intersection of two Classes are simultaneously instances of both class Man ≡ Person ⊓ Male <owl:Class rdf:ID=“Man"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person" /> <owl:Class rdf:about="#Male" /> </owl:intersectionOf> </owl:Class>
oneOf: Enumerated Classes Specify a class via a direct enumeration of its members: WhineColor ≡ {White, Rose, Red} <owl:Class rdf:ID="WineColor"> <owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#White"/> <owl:Thing rdf:about="#Rose"/> <owl:Thing rdf:about="#Red"/> </owl:oneOf> </owl:Class>
Necessary vs. Necessary & Sufficient Conditions in OWL • Necessary condition (⊑) via rdfs:subclass • Necessary and sufficient (≡) either by ⊑ + ⊒ or: owl:equivalentClasss
Property Restrictions • Defining a Class by restricting its possible instances via their property values • OWL distinguishes between the following two: • Value constraint • (Mother ≡ Woman ⊓hasChild.Person) • Cardinality constraint • (MotherWithManyChildren ≡ Mother ⊓ ≥3hasChild) • Property restrictions are local • RDFS allows only global properties
someValuesFrom Property Restrictions • A Mother is a Woman that has a child (some Person) <owl:Class rdf:ID=“Mother"> <rdfs:subClassOf rdf:resource="#Woman" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild" /> <owl:someValuesFrom rdf:resource="#Person" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class> Mother ⊑ Woman ⊓hasChild.Person
allValuesFrom Property Restrictions • To express the set of parents that only have female children (daughters) you would write: <owl:Class rdf:ID=“ParentsWithOnlyDaughters"> <rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasChild" /> <owl:allValuesFrom rdf:resource="#Woman" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class> ParentsWithOnlyDaughters ⊑ Person ⊓hasChild.Woman
hasValue Property Restrictions • hasValue allows to define classes based on the existence of particular property values, their must be at least one matching property value The set of all childs of the woman MARRY: MarysChildren ⊑ Person П hasParent.{MARRY} <owl:Class rdf:ID=“MarysChildren"> <rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasParent" /> <owl:hasValue rdf:resource="#MARRY" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
Cardinality Property Restrictions • Definition of cardinality: the number of occurrences, • maximum (maxCardinality) • minimum (minCardinality) • exact (cardinality) HalfOrphan ⊑ Person П =1hasParent.Person <owl:Class rdf:ID=“HalfOrphan"> <rdfs:subClassOf rdf:resource="#Person" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasParent"/> <owl:cardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:cardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
Classes as Restrictions on Properties: In summary:define a class using LOCAL restrictions on a specific Property rdfs:Class owl:Class owl:Restriction • Properties: • allValuesFrom: rdfs:Class (lite/DL owl:Class) • hasValue: specific Individual • someValuesFrom: rdfs:Class (lite/DL owl:Class) • cardinality: xsd:nonNegativeInteger (in lite {0,1}) • minCardinality: xsd:nonNegativeInteger (in lite {0,1}) • maxCardinality: xsd:nonNegativeInteger (in lite {0,1})
Properties: OWL vs. RDF • RDF Schema provides a couple of pre defined properties: • rdfs:range the range of values for a property. • rdfs:domain associate a property with a class. • rdfs:subPropertyOf specialize a property. • OWL provides additional poperty classes, which allow reasoning and inferencing, i.e. • owl:functionalProperty • owl:transitiveProperty • owl:symetricProperty
Properties OWL vs. RDF • OWL (DL and Lite) distinguishes between data typeproperties and object properties (RDFS does not) An ObjectProperty relates one Resource to another Resource: ObjectProperty Resource Resource A DatatypeProperty relates a Resource to a Literal or an XML Schema data type: DatatypeProperty Resource Value
Datatype Properties Example • for instance, usage of XSD datatypes: … object properties in OWL allow for some more sophisticated definitions than only domain and range <owl:DatatypeProperty rdf:ID="yearValue"> <rdfs:domain rdf:resource="#Car" /> <rdfs:range rdf:resource="&xsd;positiveInteger"/> </owl:DatatypeProperty>
Transitive Property If person A is a ancestor of person B and B is a ancester of C then A is also an ancestor of C. ancestor+ ancestor <owl:TransitiveProperty rdf:ID=“ancesotor"> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Person" /> </owl:ObjectProperty>
Symmetric Property If Mary is a friend of John, then John is also a friend of Mary friendOf- friendOf and friendOf friendOf- <owl:SymmetricProperty rdf:ID="friendOf"> <rdfs:domain rdf:resource="#Human"/> <rdfs:range rdf:resource="#Human"/> </owl:SymmetricProperty>
Inverse Property If Mary is a child of John, then John is the Father of Mary hasChild hasParent- <owl:ObjectProperty rdf:ID=“hasChild"> <owl:inverseOf rdf:resource="hasParent" /> </owl:ObjectProperty>
Functional Properties A functional property states that the value of range for a certain object in the domain is always the same A child has always the same Father (biological) Person 1hasFather <owl:ObjectProperty rdf:ID=“hasFather"> <rdf:tyoe rdf:resource="&owl;FunctionalProperty"/> </owl:ObjectProperty> <owl:FunctionalProperty rdf:ID=“hasFather“ />
A B Subsumption • The presented examples contain a number of classes and properties intended to illustrate particular aspects of reasoning in OWL. • We can make inferences about relationships between classes, in particular subsumption between classes A subsumes B if any instance of B is an instance of A
A Subsumption Example • Woman ≡ Person ⊓ Female • Man ≡ Person ⊓Woman • Mother ≡ Woman ⊓hasChild.Person • Father ≡ Man ⊓hasChild.Person • Parent ≡ Father ⊔ Mother • Grandmother ≡ Mother ⊓hasChild.Parent We can further infer (though not explicitely stated): Grandmother ⊑ Person Grandmother ⊑ Woman etc.
Inconsistency • You may define Classes were no individual can fulfill its definition. Via reasoning engines such a definition can be found also in big ontologies. • Cow ≡ Animal ⊓ Vegetarian • Sheep ⊑ Animal • Vegetarian ≡eats Animal • MadCow ≡ Cow ⊓eats.Sheep
Open/Close World Assumption Close World Assumption • The fact in the ontology describe completely what I know, all that is not in the ontology is assumed to be false.. Open World Assumption (used in OWL) • There are something not described by the ontology An ontology says: There is a train at 14:00 There is a train at 15:00 Is there a train at 17:00? no by Close World Assumption unknown by Open World Assumption