1 / 34

Housekeeping

atalo
Download Presentation

Housekeeping

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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#"

  2. 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">

  3. 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>

  4. 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>

  5. 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>

  6. 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>

  7. 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>

  8. 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>

  9. 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 "

  10. 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>

  11. 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>

  12. 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>

  13. 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>

  14. Notations for properties <daml:UniqueProperty rdf:ID="hasMother"> <rdfs:subPropertyOf rdf:resource="#hasParent"/> <rdfs:range rdf:resource="#Female"/> </daml:UniqueProperty>

  15. Notations for properties cont.1 If 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"/>

  16. 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>

  17. 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>

  18. 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>

  19. 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>

  20. 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>

  21. 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>

  22. 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>

  23. 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>

  24. 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>

  25. 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>

  26. 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>

  27. Defining individuals cont.3 Finally, 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>

  28. 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>

  29. 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>

  30. 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>

  31. 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>

More Related