<<

Goals

• To provide some insight into the usefulness of ontologies Introduction to Ontology- • To provide an understanding of the based Semantics features of RDFS and OWL and their use in automated reasoning , ontologies, RDF, OWL, • To provide an outline of the N3 syntax N3 • Use N3 to express RDFS and OWL – sufficient for later examples and exercises on service semantics With thanks to Declan O’Sullivan

@ David Lewis @ David Lewis

Service Semantics Functional Semantics • WSDL provides the syntax we need for interoperating with a service, but little in the way of semantics • What do ‘origin’ and ‘destination’ strings • Examining this example raises many questions about represent? functional and non-functional semantics – Country, city, airport, restrictions (airline, national, regional)? • What does ‘flight’ string represent? – Airline, flight number, plane type? • What does ‘time’ string represent? – Departure time? – Note xsd:time probably is adequate - supports time- zone information • What does ‘cost’ float represent? – Currency, to how many decimal points? @ David Lewis @ David Lewis

Non-functional Semantics Need more than XML Schema • XML is Syntax • Availability – DTDs talk about element nesting – Can we assume 24x7x365 availability globally for web – XML Schema schemas give you data types service unless otherwise stated – need anything else? => write comments! • XML DTDs and XML Schemas are sufficient for exchanging data • Channels between parties who have agreed to meaning of terms beforehand – WSDL binding to SOAP supports this • Domain Semantics are complex: • WSDL says nothing about: – implicit assumptions, hidden semantics – Charging Styles ⇒ sources seem unrelated to the non-expert • Need Structure and Semantics beyond XML trees! – Settlement ⇒ employ richer OO models – Service Quality ⇒ make domain semantics and “glue knowledge” explicit – Security and Trust ⇒ use ontologies to fix terminology and conceptualization – Ownership and Rights ⇒ avoid ambiguities by using formal semantics (logics)

@ David Lewis @ David Lewis

1 Informally: What is an Ontology: A definition Ontology? •An "ontology” defines the common words and concepts (meaning) • Defines the terms used to describe and used to describe and represent an area of knowledge. represent an area of knowledge •An ontology can range from a – Taxonomy (knowledge with minimal hierarchy or a parent/child • Used by people, , applications structure) to a … that need to share domain information – Thesaurus (words and synonyms) to a …. – Conceptual Model (with more complex knowledge) to a… • Ontologies include computer-usable – Logical Theory (with very rich, complex, consistent and meaningful knowledge). definitions of basic concepts in the domain • A well-formed ontology is one that is expressed in a well-defined and the relationships among them syntax that has a well-defined machine interpretation consistent with the above ontology definition • They encode knowledge in a domain and knowledge that spans domains @ David Lewis @ David Lewis

An explicit description of a domain An explicit description of a domain • Constraints or axioms on properties and concepts: animal • Concepts (aka: class, set, type, predicate) – value: integer – event, gene, gammaBurst, – domain: cat atrium, molecule, cat vermin domestic – cardinality: at most 1 animal • Properties of concepts and dog – range: 0 <= X <= 100 cat relationships between them – cows are larger than dogs rodent cow vermin domestic (aka: slot) eats – cats cannot eat only vegetation – Taxonomy: generalisation – cats and dogs are disjoint dog mouse cat ordering among concepts isA, cow partOf, subProcess • Values or concrete domains rodent eats – Relationship, Role or Attribute: isA – integer, strings functionOf, hasActivity location, relationships mouse

eats, size @ David Lewis @ David Lewis

[Carole Goble, , Ontologies and the Grid Tutorial] [Carole Goble, Nigel Shadbolt, Ontologies and the Grid Tutorial]

An explicit description of a domain Types of Ontologies

