rigoris Antoniou and Frank van Harmelen rdfs Resource rdfs: Class rdf: Property owl Class owl: Object Propert Fig. 1. Subclass relationships between OWL and RDF/RDFS The original hope in the design of owl was that there would be a down- ward compatibility with corresponding re-use of software across the various layers. However, the advantage of full downward compatibility for OWL(that any OWl aware processor will also provide correct interpretations of any RDF Schema document) is only achieved for OWL Full, at the cost of computa tional intractability Chapter overview Section 2 presents OWL in some detail. Because OWL is such a new language, only very limited examples of its use have been published. Section 3 therefore lustrates the lang 2 The OWL Lang OWL builds on RDF and RDF Schema, and uses RDF's XML syntax. Since this is the primary syntax for OWL, we will use it here, but it will soon become clear that RDF/XML does not provide a very readable syntax. Because of this other syntactic forms for Owl have also been defined an XML-based syntax which does not follow the RDF conventions. This makes this syntax already significantly easier to read by humans an abstract syntax which is used in the language specification document This syntax is much more compact and readable then either the XML syntax or the RDF/XML synta a graphical syntax based on the conventions of the UML language(Uni- versal Modelling Language). Since UML is widely used, this will be an easy way for people to get familiar with OWL
6 Grigoris Antoniou and Frank van Harmelen rdfs:Class owl:Class owl:ObjectProperty owl:DatatypeProperty rdf:Property rdfs:Resource Fig. 1. Subclass relationships between OWL and RDF/RDFS The original hope in the design of OWL was that there would be a downward compatibility with corresponding re-use of software across the various layers. However, the advantage of full downward compatibility for OWL (that any OWL aware processor will also provide correct interpretations of any RDF Schema document) is only achieved for OWL Full, at the cost of computational intractability. Chapter overview Section 2 presents OWL in some detail. Because OWL is such a new language, only very limited examples of its use have been published. Section 3 therefore illustrates the language by giving a few examples. 2 The OWL Language Syntax OWL builds on RDF and RDF Schema, and uses RDF’s XML syntax. Since this is the primary syntax for OWL, we will use it here, but it will soon become clear that RDF/XML does not provide a very readable syntax. Because of this, other syntactic forms for OWL have also been defined: • an XML-based syntax which does not follow the RDF conventions. This makes this syntax already significantly easier to read by humans. • an abstract syntax which is used in the language specification document. This syntax is much more compact and readable then either the XML syntax or the RDF/XML syntax • a graphical syntax based on the conventions of the UML language (Universal Modelling Language). Since UML is widely used, this will be an easy way for people to get familiar with OWL
Web Ontology Language: OWL OWL documents are usually called OWL ontologies, and are RDF documents So the root element of a OWl ontology is an rdf: RDF element which als specifies a number of namespaces. For example xmlns:owl=http://www.w3.org/2002/07/owl# xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#" //www xmlns:xsd=http://www.w3.org/2001/xlmschema#"> An OWL ontology may start with a collection of assertions for hous keeping purposes. These assertions are grouped under an owl: Ontology ele- ment which contains comments version control and inclusion of other ontolo- gies. For example <owl: Ontology rdf: about=> <rdfs: comment>An example OWL ontology </rdfs: comment> <owl: priorVersion rdfresource="http://www.mydomain.org/uni-ns-old"/ <owl:importsrdfresource="http://www.mydomain.org/persons"/> <rdfs: label>University Ontology</rdfs: label> </owl: Ontology> The only of these assertions which has any consequences for the logical meaning of the ontology is owl: imports: this lists other ontologies whose content is assumed to be part of the current document ontology. Notice that while namespaces are used for disambiguation purposes, imported ontologies provide definitions that can be used. Usually there will be an import element for each used namespace, but it is possible to import additional ontologies for example ontologies that provide definitions without introducing any new Also note that owl: imports is a transitive property: if ontology A imports B and ology C Class elements Classes are defined using a owl: Class element. For example, we can define <owl: Class rdf: ID=associat r"> academicStaffMember"/> </owl: Class> owl: Class is a subclass of rdfs: Class
Web Ontology Language: OWL 7 Header OWL documents are usually called OWL ontologies, and are RDF documents. So the root element of a OWL ontology is an rdf:RDF element which also specifies a number of namespaces. For example: <rdf:RDF xmlns:owl ="http://www.w3.org/2002/07/owl#" 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/2001/XLMSchema#"> An OWL ontology may start with a collection of assertions for housekeeping purposes. These assertions are grouped under an owl:Ontology element which contains comments, version control and inclusion of other ontologies. For example: <owl:Ontology rdf:about=""> <rdfs:comment>An example OWL ontology</rdfs:comment> <owl:priorVersion rdf:resource="http://www.mydomain.org/uni-ns-old"/> <owl:imports rdf:resource="http://www.mydomain.org/persons"/> <rdfs:label>University Ontology</rdfs:label> </owl:Ontology> The only of these assertions which has any consequences for the logical meaning of the ontology is owl:imports: this lists other ontologies whose content is assumed to be part of the current document. ontology. Notice that while namespaces are used for disambiguation purposes, imported ontologies provide definitions that can be used. Usually there will be an import element for each used namespace, but it is possible to import additional ontologies, for example ontologies that provide definitions without introducing any new names. Also note that owl:imports is a transitive property: if ontology A imports ontology B, and ontology B imports ontology C, then ontology A also imports ontology C. Class elements Classes are defined using a owl:Class element 7 . For example, we can define a class associateProfessor as follows: <owl:Class rdf:ID="associateProfessor"> <rdfs:subClassOf rdf:resource="#academicStaffMember"/> </owl:Class> 7 owl:Class is a subclass of rdfs:Class
8 Grigoris Antoniou and Frank van Harmelen We can also say that this class is disjoint from the professor and assistantProfessor classes using owl: disjointWith elements. These ele. ments can be included in the definition above, or can be added by referring to the id using rdf: about. This mechanism is inherited from RdF. <owl: Class rdf: about=associateProfessor > <owl: disjointWith rdf: resource=#professor"/> <owl: disjointWith rdf: resource=#assistantProfessor"/ </owl: Class> Equivalence of classes can be defined using a owl: equivalentClass element <owl: Class rdf: ID="faculty"> Cowl: equivalentclass rdf: resource=#academicStaffMember"/> Finally, there are two predefined classes, owl: Thing and owl: Nothing. The former is the most general class which contains everything (everything is a thing), the latter is the empty class. Thus every class is a subclass of owl: Thing and a superclass of owl: Nothing Property elements In OWl there are two kinds of properties Object properties which relate objects to other objects Examples are is TaughtBy, supervises et Datatype properties which relate objects to datatype values Examples are phone, title, age etc. OWL does not have any predefined data types, nor does it provide special definition facilities. Instead it al- lows one to use XML Schema data types, thus making use of the layered architecture the Semantic Web Here is an example of a datatype property. <owl: DatatypeProperty rdf: ID=age"> <rdfs:rangerdfresource=http://www.w3.org/2001/xlmscher </owl: Datatype Property User-defined data types will usually be collected in an XML schema, and then used in an OWL ontology. Here is an <owl: ObjectProperty rdf: ID=isTaughtBy"> <owl: domain rdf: resource=#course"/> <owl: range rdf: resource=#academicStaffMember "/: <rdfs: subPropertyOf rdf: resource=#involves"/> </owl: ObjectProperty>
8 Grigoris Antoniou and Frank van Harmelen We can also say that this class is disjoint from the professor and assistantProfessor classes using owl:disjointWith elements. These elements can be included in the definition above, or can be added by referring to the id using rdf:about. This mechanism is inherited from RDF. <owl:Class rdf:about="associateProfessor"> <owl:disjointWith rdf:resource="#professor"/> <owl:disjointWith rdf:resource="#assistantProfessor"/> </owl:Class> Equivalence of classes can be defined using a owl:equivalentClass element: <owl:Class rdf:ID="faculty"> <owl:equivalentClass rdf:resource="#academicStaffMember"/> </owl:Class> Finally, there are two predefined classes, owl:Thing and owl:Nothing. The former is the most general class which contains everything (everything is a thing), the latter is the empty class. Thus every class is a subclass of owl:Thing and a superclass of owl:Nothing. Property elements In OWL there are two kinds of properties: • Object properties which relate objects to other objects. Examples are isTaughtBy, supervises etc. • Datatype properties which relate objects to datatype values. Examples are phone, title, age etc. OWL does not have any predefined data types, nor does it provide special definition facilities. Instead it allows one to use XML Schema data types, thus making use of the layered architecture the Semantic Web Here is an example of a datatype property. <owl:DatatypeProperty rdf:ID="age"> <rdfs:range rdf:resource="http://www.w3.org/2001/XLMSchema #nonNegativeInteger"/> </owl:DatatypeProperty> User-defined data types will usually be collected in an XML schema, and then used in an OWL ontology. Here is an example of an object property: <owl:ObjectProperty rdf:ID="isTaughtBy"> <owl:domain rdf:resource="#course"/> <owl:range rdf:resource="#academicStaffMember"/> <rdfs:subPropertyOf rdf:resource="#involves"/> </owl:ObjectProperty>
Web Ontology Language: OWL More than one domain and range may be declared. In this case the intersection of the domains, respectively ranges, is taken. oWL allows us to relate "inverse properties". A typical example s TaughtBy and teaches <owl: ObjectProperty rdf y ID="teaches"> <rdfs: range rdf: resource=#course"/> <rdfs: domain rdf: resource="#academicStaffMember"/ <owl: inverseOf rdf: resource=#isTaughtBy"/> /owl: Obj Actually domain and range can be inherited from the inverse property(inter change domain with range Equivalence of properties can be defined using a owl: equivale <owl: ObjectProperty rdf: ID="lecturesIn"> /owl: ObjectProperty> Property restrictions With rdfs: subClassOf we can specify a class C to be subclass of another class C; then every instance of C is also an instance of C con Now suppose we wish to declare, instead, that the class C satisfies certain ditions, that is, all instances of C satisfy the conditions. Obviously it is equivalent to saying that C is subclass of a class C, where C collects all objects that satisfy the conditions. That is exactly how it is done in OWl as we will show. Note that, in general, C can remain anonymous, as we will explain below. The following element requires first year courses to be taught by profess only(according to a questionable view, older and more senior academics are better <owl: Class rdf: about=#firstYear Course "> <rdfs: subClassof> <owl: Restriction> <owl: onProperty rdf: resource=#isTaughtBy"/> fowl: allvaluesFrom rdf: resource=#Professor"/> <owl: Restriction> </rdfs: subClassOf> <owl: Class> owl: allvaluesFrom is used to specify the class of possible values the property specified by owl: on Property can take(in other words: all values of the prop- erty must come from this class). In our example, only professors are allowed as values of the property isTaughtBy We can declare that mathematics courses are taught by david Billington as follows
Web Ontology Language: OWL 9 More than one domain and range may be declared. In this case the intersection of the domains, respectively ranges, is taken. OWL allows us to relate “inverse properties”. A typical example is isTaughtBy and teaches. <owl:ObjectProperty rdf:ID="teaches"> <rdfs:range rdf:resource="#course"/> <rdfs:domain rdf:resource="#academicStaffMember"/> <owl:inverseOf rdf:resource="#isTaughtBy"/> </owl:ObjectProperty> Actually domain and range can be inherited from the inverse property (interchange domain with range). Equivalence of properties can be defined using a owl:equivalentProperty element. <owl:ObjectProperty rdf:ID="lecturesIn"> <owl:equivalentProperty rdf:resource="#teaches"/> </owl:ObjectProperty> Property restrictions With rdfs:subClassOf we can specify a class C to be subclass of another class C 0 ; then every instance of C is also an instance of C 0 . Now suppose we wish to declare, instead, that the class C satisfies certain conditions, that is, all instances of C satisfy the conditions. Obviously it is equivalent to saying that C is subclass of a class C 0 , where C 0 collects all objects that satisfy the conditions. That is exactly how it is done in OWL, as we will show. Note that, in general, C 0 can remain anonymous, as we will explain below. The following element requires first year courses to be taught by professors only (according to a questionable view, older and more senior academics are better at teaching). <owl:Class rdf:about="#firstYearCourse"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#isTaughtBy"/> <owl:allValuesFrom rdf:resource="#Professor"/> </owl:Restriction> </rdfs:subClassOf> </owl:Class> owl:allValuesFrom is used to specify the class of possible values the property specified by owl:onProperty can take (in other words: all values of the property must come from this class). In our example, only professors are allowed as values of the property isTaughtBy. We can declare that mathematics courses are taught by David Billington as follows: