W3C home > Mailing lists > Public > public-owl-dev@w3.org > April to June 2010

Re: user defined datatypes in OWL-DL possible?

From: Bijan Parsia <bparsia@cs.man.ac.uk>
Date: Fri, 23 Apr 2010 12:10:31 +0100
Message-Id: <762DCC2E-7B11-4A42-8420-C1AD94C53357@cs.man.ac.uk>
Cc: public-owl-dev@w3.org
To: "mjk" <mariokofler@gmx.at>
On 23 Apr 2010, at 08:40, mjk wrote:

> hello,
>
> i want to define my own datatypes (like for example an enumeration  
> datatype) in OWL but do not want my ontology to become OWL Full. Is  
> this possible?

Actually, it's possible both in OWL 1 and OWL 2, but only OWL 2 has a  
standard syntax for it. The OWL 2 version is much more widely  
supported (in Pellet, FaCT++, and HermiT).

> Specifically, i want to translate an XSD schema document to an OWL  
> model and have for example the following simple type in the source  
> document:
>
> 	<xsd:simpleType name="areaUnitEnum">
> 		<xsd:restriction base="xsd:NMTOKEN">
> 			<xsd:enumeration value="SquareKilometers"/>
> 			<xsd:enumeration value="SquareMeters"/>
> 			<xsd:enumeration value="SquareCentimeters"/>
> 			<xsd:enumeration value="SquareMillimeters"/>
> 			<xsd:enumeration value="SquareMiles"/>
> 			<xsd:enumeration value="SquareYards"/>
> 			<xsd:enumeration value="SquareFeet"/>
> 			<xsd:enumeration value="SquareInches"/>
> 		</xsd:restriction>
> 	</xsd:simpleType>

Enumerations were supported by OWL 1 (iirc).

This can be done two ways, using a DataOneOf:
	http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/ 
#Enumeration_of_Literals

IIRC the RDF/XML will be ugly because you don't have syntactic sugar  
for lists of literals. (again, going from memory).

You could also use a pattern facet restriction:
	http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Strings

> in fact i think of a datatype property "hasAreaUnit" with range  
> restriction to my user defined datatype "AreaUnit" which itself is  
> an enumeration of the values listed above.
>
> is it possible to model this in OWL within the OWL-DL restriction  
> and without going to OWL-Full? i hope someone can give me a hint  
> how to achieve this because i am stuck here.

It is possible.

> many thanks for your replies,

Protege 1 has support for creating such ontologies. I worked a subset  
of this one up:

	http://pastebin.com/7QtJJ2a8

I also attach a turtle version.

Cheers,
Bijan.

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix : <http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/ 
2010/3/Ontology1272020557141.owl#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@base <http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/2010/3/ 
Ontology1272020557141.owl> .

<http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/2010/3/ 
Ontology1272020557141.owl> rdf:type owl:Ontology .


#################################################################
#
#    Datatypes
#
#################################################################


###  http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/2010/3/ 
Ontology1272020557141.owl#areaUnitEnum

:areaUnitEnum rdf:type rdfs:Datatype ;

               owl:equivalentClass [ rdf:type rdfs:Datatype ;
                                     owl:oneOf [ rdf:type rdf:List ;
                                                 rdf:first  
"SquareKilometers"^^xsd:string ;
                                                 rdf:rest [ rdf:type  
rdf:List ;
                                                            rdf:first  
"SquareMeters"^^xsd:string ;
                                                            rdf:rest  
rdf:nil
                                                          ]
                                               ]
                                   ] .

#################################################################
#
#    Data properties
#
#################################################################

###  http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/2010/3/ 
Ontology1272020557141.owl#p

:p rdf:type owl:DatatypeProperty ;

    rdfs:subPropertyOf owl:topDataProperty .

###  http://www.w3.org/2002/07/owl#topDataProperty

owl:topDataProperty rdf:type owl:DatatypeProperty .

#################################################################
#
#    Classes
#
#################################################################


###  http://www.cs.man.ac.uk/~bparsia/2009/comp60462/onts/2010/3/ 
Ontology1272020557141.owl#C

:C rdf:type owl:Class ;

    owl:equivalentClass [ rdf:type owl:Restriction ;
                          owl:onProperty :p ;
                          owl:someValuesFrom :areaUnitEnum
                        ] .
###  Generated by the OWL API (version 3.0.0.1253) http:// 
owlapi.sourceforge.net
Received on Friday, 23 April 2010 11:10:14 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 27 March 2013 09:32:58 GMT