420 likes | 457 Views
Learn the structure of OWL ontology files, including header, body, and footer. Understand the importance of namespaces, XML declaration, and the ontology element in encoding OWL ontologies. Follow best practices for ontology file organization and metadata inclusion.
E N D
OWL Representing Information Using the Web Ontology Language
Section 3 • Chapter 11: Encoding an OWL Ontology • Organization of OWL files • Chapter 12: Defining OWL Lite Classes & Properties • Definition of simple classes; pre-defined OWL classes • Chapter 13: Describing OWL Lite Property Characteristics • Global & local property restrictions; inference shortcuts • Chapter 14: Deriving OWL Lite Classes • Class descriptions, subclasses, equivalency, intersections • Chapter 15: Describing Individuals • Unique names assumption; instantiate, relate individuals • Chapter 16: OWL Lite Summary • Summary of OWL Lite constructs
11 Encoding an OWL Ontology • OWL Ontology encodings • Defined in web documents • Referenced using URI • Developed like software (requirements, design) • Use one of the OWL dialects • Use RDF/XML syntax • Describe classes & properties • OWL knowledge base • Ontology • Instance data • Datatypes • Chapter describes OWL ontology file structure • Header • Body • Footer
11.1 OWL Ontology File Structure • Figure shows • Relationship between ontology files, namespaces, & related files • Distribution of ontology files on web servers • Ontologies can extend other ontologies hosted across network • Instances • Reference ontologies • Ontologies • Extend/reuse ontologies • Built on XMLS datatypes
11.1 Ontology File Structure cont’d • OWL documents • Best practice: use .owl extension • Include • owl:Ontology element • Class definitions • Property definitions • Typical format • Header • Body • Footer
11.2 OWL Header • OWL ontology file begins with header • Specifies RDF start tag <rdf> • Includes namespace attributes • Includes ontology element • Contains versioning & imports
11.2.1 XML Declaration & RDF Tag • OWL ontologies represented using RDF/XML • Best practice: begin file with • XML declaration including version and encoding • <?xml version="1.0" encoding="UTF-8"?> • <rdf:RDF> start tag containing namespace declarations • <rdf:RDF namespaceDeclarations> • Defined in the next section
11.2.2 Namespaces for OWL Ontologies • Namespace declarations • Attributes of <rdf:RDF> start tag • Identify abbreviated references in ontology file • Make file more readable for humans • Can be used in tag & attribute names, not values • Use XML entities for values, if desired • 3 types of namespaces • Standard namespace references • Part of OWL standard: XMLS, RDF, RDFS, OWL • Namespaces associated with imported ontologies • Setup shorthand abbreviations to reference URIs • Namespaces identifying ontology being defined • Defined implicitly by document URI, explicitly by “xml:base”, or “xmlns” attribute
11.2.2 Ontology Namespaces cont’d • Best practice • Order namespaces from bottom to top • XMLS (for datatypes) • RDF • RDFS • OWL • Reused ontologies • Extended ontologies • Current ontology
11.2.2 Ontology Namespaces cont’d • XML Schema Datatypes namespace (xsd prefix) • xmlns:xsd="http://www.w3.org/XMLSchema#" • RDF namespace (rdf prefix) • xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" • RDFS namespace (rdfs prefix) • xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" • OWL namespace (owl prefix) • xmlns:owl="http://www.w3.org/2002/07/owl#" • Imported namespace (user-defined prefix) • xmlns:pasta="http://www.food.org/pastaDishes#" • Ontology namespace (user-defined prefix) • xmlns="http://www.food.org/food-ex#" or • URI of containing document or • Value of xml:base attribute
11.2.2 Ontology Namespaces cont’d • xml:base attribute used to expand RDF URIrefs • Best practice: Either • Include xml:base in ontology file or • Use fully-resolved URIs in rdf:about attribute values • Example • <rdf:RDF xmlns:xsd="http://www.w3.org/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:pasta="http://www.food.org/pastaDishes#" xmlns="http://www.food.org/food-ex#" xml:base="http://www.food.org/food-ex#">
11.2.3 Ontology Element • owl:Ontology element • Built-in class used to instantiate ontologies • Header only, not classes, properties, instances • Optional but recommended • Provides metadata including • Version information • Imports • RDF comments • Should include rdf:about attribute • Empty value ("") means current ontology • Default name: URI of document, unless xml:base specified
11.2.3 Ontology Element cont’d • owl:Ontology element • Recommended practices • Give name using rdfs:label property • Comment using rdfs:comment property • Syntax • <owl:Ontology rdf:about="optionalOntologyName"></owl:Ontology> • Example • <owl:Ontology rdf:about=""> <rdfs:label>Restaurant Menu</rdfs:label> <rdfs:comment>Describes basic concepts representing a restaurant’s menu</rdfs:comment></owl:Ontology>
11.2.3.1 Versioning Information • OWL provides explicit versioning info including • Ontology-level versioning • Compatibility statements about previous versions • Deprecation declarations • Classes & properties for backward compatibility
11.2.3.1.1 Version Information • owl:versionInfo property • String representing ontology’s version • Can use RCS, CVS, Subversion keywords (see example) • Documentation comment; no logical meaning • Normally used for ontologies but can be applied to any owl:Thing • Best practice: use owl:versionInfo in each OWL document • May eventually evolve into parseable “Dublin Core” items • Domain: Instance of owl:Thing, Range: Instance of rdfs:Literal • Syntax • <owl:versionInfo>versionText</owl:versionInfo> • Example • <owl:Ontology> <owl:versionInfo>$Id: restaurantMenu-ont.owl,v 1.2 2004/08/30 12:34:56 llacy Exp$</owl:VersionInfo></owl:Ontology>
11.2.3.1.1.1 Indicating Earlier Version • owl:priorVersion property • Relates newer version to previous version • Tracks ontology version history • Domain & Range: Instance of owl:Ontology • Syntax • <owl:priorVersion rdf:resource="priorOntURI"/> • Example • <owl:Ontology rdf:about=""> <owl:priorVersion rdf:resource="http://www.food.org/pasta0603-ont"/></owl:Ontology>
11.2.3.1.1.2 Backward-Compatibility • owl:backwardCompatibleWith property • Explicitly states that all constructs in this version have the same meaning as in the prior version • Subproperty of owl:priorVersion • If not explicitly stated, incompatibility assumed • Domain & Range: Instance of owl:Ontology • Syntax • <owl:backwardCompatibleWith rdf:resource="olderOntURI"/> • Example • <owl:Ontology rdf:about=""> <owl:backwardCompatibleWith rdf:resource="&kor;Menu062204-ont"/> <rdfs:comment>added new menu items since 06/22/04</rdfs:comment></owl:Ontology>
11.2.3.1.1.3 Incompatible Ontologies • owl:incompatibleWith property • Identifies prior versions that this ontology supersedes and is inconsistent with • Subproperty of owl:PriorVersion • Best practice: include incompatibility comments • Domain & Range: Instance of owl:Ontology • Syntax • <owl:incompatibleWith rdf:resource="olderOntURI"/> • Example • <owl:Ontology rdf:about=""> <owl:incompatibleWith rdf:resource="&kor;Menu062204-ont"/> <rdfs:comment>added new menu items</rdfs:comment></owl:Ontology>
11.2.3.1.1.4 Deprecating Classes • owl:DeprecatedClass class • Identifies classes no longer supported in future versions • Supports short-term compatibility • Existing ontologies should upgrade to new concepts as soon as possible • Signals long-term incompatibility • New ontologies should not reference deprecated classes • No semantics; treated as comment by parser • Best practice: provide comment indicating replacement class • Syntax • <owl:DeprecatedClass rdf:about="OldClassName"> • Example • <owl:DeprecatedClass rdf:about="#Pie"> <rdfs:comment>Use DessertPie instead</rdfs:comment></owl:DeprecatedClass>
11.2.3.1.1.5 Deprecating Properties • owl:DeprecatedProperty class • Identifies properties no longer supported in future versions • Same concepts as owl:DeprecatedClass • Best practice: provide comment indicating replacement property • Syntax • <owl:DeprecatedProperty rdf:about="oldPropertyName"> • Example • <owl:DeprecatedProperty rdf:about="#cost"> <rdfs:comment>Use menuPrice instead</rdfs:comment></owl:DeprecatedProperty>
11.2.3.1.1.6 Versioning Summary • Versioning constructs • Documentation only • Do not provide additional semantics • Not intended for use by inferencing engines
11.2.3.2 Importing Ontologies • owl:imports property • Allows an ontology to reference and extend another ontology • Supports incremental & distributed ontologies • Similar to “include”/“import” in programming languages • Introduces dependencies • Made in the ontology element of importing ontology • Domain & Range: Instance of owl:Ontology • OWL ontology always implicitly imported • Syntax • <owl:imports rdf:resource="URIofImportedOntology"/> • Example • <owl:imports rdf:resource="http://ut.edu/ont/fruit-ont"/>
11.2.3.2 Namespace vs. Imports cont’d • Namespace declarations • Create prefix abbreviations for identifiers • owl:imports properties • Include all constructs from ontology referenced in URI • Use namespace declaration to create shortened names to reference ontology constructs • Example • <rdf:RDF xmlns:pasta="http://www.food.org/pastaDishes#"> • <owl:Ontology about=""> <owl:imports rdf:resource="http://www.food.org/pastaDishes"/></owl:Ontology>
11.2.3.2 Imports Rules cont’d • Multiple imports permitted • owl:imports are transitive • A imports B • B imports C • Therefore A imports C • No effect if ontology imports itself (prevents cycles) • If A imports B and B imports A, A and B are equivalent • If imported ontology not accessible at specified URI during runtime, it may prevent use of importing ontology
11.2.3.3 Ontology Element Summary • owl:Ontology element provides metadata • Version information (owl:versionInfo & related) • Name (rdfs:label property) • Descriptive comments (rdfs:comment property) • Imported ontologies (owl:imports property) • Example complete ontology element • <owl:Ontology rdf:about=""> <owl:versionInfo>v 1.2 2004/10/24</owl:versionInfo> <rdfs:comment>Restaurant Menu ontology</rdfs:comment> <owl:imports rdf:resource="&rest;2004/08/food-ont"/> <owl:priorVersion rdf:resource="&rest;2004/07/Menu-ont"/> <owl:incompatibleWith rdf:resource="&rest;2004/06/Menu-ont"/> <owl:backwardCompatibleWith rdf:resource="&rest;2004/07/Menu-ont"/><owl:Ontology>
11.2.4 OWL Header Summary • OWL file header contains • RDF tag and namespace properties • owl:Ontology element
11.3-4 OWL File Body & Footer • OWL file body • Contains class & property definitions • Classes derive from owl:Class; share similar properties • Values are XMLS datatypes or object instances • Properties define relationships between classes & values • Order is not important • Forward references are permitted • Co-occurring statements assumed to be conjunctive (AND) • “Open World Assumption” • Anything that is not explicitly stated cannot be assumed to be either true or false. Statements can only be added, not deleted. • Limits inferencing and deductive power • OWL files end with </rdf:RDF> end tag
11.5 OWL Encoding Summary • OWL ontologies specified through statements in ontology files • Ontology files contain • Header contains • Namespaces • Versioning Information • Import Statements • Body contains statements about • Classes • Properties • Relationships • Footer (rdf:RDF end tag)
12 Defining Basic Classes & Properties • OWL Lite classes • Based on owl:Class, a richer subclass of rdfs:Class • 2 basic class types • Simple named classes • Predefined classes • owl:Thing, owl:Nothing • OWL Lite properties • Based on rdf:Property • 4 basic property types • owl:DatatypeProperty, owl:ObjectProperty, owl:AnnotationProperty, owl:OntologyProperty
12.1 Defining a Simple Named Class • Simple named classes • Defined with owl:Class element & rdf:ID attribute • Does nothing but declare a name (URI) • Within same file, often referenced by fragment (#classname) • All statements about a class apply to its individuals • Best practices: • Name using UpperCamelCase • Use rdfs:label and rdfs:comment to document • Syntax • <owl:Class rdf:ID="className"/> • Example • <owl:Class rdf:ID="KeyLimePie"> <rdfs:label>Key Lime Pie</rdfs:label> <rdfs:comment>Custard pie made with Key lime juice</rdfs:comment></owl:Class>
12.2 Predefined OWL Classes • OWL defines two “extreme” classes • owl:Thing • Used in statements that apply to all instances • owl:Nothing • Used in statements that apply to no instances
12.2.1 Thing Class • owl:Thing class • Most general class in OWL • Root class for all classes • Even rdf:Resource, root class of RDF • Every individual is a member of owl:Thing • Every class is a subclass of owl:Thing • Equal to the union of any class and its complement • Set equivalent of “universe” • Can be used to make global assertions
12.2.2 Nothing class • owl:Nothing class • Subclass of all classes • Empty class • No member individuals • Set equivalent of “null set”
12.3 Describing OWL Lite Properties • Properties • Are binary relations from one individual (domain) to another individual or a value (range) • Enable specification of facts (attribute/value pairs) • Four disjoint property types in OWL • Datatype properties relate objects to datatype values • Object properties relate objects to other objects • Annotation properties describe objects • Ontology properties relate ontologies to other ontologies
12.3.1 Datatype Properties • owl:DatatypeProperty class • Identifies a property whose value is a member of a datatype (typed or untyped literals) • Strings or simple XMLS datatypes • Reasoners use them to interpret a statement’s datatype value • Syntax • <owl:DatatypeProperty rdf:ID="propertyName"/> • Example (specification) • <owl:DatatypeProperty rdf:ID="restCloseTime"> <rdfs:domain rdf:resource="#Restaurant"/> <rdfs:range rdf:resource="&xsd;time"/></owl:DatatypeProperty> • Example (use) • <rest:Restaurant rdf:ID="JoesPizza"> <restCloseTime rdf:datatype="&xsd;time">21:00:00+01:00</restCloseTime></rest:Restaurant>
12.3.2 Object Properties • owl:ObjectProperty class • Identifies property whose value is reference to another individual • Value is a resource • Points Reasoner to resource containing desired value • “What is the name of the owner of Knight Owl Restaurant?” (see below) • Syntax • <owl:ObjectProperty rdf:ID="propertyName"/> • Example (specification) • <owl:ObjectProperty rdf:ID="restOwnedBy"/> • Example (use) • <rest:Person rdf:ID="person123"> <personName>Jason Relles</personName></rest:Person> • <rest:Restaurant rdf:ID="KnightOwlRestaurant"> <ownedBy rdf:resource="#person123"/></rest:Restaurant>
12.3.3 Annotation Properties • owl:AnnotationProperty class • Identifies property that describes a construct • Superclass of rdfs:label, rdfs:comment, rdfs:seeAlso, rdfs:isDefinedBy, owl:versionInfo • Domain: named class, property, individual, or ontology • Range: individual, data literal, URIref • Syntax • <owl:AnnotationProperty rdf:about="uriRef"/> • Example • <owl:AnnotationProperty rdf:about="&rest;reviewer"/>
12.3.4 Ontology Properties • owl:OntologyProperty class • Relates two owl:Ontology instances • Superclass of owl:imports, owl:priorVersion, owl:backwardCompatibleWith, owl:incompatibleWith • Not often used in practice
12.4 Classes & Properties Summary • Basic classes are defined using owl:Class • owl:Thing is a universal root class & contains everything • owl:Nothing is a universal subclass & contains nothing • Datatype properties relate objects to literal values • Object properties relate objects to other objects • Annotation properties provide additional information • Ontology properties relate ontologies to other ontologies