animal describe very general concepts like space, time, event, which are • Nominals independent of a particular problem or domain. It seems reasonable to have unified top-level ontologies for large – Similar to abstract classes/types communities of users. – Concepts that cannot have instances vermin domestic – Instances that are used in conceptual definitions dog cat – ItalianDog = Dog bornIn Italy cow rodent describe the describe the • Individuals or Instances eats vocabulary related to vocabulary related a generic domain by to a generic task – sulphur, trpA Gene, felix specializing the or activity by felix concepts introduced specializing the • Ontology versus mouse in the top-level top-level ontology. –An ontology = tom ontologies. concepts+properties+axioms+values+ nominals mickey –A knowledge base = jerry These are the most specific ontologies. Concepts in ontology+instances application ontologies often correspond to roles played by domain entities while performing a certain activity. @ David Lewis @ David Lewis

[Carole Goble, Nigel Shadbolt, Ontologies and the Grid Tutorial] [Carole Goble, Nigel Shadbolt, Ontologies and the Grid Tutorial]

2 Ontologies - Some Examples Semantic Web • General purpose ontologies: • Meta-Ontologies – WordNet / EuroWordNet, – Semantic Translation, • Initiative of W3C, strongly driven by Sir Tim Berners Lee http://www.cogsci.princeton.edu/~wn http://www.ecimf.org/contrib/o nto/ST/index.html – http://www.w3.org/2001/sw/ – The Upper Cyc Ontology, http://www.cyc.com/cyc- 2-1/index.html – RDFT, • To date Web has been developed as a medium for document http://www.cs.vu.nl/~borys/RD – IEEE Standard Upper Ontology, http://suo.ieee.org/ FT/0.27/RDFT.rdfs manipulation by people • Domain and application-specific – Evolution Ontology, • Aim to augment the web pages with data targeted at computers, and http://kaon.semanticweb.org/e add documents targeted solely at computers, e.g. semantic web ontologies: xamples/Evolution.rdfs – RDF Site Summary RSS, service descriptions http://groups.yahoo.com/group/rss- • Ontologies in a wider • Challenges dev/files/schema.rdf sense – UMLS, http://www.nlm.nih.gov/research/umls/ – Agreeing on standard Markup Language… OWL standardisation – Agrovoc, progressing – KA2 / Science Ontology, http://www.fao.org/agrovoc/ http://ontobroker.semanticweb.org/ontos/ka2.html – Art and Architecture, – Generating sufficient common ontologies that can be referred to people – RETSINA Calendering Agent, http://www.getty.edu/research/ in their own ontologies (e.g. definition of food, definition of person etc.) http://ilrt.org/discovery/2001/06/schemas/ical- tools/vocabulary/aat/ – Availability of indexing crawlers or web service repositories to take full/hybrid.rdf – UNSPSC, advantage of new approach – AIFB Web Page Ontology, http://eccma.org/unspsc/ – Tool support for people creating own ontologies http://ontobroker.semanticweb.org/ontos/aifb.html – DTD standardizations, e.g. – Web-KB Ontology, http://www- HR-XML, http://www.hr- – Tool support for automatic markup of documents for end users, e.g. 2.cs.cmu.edu/afs/cs.cmu.edu/project/theo- .org/ incorporation into Word or Frontpage etc. 11/www/wwkb/ – Tool support for automatic markup of web services for end users, e.g. – Dublin Core, http://dublincore.org/ incorporation into .NET, J2EE etc. @ David Lewis @ David Lewis

[Carole Goble, Nigel Shadbolt, Ontologies and the Grid Tutorial]

Resource Description Framework (RDF) Notational Verbosity •RDF is a W3C recommendation that enables encoding, exchange and reuse of structured in XML • Semantic Web relies on a ‘stack’ of languages – Triples of assertions can be expressed using XML tags – XML for document formatting and referencing elements of other – A bit like “Subject, Property, Object” of a sentence document – XML Schema for encoding data types Concept – RDF – semantic description triple Concept Value – RDFS – definition of classes, properties and subclasses in RDF property – OWL – add assertions about relationships between RDF statement classes/properties – E.g. “Cabernet Sauvignon grape”, “is a type of” ,“Wine grape” • All aim to support machine processing and inference over the WWW • BUT …. Results in an incredibly verbose XML-based Property Object – Each resource can be assigned a different Universal Resource Identifier (URI) syntax! • Thus different meanings for the same term can be assigned different URIs – Fine for computers, bad for people – Reference: RDF Primer. W3C draft technical note, 2002 – Need less verbosity for sketching out ideas, presenting examples and teaching ontologies

