OWL Web Ontology Language
Concrete Abstract Syntax

This version:
http://owl.man.ac.uk/2003/concrete/20031210
Latest version:
http://owl.man.ac.uk/2003/concrete/latest
Previous version:
http://owl.man.ac.uk/2003/concrete/20031031
Authors:
Sean Bechhofer, University of Manchester
Peter F. Patel-Schneider, Bell Labs Research, Lucent Technologies
Daniele Turi, University of Manchester

Abstract

The OWL Web Ontology Language Semantics and Abstract Syntax [OWL S&AS] document includes a presentation of an abstract syntax for OWL. The use of the term abstract syntax is somewhat of a misnomer, however, as the presentation is rather concrete. Not quite concrete enough, however, to fully describe a format that one can easily parse. In this document, we extend the grammar to provide a description of text-based concrete serialization for OWL ontologies.

Status of this document

This is a draft produced 10 December, 2003. Note that although this document relates to the OWL Web Ontology Language, it does not form part of the W3C WebOnt document set.


Table of contents


1. Introduction

The OWL Web Ontology Language Semantics and Abstract Syntax [OWL S&AS] document includes a presentation of an abstract syntax for OWL. This is intended primarily as a mechanism to enable the definition of the formal semantics of the language along with the mapping into the normative concrete serialization in terms of RDF triples.

The use of the term abstract syntax is somewhat of a misnomer, however, as the actual presentation given is rather concrete. It is not quite concrete enough, however, to fully describe a format that one can easily parse. A standardised plain text ASCII format for serialization of OWL ontologies is likely to prove useful — for example for presenting small example ontologies in tutorial material. A similar approach has been taken with RDF, where N-Triples [N-Triples] provides a plain text format for encoding RDF graphs. In this document, we extend the grammar to provide a description of text-based concrete serialization for OWL ontologies. We follow the conventions adopted in N-Triples to cover URI references and literal values.

2. Grammar

An OWL Concrete Abstract Syntax document is a sequence of Unicode characters encoded in UTF-8 defined by the grammar below. This grammar is based on that given in [OWL S&AS] with a number of extensions and a precise definition for literals and URI references. We include a new Namespace construct that relates a prefix to a URI. Namespace constructs have document scope. The following namespace prefixes are assumed to be predefined and can be used without definition:

  rdf	= http://www.w3.org/1999/02/22-rdf-syntax-ns#
  xsd	= http://www.w3.org/2001/XMLSchema#
  rdfs	= http://www.w3.org/2000/01/rdf-schema#
  owl	= http://www.w3.org/2002/07/owl#

Note that (unlike N3 grammars), we do not allow the use of _ as a prefix name.

ontology ::= namespace* 'Ontology(' ontologyID? directive* ')'
	   
directive ::= 'Annotation(' 
    ( ontologyPropertyID ontologyID 
      | annotationPropertyID URIreference
      | annotationPropertyID dataLiteral
      | annotationPropertyID individual ) 
    ')'
  | fact
  | axiom
	    
fact ::= individual 
  | 'SameIndividual(' individualID individualID+ ')'
  | 'DifferentIndividuals(' individualID individualID+ ')'

individual ::= 'Individual(' individualID? annotation* 
    ('type(' type ')')* value* ')'

value ::= 'value(' 
    ( individualvaluedPropertyID individualID
      | individualvaluedPropertyID  individual
      | datavaluedPropertyID  dataLiteral )
  ')'

type ::= description

axiom ::= 'Class(' classID  'Deprecated'? modality annotation* description* ')'
  | 'EnumeratedClass(' classID 'Deprecated'? annotation* individualID* ')'
  | 'DisjointClasses(' description description+ ')'
  | 'EquivalentClasses(' description description* ')'
  | 'SubClassOf(' description description ')'
  | 'Datatype(' datatypeID 'Deprecated'?  annotation* )'
  | 'DatatypeProperty(' datavaluedPropertyID 'Deprecated'? annotation*
      ('super(' datavaluedPropertyID ')' )* 'Functional'?
      ('domain(' description ')')* ('range(' dataRange ')')* ')'
  | 'ObjectProperty(' individualvaluedPropertyID 'Deprecated'? annotation* 
      ( 'super(' individualvaluedPropertyID ')')*
      ( 'inverseOf(' individualvaluedPropertyID ')' )? 'Symmetric'? 
      ( 'Functional' | 'InverseFunctional' | 'Transitive' )?
      ( 'domain(' description ')' )* 
      ( 'range(' description ')' )* 
     ')'
  | 'AnnotationProperty(' annotationPropertyID annotation* ')'
  | 'OntologyProperty(' ontologyPropertyID annotation* ')'
  | 'EquivalentProperties(' datavaluedPropertyID datavaluedPropertyID  
      datavaluedPropertyID* ')'
  | 'EquivalentProperties(' individualvaluedPropertyID individualvaluedPropertyID 
      individualvaluedPropertyID* ')'
  | 'SubPropertyOf(' datavaluedPropertyID  datavaluedPropertyID ')'
  | 'SubPropertyOf(' individualvaluedPropertyID  individualvaluedPropertyID ')'


