HOWL: Haystack's OWL

by David Huynh, August 24, 2003

HOWL is a language designed for authoring ontologies that are then compiled into metadata following the schema of (a subset of) the Web Ontology Language (OWL), as well as a few extensions specific to Haystack.

If you can think of a better name, please suggest.

Ontologies in Haystack have been thus far written mostly in Adenine, which is an extension of N3. Both Adenine and N3 follow the RDF triple format closely in their syntaxes. That is, ontology data is expressed as triples, as shown in the following examples written in Adenine:

add {
:Car
rdfs:isDefinedBy   :TransportationOntology ;
rdf:type   rdfs:Class ;
rdf:type   daml:Class ;
rdfs:subClassOf   :Vehicle ;
rdfs:label   "Car"

:licenceNumber
rdfs:isDefinedBy   :TransportationOntology ;
rdf:type   daml:DatatypeProperty ;
rdf:type   daml:UniqueProperty ;
rdfs:label   "Licence Number" ;
rdfs:domain   :Car ;
rdfs:range   xsd:string
}

While the code fragment above is certainly more concise than if the same data were expressed in the RDF/XML format, it is still desirable to shorten it further by restricting to the fixed and finite syntax of OWL. Consider a new language (obviously, HOWL) in which the data in the above code fragment can be expressed as follows:

ontology :TransportationOntology
class :Car extends :Vehicle
label "Car"
property :licenceNumber asUnique string
label "Licence Number"

HOWL's advantages are:

Furthermore, now that ontologies are separate from (imperative) code, it is much easier to make an Eclipse plugin that parses all HOWL files before other code files (Adenine, Mystique) and informs programmers of predicates and classes that are used but have not been declared.

HOWL files can also be processed for publishing Haystack ontologies to the world. In Adenine, ontologies and imperative code are intermingled and it is hard to separate the publishable metadata from the non-publishable (e.g. an on-click event handler).

Syntax, Roughly

I will not be specifying the syntax of HOWL formally, but I will instead use examples to illustrate its syntax below. HOWL is just like Adenine in how you can define prefixes and in how you write full and prefixed URIs and literals. HOWL is very different from Adenine in other aspects.

A HOWL file is hierarchical in organization, always starting from an ontology element, under which there are zero or more class elements and zero or more relation elements:

@prefix : <http://.../transportation#>

ontology :TransportationOntology
class :Car extends :Vehicle
label "Car"
comment "A car is a vehicle..."
property :licenceNumber asUnique string
label "Licence Number"
property :fourWheelDrive asUnique boolean defaultAs false
label "4-Wheel Drive"
property :wheel as 4 :Wheel
label "Wheel"

relation :soldBy from :Car, :Truck toUnique :Dealer
label "Sold By"

A class element can have zero or more property elements underneath it. The domain of these properties are the class, and their ranges are declared using one of the keywords as, asUnique, asOne, and asMany. The keyword asUnique indicates a maximum cardinality of 1; and the keyword asOne indicates a (fixed) cardinality of 1. The keyword asMany places no restriction on cardinality while the keyword as allows a fixed cardinality to be specified. These keywords can be followed by a URI (e.g. :Wheel) or by a type keyword (e.g. boolean).

The keyword label can be used to specify the rdfs:label attribute of a class.

Relational properties (as opposed to proprietal properties) can be specified using the relation element. A relational property's domains are specified using the keyword from, and its ranges using one of the keywords to, toOne, toUnique, and toMany.

Grouping

Consecutive elements of the same type can be grouped together for convenience. For example, we can group the three property elements in the code fragment above into one properties element as follows:

@prefix : <http://.../transportation#>

ontology :TransportationOntology
class :Car extends :Vehicle
label "Car"
properties
:licenceNumber asUnique string
label "Licence Number"
:fourWheelDrive asUnique boolean defaultAs false
label "4-Wheel Drive"
:wheel as 4 :Wheel
label "Wheel"

relation :soldBy from :Car, :Truck toUnique :Dealer
label "Sold By"

Localization

A literal can be marked as being specific to a particular locale using the @ operator:

relation :soldBy from :Car, :Truck toUnique :Dealer
label "Sold By" @ en_US

Here, en_US specifies the English speaking locale in the U.S. You can also group label elements:

class :Book
labels
"Book" @ en_US
"Livre" @ fr_CA

Custom Attributes

In case you don't find any keyword of HOWL that can encode a particular attribute for your ontology, you can use the attribute keyword to specify a custom attribute:

class :Book
attribute hs:icon <http://.../book.gif>

Of course, you can also group attribute elements:

class :Book
attributes
hs:smallIcon <http://.../smallBook.gif>
hs:bigIcon <http://.../bigBook.gif>

Comments

HOWL supports the 2 Java-style comments (to-end-of-line with // and in-line with /* */). Different from Java, HOWL in-line comments can be nested.