@ David Lewis @ David Lewis

N3 Ontology Notation Syntactic shortcuts

• Compact, text based language for playing • Several objects with same subject and around with ontologies • Python Platform CWM allows inference and predicate separated by “,” exporting to correct XML formats, e.g. RDF • Several statements about same subject • Statements are all: Subject-Property-Obje c t . separated by “;” • Everything is a URI: <#pat> <#knows> <#jo>. • We will use N3 for our examples and exercises <#pat> <#child> <#al>, <#chaz>, <#mo>; • Semantically equivalent to RDF, RDFS and <#age> “24”; OWL <#eyecolour> “blue”. – Same vocab, less clutter

@ David Lewis @ David Lewis

3 Anonymous Definitions Sharing Concepts • Using ontologies to share concepts is central to Semantic Web – Ontology developers should use existing defined concepts whenever • Sometime want to declare something possible exists but without specifying a way to refer – Use URIs to define name spaces Assuming previous declarations were in ontology: to it elsewhere http://example.org/pats-family.n3

• Use square brackets “[ ]” In a new ontology we can say: @prefix pf: http://example.org/pats-family/. pf:pat <#employer> <#bigcorp>.

<#pat> <#child> [ <#age> “4” ], [ <#age> “3”]. In these examples we assume the following prefixes: @prefix rdf: . @prefix rdfs: . @prefix owl: . @prefix xsd: .

By convention we assume prefix: @prefix : <#> so that above becomes @ David Lewis pf:pat :employer :bigcorp @ David Lewis

List shorthand Making Vocabularies

• RDFS defines the terms of resources and classes: • In RDF a collection of things is indicated – everything in RDF is a “resource” – “classes” are also resources, but… using rdf:Collection – they are also a collection of possible resources (i.e., individuals/instances) – rdf:Bag - unordered collection • Relationships are defined among resources: – rdf:Seq – ordered collection – “typing”: an individual belongs to a specific class – “subclassing”: instance of one is also the instance of the other – rdf:Alt – collection of alternative values • a bit like in object-based programming… • …but the same resource can be subclass of multiple classes • In N3 lists are white space separated and • OWL supports classes and subclassing, but with richer semantics – Relationships between classes, between properties and between enclosed in parentheses “( )” classes and properties – Much improved inference capabilities about relationships and subsumption of classes :sibling rdf:Alt ( :sister :brother ). – Based on ‘’ [Ivan Herman] @ David Lewis @ David Lewis

Example: Defining terms and a subclass relationship Properties • Property is a special class (rdf:Property) • Define the term “Room” – i.e., properties are also resources :Room rdf:type rdfs:Class – … so properties can existing in their own right, separate from Or replacing “rdf:type” with “a” any class yet declared – unlike OO class attributes :Room a rdfs:Class • Properties declare relationship between two things • Define term “Restroom” and state that a :sister a rdf:Property Restroom is a subclass of Room • Properties are constrained by their range and domain – i.e., what individuals can be on the “left” or on the “right” :Restroom a owl:Class; :sister rdfs:domain :Person rdfs:subClassOf :Room. rdfs:range :Woman • Note: owl:Thing is a predefined OWL Class • There is also a possibility for a “sub-property” and is the root of all classes :stepSister rdfs:subPropertyOf :sister • Note, by convertion we start class identifiers with upper [Tim Berners Lee] case, property identifiers with lower case @ David Lewis @ David Lewis [Ivan Herman]

