setting up namespaces

34
What is an Ontology? What is an Ontology? Catalog/ ID G eneral Logical constraints Term s/ glossary Thesauri “narrow er term ” relation Form al is-a Fram es (properties) Inform al is-a Form al instance V alue Restrs. D isjointness, Inverse, part- of…

Upload: ethan-white

Post on 19-Jan-2016

247 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Setting Up Namespaces

What is an Ontology?What is an Ontology?

Catalog/ID

GeneralLogical

constraints

Terms/glossary

Thesauri“narrower

term”relation

Formalis-a

Frames(properties)

Informalis-a

Formalinstance

Value Restrs.

Disjointness, Inverse, part-

of…

Page 2: Setting Up Namespaces

A Few Observations about OntologiesA Few Observations about Ontologies Simple ontologies can be built by non-experts

Verity’s Topic Editor, Collaborative Topic Builder, GFP, Chimaera, Protégé, OIL-ED, etc.

Ontologies can be semi-automatically generated from crawls of site such as yahoo!, amazon, excite, etc. Semi-structured sites can provide starting points

Ontologies are exploding (business pull instead of technology push) most e-commerce sites are using them - MySimon, Amazon,

Yahoo! Shopping, VerticalNet, etc. Controlled vocabularies (for the web) abound - SIC codes,

UMLS, UN/SPSC, Open Directory (DMOZ), Rosetta Net, SUO Business interest expanding – ontology directors, business

ontologies are becoming more complicated (roles, value restrictions, …), VC firms interested,

DTDs are making more ontology information available Markup Languages growing XML, RDF, DAML, RuleML, xxML “Real” ontologies are becoming more central to applications

Page 3: Setting Up Namespaces

Chimaera Chimaera –– A Ontology A Ontology Environment ToolEnvironment Tool

An interactive web-based tool aimed at supporting:•Ontology analysis (correctness, completeness, style, …)•Merging of ontological terms from varied sources•Maintaining ontologies over time•Validation of input

• Features: multiple I/O languages, loading and merging into multiple namespaces, collaborative distributed environment support, integrated browsing/editing environment, extensible diagnostic rule language

• Used in commercial and academic environments

• Available as a hosted service from www-ksl-svc.stanford.edu

• Information: www.ksl.stanford.edu/software/chimaera

Page 4: Setting Up Namespaces

Setting Up Namespaces

<rdf:RDF xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd ="http://www.w3.org/2000/10/XMLSchema#" xmlns:daml="http://www.daml.org/2001/03/daml+oil#" xmlns:dex ="http://www.daml.org/2001/03/daml+oil-ex#" xmlns:exd ="http://www.daml.org/2001/03/daml+oil-ex-dt#" xmlns ="http://www.daml.org/2001/03/daml+oil-ex#"

Page 5: Setting Up Namespaces

Housekeeping

<daml:Ontology rdf:about=""> <daml:versionInfo>$Id: daml+oil-ex.daml,v

1.8 2001/03/27 21:24:04 horrocks Exp $</daml:versionInfo> <rdfs:comment>

An example ontology, with data types taken from XML Schema </rdfs:comment> followed by

<daml:imports rdf:resource="http://www.daml.org/2001/03/daml+oil">

Page 6: Setting Up Namespaces

Defining Classes

<daml: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>

</daml:Class> <daml:Class rdf:ID="Male">

<rdfs:subClassOf rdf:resource="#Animal"/> </daml:Class>

Page 7: Setting Up Namespaces

Defining Classes cont.1<daml:Class rdf:ID="Female"> <rdfs:subClassOf

rdf:resource="#Animal"/> <daml:disjointWith rdf:resource="#Male"/> </daml:Class>

It perfectly admissible for a class to have multiple superclasses: A Man is a Male Person

<daml:Class rdf:ID="Man"> <rdfs:subClassOf rdf:resource="#Person"/> <rdfs:subClassOf rdf:resource="#Male"/> </daml:Class>

...and a Woman is a Female Person.<daml:Class rdf:ID="Woman"> <rdfs:subClassOf

rdf:resource="#Person"/> <rdfs:subClassOf rdf:resource="#Female"/> </daml:Class>