annotation ::= 'annotation(' 
    ( annotationPropertyID URIreference
      | annotationPropertyID dataLiteral
      | annotationPropertyID individual )
  ')'      

modality ::= 'complete' | 'partial'

description ::= classID
  | restriction
  | 'unionOf(' description* ')'
  | 'intersectionOf(' description* ')'
  | 'complementOf(' description ')'
  | 'oneOf(' individualID* ')'

restriction ::= 'restriction(' 
    ( datavaluedPropertyID dataRestrictionComponent dataRestrictionComponent* 
      | individualvaluedPropertyID individualRestrictionComponent individualRestrictionComponent* 
    )
  ')'

dataRestrictionComponent ::= 'allValuesFrom(' dataRange ')'
  | 'someValuesFrom(' dataRange ')'
  | 'value(' dataLiteral ')'
  | cardinality

individualRestrictionComponent ::= 'allValuesFrom(' description ')'
  | 'someValuesFrom(' description ')'
  | 'value(' individualID ')'
  | cardinality 

cardinality ::= 'minCardinality(' non-negative-integer ')'
  | 'maxCardinality(' non-negative-integer ')'
  | 'cardinality(' non-negative-integer ')'

dataRange ::= datatypeID 
  | 'rdfs:Literal'
  | 'oneOf(' dataLiteral* ')'

datatypeID ::= URIreference
classID ::= URIreference
individualID ::= URIreference
ontologyID ::= URIreference
datavaluedPropertyID ::= URIreference
individualvaluedPropertyID ::= URIreference
annotationPropertyID ::= URIreference
ontologyPropertyID ::= URIreference

/****************************************************************
* The following rules are extensions to the original grammar 
* provided in the OWL S&AS document. 
* 
* They extend the grammar with a Namespace declaration and give
* a specification for URIreferences and dataLiterals.
****************************************************************/

namespace ::= 'Namespace(' prefix '=' '<' absoluteURI '>' ')'

URIreference ::= '<' absoluteURI '>' | qname
qname ::= prefix ':' localname
prefix ::= letter+
localname ::= letter (letter | number | '_')*
letter ::= Any Unicode Letter 
number ::= Any Unicode Number 

dataLiteral ::= langString | datatypeString  
langString ::= '"' string '"' ( '@' language )?  
datatypeString ::= '"' string '"' '^^' URIreference
language ::= [a-z]+ ('-' [a-z0-9]+ )* encoding a language tag.  

string ::= character* /* with escapes as defined below */
absoluteURI ::= character+ /* being a valid URI Reference */

/* Comments follow standard Java/C conventions, and can appear anywhere */

comment ::= '/*' character* '*/' | 
            '//' (character-'\n')*

character ::= Any Unicode character

/* string escapes:
  #x0022 '"' represented as \"
  #x005C '\' represented as \\
*/

The grammar is also available as a plain text file.

3. Examples

Below we present a simple example using the proposed syntax