4 Defining Properties in RDFS Class Properties in OWL • Associate the property (defined elsewhere) with the Class by using combination of rdfs:subClassOf and owl:onProperty •In RDF Schema the rdf:Property is used both to – Define local restrictions on that property using owl:Restriction – Relate one Resource to another Resource • Cardinality restrictions can be stated on a property with respect to a particular class • For example, a “accessRestrictedToGender” property can relate a Restroom to a Gender – minCardinality: at least the given number – maxCardinality: at most the given number – Relate a resource to a rdfs:Literal or datatype – Cardinality: exactly the given value • For example, a “latitude” property relates a Room to a xsd:string type •OWL provides different statements for two cases :Wine a owl:Class; – owl:ObjectProperty is used to relate a resource to another rdfs:subClassOf :PotableLiquid; What range :accessRestrictedToGender a owl:ObjectProperty; of values rdfs:subClassOf [ owl:Restriction [ `what owl:onProperty :madeFromGrape; classes is rdfs:range :Gender; this rdfs:domain :Restroom. owl:minCardinality 1 ]]; property associated – owl:DatatypeProperty is used to relate a resource to a rdfs:Literal or XML rdfs:subClassOf [ owl:Restriction [ with schema data type owl:onProperty :locatedIn owl:minCardinality 1 ]]. :latitute a owl:DatatypeProperty rdfs:range rdfs:domain :Place @ David Lewis @ David Lewis

Examples of Assertions Assertions between Classes Between Classes •OWL provides several other mechanisms for defining •equivalentClass and unionOf classes – owl:equivalentClass allows you to state that two classes are :AtomicPlaceInBuilding a owl:Class; synonymous rdfs:subClassOf AtomicPlace; – owl:disjointWith allows you to state that an instance of this class owl:equivalentClass owl:Class [ cannot be an instance of another owl:unionOf [ :Room :Hallway :Stairway • E.g. Man and Woman could be stated as disjoint classes :OtherPlaceInBuilding ]]. – owl:unionOf allows you specify that a class contains things that are from more than one class (similar to AND) •disjointWith • E.g. Restroom could be defined as a union of MensRoom and LadiesRoom :Stairway a owl:Class; – owl:intersectionOf allows you to specify that a class contains rdfs:subClassOf :AtomicPlaceInBuilding; things that are both one thing and another (similar to OR) owl:disjointWith :Room; – owl:complementOf allows you specify that a class contains owl:disjointWith :Hallway. things that are not other things (similar to NOT) • E.g. Children are not SeniorCitizens @ David Lewis @ David Lewis

In addition OWL allows you state that a property is… Summary Example •Symmetric :LargeConferenceRoom a :Room; – If the pair (x.y) is an instance then it can be deduced that (y,x) is also an instance. :address “G.02”; – Example, property “adjacentRoom” property of Room or “friend” property of person •Transitive :spatiallySubsumedBy “O’Reilly Institute” – If a property is transitive, then if the pair (x.y) is an instance of P and (y,z) is an instance of P :adjacentRoom “SmallConferenceRoom” then it can be deduced that (x,z) is also an instance. :coordinates “44,55”. – Example, property “isSpatiallySubsumedBy” •Functional – If a property is functional, then it has no more than one value for each individual, that is it can have 0 or 1 We can deduce: – Example, property “Address” of a Building 1. The O’Reilly Institute spatially subsumes the Large Conf Room •InverseOf (since spatiallySubsumedBy is an inverse property) – One property may be stated to be the inverse of another property. It can be deduced that if 2. The Small Conference Room is adjacent to Large Conference the property P1 is stated to be the inverse of P2, then if X is related to Y via P2 then Y is Room (since adjacentRoom is symmetric) related to X via P1 3. Only the Large Conference Room can be found at coordinates – Example, property “spatiallySubsumes” 44,55 (since coordinates is inverse functional) •InverseFunctionalProperty 4. The Large Conference Room has only one address (since – Only one thing can have instance of that property, e.g. “coordinates” address is functional) @ David Lewis @ David Lewis

5 Specifying Restrictions on Hierarchy of Properties range of values rdf:Property •rdfs:range allows restriction on values of a property to a class and all its subclasses owl:ObjectProperty owl:DatatypeProperty owl:FunctionalProperty owl:InverseFunctionalProperty •OWL allows for further restrictions to be specified – allValuesFrom provides for a local range restriction – someValuesFrom states that at least one value for that property is of specified type owl:SymmetricProperty owl:TransitiveProperty – hasValue states that the property is required to have a particular instance as a value

@ David Lewis @ David Lewis

Summary of Class Properties Instance Document Annotations

rdfs:Class Properties: subClassOf: rdfs:Class •Sometimes useful to explicitly annotate instance documents –sameAs: Two individuals may be stated to be the same. Properties: For example intersectionOf: rdf:List unionOf: rdf:List owl:Class complementOf: owl:Class :BoardRoom a :Room; oneOf: rdf:List owl:sameIndividualAs :LargeConferenceRoom equivalentClass: owl:Class disjointWith: owl:Class

Properties: – differentFrom: An individual may be stated to be different from other onProperty: rdf:Property individuals allValuesFrom: rdfs:Class – allDifferent: A number of individuals may be stated to be mutually owl:Restriction hasValue: distinct someValuesFrom: rdfs:Class • For example, Large and Small Conference Rooms are both of type room, cardinality: xsd:nonNegativeInteger but we want to make clear they are distinct rooms minCardinality: xsd:nonNegativeInteger maxCardinality: xsd:nonNegativeInteger

@ David Lewis @ David Lewis

Summary of OWL Capabilities Symmetric: if P(x,y) then P(y,x) (by Roger Costello and Rob Simmons) inverseOf: if P1(x,y) then P2(y,x) Summary Transitive: if P(x,y) and P(y,z) then P(x,z) Functional: if P(x,y) and P(x,z) then y=z •An OWL document contains the following kind of InverseFunctional InverseFunctional: if P(x,y) and P(z,y) then x=z P x y information: allValuesFrom: P(x,y) has y=allValuesFrom(C) 1 someValuesFrom: P(x,y) has y=someValuesFrom(C) – Class hierarchy info: an OWL document defines Functional hasValue: P(x,y) and y=hasValue(I) P x y class/subclass relationships. cardinality: cardinality(P) = n 1 minCardinality: minCardinality(P) = n – Synonym info: an OWL document identifies InverseFunctional & Functional maxCardinality: maxCardinality(P) = n P x y equivalent classes and equivalent properties. equivalentProperty: P1 = P2 11 intersectionOf: C = intersectionOf(C1, C2, …) – Class association info: an OWL document maps unionOf: C = unionOf(C1, C2, …) complementOf: C = complementOf(C1) one or more classes to one or more classes, via a LEGENDLEGEND oneOf: C = oneOf(I1, I2, …) property (i.e., domain/range info). Properties: P, P1, P2, P3, … equivalentClass: C1 = C2 Generic classes: C, C1, C2, C3, … – Property metadata info: an OWL document contains disjointWith: C1 != C2 Specific classes: x, y, z a lot of metadata for properties. sameIndividualAs: I1 = I2 Instances: I, I1, I2, I3, … differentFrom: I1 != I2 A non-negative integer: n – Class definition info: an OWL document specifies AllDifferent: I1 != I2, I1 != I3, I2 != I3, … P(x,y) is read as: “property P the composition of classes.@ David[DARPA Lewis 2003] Thing: C1, C2, …, I1, I2, …, P1, P2, …@ David Lewis relates domain x to range y”

6 References

• [Ludascher 03] Bertram Ludascher, CSE-291 course, University of California, San Diego • [Carole Goble, Nigel Shadbolt, Ontologies and the Grid Tutorial] http://www.semanticgrid.org/presentations/ontologies-tutorial/ • [DARPA 2003] Tutorial by Costello and Jacobs of MITRE funded by DARPA • [Ivan Herman] http://www.w3.org/Consortium/Offices/Presentations/RDFTutorial] • [Tim Berners Lee] http://www.w3.org/2000/10/swap/Primer • The OWL Guide provides a description of OWL, with many examples:http://www.w3.org/TR/owl-guide/ • Here is the URL to the OWL Reference document: – http://www.w3.org/TR/owl-ref/

@ David Lewis

7