Page 8: Setting Up Namespaces

Defining Properties

• <daml:ObjectProperty rdf:ID="hasParent">

• <rdfs:domain rdf:resource="#Animal"/>• <rdfs:range rdf:resource="#Animal"/>• </daml:ObjectProperty> • <daml:ObjectProperty rdf:ID="hasFather">

<rdfs:subPropertyOf rdf:resource="#hasParent"/> <rdfs:range rdf:resource="#Male"/> </daml:ObjectProperty>

Page 9: Setting Up Namespaces

Defining Properties cont.1<daml:DatatypeProperty rdf:ID="shoesize">

<rdfs:comment> shoesize is a DatatypeProperty whose range is xsd:decimal. shoesize is also a UniqueProperty (can only have one shoesize)

</rdfs:comment> <rdf:type

rdf:resource="http://www.daml.org/2001/03/daml+oil#UniqueProperty"/>

<rdfs:range rdf:resource="http://www.w3.org/2000/10/XMLSchema#decimal"/> </daml:DatatypeProperty>

Page 10: Setting Up Namespaces

Defining Property Restrictions

<daml:Class rdf:ID="Person"><rdfs:subClassOf

rdf:resource="#Animal"/><rdfs:subClassOf> <daml:Restriction>

<daml:onProperty rdf:resource="#hasParent"/> <daml:toClass rdf:resource="#Person"/> </daml:Restriction> </rdfs:subClassOf>

Page 11: Setting Up Namespaces

Defining Property Restrictions cont.1

<rdfs:subClassOf> <daml:Restriction daml:cardinality="1">

<daml:onProperty rdf:resource="#hasFather"/> </daml:Restriction>

</rdfs:subClassOf> <rdfs:subClassOf> <daml:Restriction>

<daml:onProperty rdf:resource="#shoesize"/> <daml:minCardinality>1</daml:minCardinality> </daml:Restriction> </rdfs:subClassOf>

Page 12: Setting Up Namespaces

Defining Property Restrictions cont.2

• <daml: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:Class> Such an assertion "

Page 13: Setting Up Namespaces

Defining Properties cont.1<daml:DatatypeProperty rdf:ID="age">

<rdfs:comment> age is a DatatypeProperty whose range is xsd:decimal. age is also a UniqueProperty (can only have one age) </rdfs:comment>

<rdf:type rdf:resource="http://www.daml.org/2001/03/daml+oil#UniqueProperty"/>

<rdfs:range rdf:resource="http://www.w3.org/2000/10/XMLSchema#nonNegativeInteger"/> </daml:DatatypeProperty>

Page 14: Setting Up Namespaces

Defining Properties cont.2

rdf:about="http://www.daml.org/2001/03/daml+oil-ex.daml#Animal"

<daml:Class rdf:about="#Person"> <rdfs:subClassOf> <daml:Restriction daml:maxCardinality="1"> <daml:onProperty rdf:resource="#hasSpouse"/> </daml:Restriction> </rdfs:subClassOf> </daml:Class>

Page 15: Setting Up Namespaces

Defining Properties cont.3

<daml:Class rdf:about="#Person"> <rdfs:subClassOf> <daml:Restriction daml:maxCardinality="1"> <daml:onProperty rdf:resource="#hasSpouse"/> </daml:Restriction>

</rdfs:subClassOf> </daml:Class>

Page 16: Setting Up Namespaces

Defining Properties cont.4

<daml:Class rdf:about="#Person"> <rdfs:subClassOf> <daml:Restriction daml:maxCardinalityQ="1"> <daml:onProperty rdf:resource="#hasOccupation"/> <daml:hasClassQ rdf:resource="#FullTimeOccupation"/> </daml:Restriction> </rdfs:subClassOf> </daml:Class>

Page 17: Setting Up Namespaces

Notations for properties

<daml:UniqueProperty rdf:ID="hasMother"> <rdfs:subPropertyOf rdf:resource="#hasParent"/> <rdfs:range rdf:resource="#Female"/> </daml:UniqueProperty>

Page 18: Setting Up Namespaces

Notations for properties cont.1If x's parent is y, then y is x's child. This is defined