Namespace(pp = <http://cohse.semanticweb.org/ontologies/people#>)

/* An example ontology. */

Ontology(
 Class(pp:bone partial)
 Class(pp:brain partial)
 Class(pp:whiteThing partial)

 Class(pp:plant partial)
 Class(pp:grass partial pp:plant)
 Class(pp:tree partial pp:plant)
 Class(pp:leaf partial restriction(pp:part_of someValuesFrom(pp:tree)))

 Class(pp:vehicle partial)
 Class(pp:bicycle partial pp:vehicle)
 Class(pp:bus partial pp:vehicle)
 Class(pp:car partial pp:vehicle)
 Class(pp:lorry partial pp:vehicle)
 Class(pp:truck partial pp:vehicle)
 Class(pp:van partial pp:vehicle)

 Class(pp:company partial)
 Class(pp:busCompany partial pp:company)
 Class(pp:haulageCompany partial pp:company)

 Class(pp:publication partial)
 Class(pp:magazine partial pp:publication)
 Class(pp:broadsheet partial pp:newspaper)
 Class(pp:qualityBroadsheet partial pp:broadsheet)
 Class(pp:tabloid partial pp:newspaper)
 Class(pp:redTop partial pp:tabloid)
 Class(pp:newspaper partial unionOf(pp:broadsheet pp:tabloid) pp:publication)

 Class(pp:male partial)
 Class(pp:female partial)
 Class(pp:young partial)
 Class(pp:adult partial)
 Class(pp:elderly partial pp:adult)

 Class(pp:pet complete restriction(pp:is_pet_of someValuesFrom(owl:Thing)))

 Class(pp:animal partial restriction(pp:eats someValuesFrom(owl:Thing)))

 /* Vegetarians do not eat animals or parts of animals */

 Class(pp:vegetarian complete 
    intersectionOf(pp:animal
      restriction(pp:eats allValuesFrom(complementOf(pp:animal)))
      restriction(pp:eats 
	 allValuesFrom(complementOf(restriction(pp:part_of 
					        someValuesFrom(pp:animal)))))))
 Class(pp:duck partial pp:animal)
 Class(pp:cat partial pp:animal)
 Class(pp:tiger partial pp:animal)
 Class(pp:dog partial restriction(pp:eats someValuesFrom(pp:bone)))
 Class(pp:sheep partial pp:animal restriction(pp:eats allValuesFrom (pp:grass)))
 Class(pp:giraffe partial pp:animal restriction(pp:eats allValuesFrom (pp:leaf)))
 Class(pp:cow partial pp:vegetarian)
 Class(pp:madCow complete 
    intersectionOf(pp:cow restriction(pp:eats 
	someValuesFrom(intersectionOf(pp:brain 
                restriction(pp:part_of someValuesFrom (pp:sheep)))))))

 Class(pp:person partial pp:animal)
 Class(pp:kid complete intersectionOf(pp:young pp:person))
 Class(pp:man complete intersectionOf(pp:person pp:male pp:adult))
 Class(pp:woman complete intersectionOf(pp:female pp:person pp:adult))
 Class(pp:oldLady complete intersectionOf(pp:elderly pp:female pp:person))
 Class(pp:oldLady partial 
    intersectionOf(restriction(pp:has_pet allValuesFrom(pp:cat)) 
		   restriction(pp:has_pet someValuesFrom(pp:animal))))
 Class(pp:grownup complete intersectionOf(pp:person pp:adult))

 Class(pp:animalLover complete // Someone who really likes animals
    intersectionOf(pp:person restriction(pp:has_pet minCardinality(3))))
 Class(pp:petOwner complete 
    intersectionOf(restriction(pp:has_pet someValuesFrom(pp:animal)) pp:person))
 Class(pp:catLiker complete 
    intersectionOf(restriction(pp:likes someValuesFrom(pp:cat)) pp:person))
 Class(pp:catOwner complete 
    intersectionOf(pp:person restriction(pp:has_pet someValuesFrom(pp:cat))))
 Class(pp:dogLiker complete 
    intersectionOf(restriction(pp:likes someValuesFrom(pp:dog)) pp:person))
 Class(pp:dogOwner complete 
    intersectionOf(restriction(pp:has_pet someValuesFrom(pp:dog)) pp:person))

 Class(pp:driver partial pp:adult)
 Class(pp:driver complete 
    intersectionOf(restriction(pp:drives someValuesFrom(pp:vehicle)) pp:person))
 Class(pp:lorryDriver complete 
    intersectionOf(restriction(pp:drives someValuesFrom(pp:lorry)) pp:person))
 Class(pp:haulageWorker complete 
  restriction(pp:works_for 
	someValuesFrom(unionOf(restriction(pp:part_of someValuesFrom(pp:haulageCompany))
		 pp:haulageCompany))))
 Class(pp:haulageTruckDriver complete 
    intersectionOf(pp:person 
	restriction(pp:drives someValuesFrom(pp:truck))
	restriction(pp:works_for 
	   someValuesFrom(
		restriction(pp:part_of someValuesFrom(pp:haulageCompany))))))
 Class(pp:vanDriver complete 
    intersectionOf(pp:person restriction(pp:drives someValuesFrom(pp:van))))
 Class(pp:busDriver complete 
    intersectionOf(pp:person restriction(pp:drives someValuesFrom(pp:bus))))
 Class(pp:whiteVanMan complete 
    intersectionOf(pp:man 
	restriction(pp:drives
	    someValuesFrom(intersectionOf(pp:whiteThing pp:van)))))
 Class(pp:whiteVanMan partial 
    restriction(pp:reads allValuesFrom (pp:tabloid)))

 DisjointClasses(pp:broadsheet pp:tabloid)
 DisjointClasses(pp:dog pp:cat)
 DisjointClasses(pp:young pp:adult)
 DisjointClasses(unionOf(pp:animal restriction(pp:part_of 
  						someValuesFrom (pp:animal)))
		 unionOf(pp:plant restriction(pp:part_of 
						someValuesFrom (pp:plant))))

 ObjectProperty(pp:likes)
 ObjectProperty(pp:drives)
 ObjectProperty(pp:eaten_by)
 ObjectProperty(pp:eats inverseOf(pp:eaten_by) domain(pp:animal)) 
 ObjectProperty(pp:works_for)
 ObjectProperty(pp:reads range(pp:publication))

 ObjectProperty(pp:has_parent)
 ObjectProperty(pp:has_father range(pp:man))
 ObjectProperty(pp:has_mother range(pp:woman))
 ObjectProperty(pp:has_child)

 ObjectProperty(pp:has_pet domain(pp:person) range(pp:animal))
 ObjectProperty(pp:is_pet_of inverseOf(pp:has_pet))
 ObjectProperty(pp:part_of)
 ObjectProperty(pp:has_part inverseOf(pp:part_of))

 DatatypeProperty(pp:service_number range(xsd:integer))

 SubPropertyOf(pp:has_mother pp:has_parent)
 SubPropertyOf(pp:has_pet pp:likes)
 SubPropertyOf(pp:has_father pp:has_parent)

 Individual(pp:Tom type(owl:Thing))
 Individual(pp:Dewey type(pp:duck))
 Individual(pp:Huey type(pp:duck))
 Individual(pp:Louie type(pp:duck))
 Individual(pp:Fido type(pp:dog))
 Individual(pp:Flossie type(pp:cow))
 Individual(pp:Fluffy type(pp:tiger))
 Individual(pp:Rex type(pp:dog) value(pp:is_pet_of pp:Mick))
 Individual(pp:Q123ABC type(pp:whiteThing) type(pp:van))
 Individual(pp:Tibbs type(pp:cat))

 Individual(pp:DailyMirror type(owl:Thing))
 Individual(pp:TheGuardian type(pp:broadsheet))
 Individual(pp:TheSun type(pp:tabloid))
 Individual(pp:TheTimes type(pp:broadsheet))

 Individual(pp:The42 type(pp:bus)
    value(pp:service_number "42"^^xsd:integer))

 Individual(pp:Kevin type(pp:person))
 Individual(pp:Fred type(pp:person) value(pp:has_pet pp:Tibbs))
 Individual(pp:Joe type(pp:person)
    type(restriction(pp:has_pet maxCardinality(1)))
    value(pp:has_pet pp:Fido))
 Individual(pp:Mick type(pp:male)
    value(pp:reads pp:DailyMirror)
    value(pp:drives pp:Q123ABC))
 Individual(pp:Minnie type(pp:elderly) type(pp:female)
    value(pp:has_pet pp:Tom))
 Individual(pp:Walt type(pp:person)
    value(pp:has_pet pp:Huey)
    value(pp:has_pet pp:Louie)
    value(pp:has_pet pp:Dewey))
)


References

[RDF Tests]
RDF Test Cases. Jan Grant and Dave Beckett, eds.
[N-Triples]
N-Triples. Jan Grant and Dave Beckett, eds.
[OWL S&AS]
OWL Web Ontology Language Semantics and Abstract Syntax. Peter F. Patel-Schneider, Patrick Hayes, Ian Horrocks. W3C Candidate Recommendation 18 August 2003.