using the inverseOf tag.<daml:ObjectProperty rdf:ID="hasChild">

<daml:inverseOf rdf:resource="#hasParent"/> </daml:ObjectProperty>

The hasAncestor and descendent properties are transitive versions of the hasParent and hasChild properties.

<daml:TransitiveProperty rdf:ID="hasAncestor"> <rdfs:label>hasAncestor</rdfs:label> </daml:TransitiveProperty> <daml:TransitiveProperty rdf:ID="descendant"/>

Page 19: Setting Up Namespaces

Notations for properties cont.2

Sometimes, we like to refer to mothers using the synonym mom. The tag samePropertyAs allows us to establish this synonymy:

<daml:ObjectProperty rdf:ID="hasMom"> <daml:samePropertyAs rdf:resource="#hasMother"/> </daml:ObjectProperty>

Page 20: Setting Up Namespaces

Notations for classes

• <daml:Class rdf:ID="Car"> <rdfs:comment>no car is a person</rdfs:comment>

• <rdfs:subClassOf> <daml:Class> <daml:complementOf rdf:resource="#Person"/> </daml:Class> </rdfs:subClassOf>

Page 21: Setting Up Namespaces

Notations for classes cont.1

An even more compact idiom is to state that a whole set of classes are all pairwise disjoint. Rather than stating the individual disjointness relations, this can be stated for a set of classes in a single statement:

<daml:Disjoint rdf:parseType="daml:collection"> <daml:Class rdf:about="#Car"/> <daml:Class rdf:about="#Person"/> <daml:Class rdf:about="#Plant"/> </daml:Disjoint>

Page 22: Setting Up Namespaces

Notations for classes cont.2

We can also identify a Class with the disjoint union of a set of other classes. In this case, we identify the Class Person with the disjoint union of the Classes Man and Woman.

<daml:Class rdf:about="#Person"> <rdfs:comment>every person is a man or a woman

</rdfs:comment> <daml:disjointUnionOf

rdf:parseType="daml:collection"> <daml:Class rdf:about="#Man"/> <daml:Class rdf:about="#Woman"/>

</daml:disjointUnionOf> </daml:Class>

Page 23: Setting Up Namespaces

Notations for classes cont.3

We have already seen that we can construct a new class by taking the complementOf another class. In the same way, we can construct classes out of the intersection of other classes:<daml:Class rdf:ID="TallMan"> <daml:intersectionOf rdf:parseType="daml:collection"> <daml:Class rdf:about="#TallThing"/> <daml:Class rdf:about="#Man"/> </daml:intersectionOf> </daml:Class>

Page 24: Setting Up Namespaces

Notations for classes cont.4

Similarly, we can construct a class as the unionOf a set of classes:<daml:Class rdf:ID="MarriedPerson"> <daml:intersectionOf rdf:parseType="daml:collection"> <daml:Class rdf:about="#Person"/> <daml:Restriction daml:cardinality="1"> <daml:onProperty rdf:resource="#hasSpouse"/> </daml:Restriction> </daml:intersectionOf> </daml:Class>

Page 25: Setting Up Namespaces

Notations for classes cont.5

Just as for properties, a mechanism exists for declaring synonyms for classes:

<daml:Class rdf:ID="HumanBeing"> <daml:sameClassAs rdf:resource="#Person"/> </daml:Class>

Page 26: Setting Up Namespaces

Using User-defined Datatypes

<xsd:simpleType name="over59"> <!-- over59 is an XMLS datatype based on positiveIntege --> <!-- with the added restriction that values must be >= 59 --> <xsd:restriction base="xsd:positiveInteger"> <xsd:minInclusive

value="60"/> </xsd:restriction> </xsd:simpleType>Then we could reference elements of this file in DAML+OIL restrictions, <daml:Class rdf:ID="Senior"> <daml:intersectionOf rdf:parseType="daml:collection"> <daml:Class rdf:about="#Person"/> <daml:Restriction>

<daml:onProperty rdf:resource="#age"/> <daml:hasClass rdf:resource="http://www.daml.org/2001/03/daml+oil-

ex-dt#over59"/> </daml:Restriction> </daml:intersectionOf> </daml:Class>

Page 27: Setting Up Namespaces

Defining individuals

• We can also define individual objects in a class, e.g., Adam, a person of age 13 and shoesize 9.5:<Person rdf:ID="Adam"> <rdfs:label>Adam</rdfs:label> <rdfs:comment> Adam is a person.</rdfs:comment> <age><xsd:integer rdf:value="13"/></age><shoesize><xsd:decimal rdf:value="9.5"/></shoesize> </Person>

Page 28: Setting Up Namespaces

Defining individuals cont.1

A Person has a property called hasHeight, which is a Height. (hasHeight is a Property, or relation; Height is a Class, or kind of thing.)

<daml:ObjectProperty rdf:ID="hasHeight"> <rdfs:range rdf:resource="#Height"/> </daml:ObjectProperty>

Page 29: Setting Up Namespaces

Defining individuals cont.2

Height is a Class described by an explicitly enumerated set. We can describe this set using the oneOf element. Like disjointUnionOf, oneOf uses the RDF-extending parsetype="daml:collection".

<daml:Class rdf:ID="Height"> <daml:oneOf rdf:parseType="daml:collection"> <Height rdf:ID="short"/> <Height rdf:ID="medium"/> <Height rdf:ID="tall"/> </daml:oneOf> </daml:Class>

Page 30: Setting Up Namespaces

Defining individuals cont.3Finally, TallThing is exactly the class of things whose

hasHeight has the value tall: <daml:Class rdf:ID="TallThing"> <daml:sameClassAs> <daml:Restriction> <daml:onProperty rdf:resource="#hasHeight"/> <daml:hasValue rdf:resource="#tall"/> </daml:Restriction> </daml:sameClassAs> </daml:Class>

Page 31: Setting Up Namespaces

Defining individuals cont.4

• <daml:DatatypeProperty rdf:ID="shirtsize"> <rdfs:comment> shirtsize is a DatatypeProperty whose range is clothingsize. </rdfs:comment> <rdf:type rdf:resource="http://www.daml.org/2001/03/daml+oil#UniqueProperty"/> <rdfs:range rdf:resource="http://www.daml.org/2001/03/daml+oil-ex-dt#clothingsize"/> </daml:DatatypeProperty> <daml:DatatypeProperty rdf:ID="associatedData"> <rdfs:comment> associatedData is a DatatypeProperty without a range restriction. </rdfs:comment> </daml:DatatypeProperty>

Page 32: Setting Up Namespaces

Defining individuals cont.5

• <rdfs:Class rdf:ID="BigFoot"> <rdfs:comment> BigFoots (BigFeet?) are exactly those persons whose shosize is over12. </rdfs:comment> <daml:intersectionOf rdf:parseType="daml:collection"> <rdfs:Class rdf:about="#Person"/> <daml:Restriction> <daml:onProperty rdf:resource="#shoesize"/> <daml:hasClass rdf:resource="http://www.daml.org/2001/03/daml+oil-ex-dt#over12"/> </daml:Restriction> </daml:intersectionOf> </rdfs:Class>

Page 33: Setting Up Namespaces

Defining individuals cont.6

• <daml:Class rdf:about="#Person"> <rdfs:comment> Persons have at most 1 item of associatedData </rdfs:comment> <rdfs:subClassOf> <daml:Restriction> <daml:onProperty rdf:resource="#associatedData"/> <daml:maxCardinality>1</daml:maxCardinality> </daml:Restriction> </rdfs:subClassOf> </daml:Class>

Page 34: Setting Up Namespaces

Defining individuals cont.7

Now we can (try to) create several individuals. • <Person rdf:ID="Ian"> <shoesize>14</shoesize>

<age>37</age> <shirtsize><xsd:string rdf:value="12"/></shirtsize> </Person>

• <Person rdf:ID="Peter"> <shoesize>9.5</shoesize> <age>46</age> <shirtsize>15</shirtsize> </Person>

• <Person rdf:ID="Santa"> <associatedData><xsd:real rdf:value="3.14159"/></associatedData> <associatedData><xsd:string rdf:value="3.14159"/></associatedData> </Person>