[Pellet-users] user-defined datatypes
Wolfgang May
may at informatik.uni-goettingen.de
Sat Feb 10 12:52:53 UTC 2007
Hi,
> The home page of pellet says that it supports user-defined datatypes,
> however, after doing a lot of tests, i don't get it work with string derived
> types. I've found an article ("Pellet: A practical owl-dl reasoner") of 2005
> that says that the reasoner only supports numeric and date derived types.
>
> I've been looking for more information, but I haven't found anything. I'd
> need to know if this feature, reasoning on user-defined datatypes based on
> strings, is implemented in Pellet, or if it is going to be implemented in a
> near future.
Integers work.
Find below two examples, one based on XSD, the other on N3 Datarange
definitions.
Here, we did not get decimal to work, and also string currently breaks
(it worked before the last update) with the following message:
"A restriction is defined on an unknown XSD type
http://www.w3.org/2001/XMLSchema#string"
Wolfgang
***************** 1st example ***********************************
may at s2:~/teaching/SemWeb/RDF$ more coordinates.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="file:coordinates.xsd">
<xs:simpleType name="longitudeT">
<xs:restriction base="xs:int">
<xs:minExclusive value="-180"/>
<xs:maxInclusive value="180"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="easternLongitude">
<xs:restriction base="xs:int">
<!-- note: base="longitudeT" would be nicer, but is not allowed when
parsing from RDF -->
<xs:minExclusive value="0"/>
<xs:maxInclusive value="180"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="latitudeT">
<xs:restriction base="xs:int">
<xs:minInclusive value="-90"/>
<xs:maxInclusive value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
may at s2:~/teaching/SemWeb/RDF$ more coordinates.rdf
<!DOCTYPE rdf:RDF [
<!ENTITY mon "http://www.semwebtech.de/mondial/10/meta#">
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema">
<!ENTITY Coords "file:coordinates.xsd"> ]>
<rdf:RDF 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:mon="http://www.semwebtech.de/mondial/10/meta#">
<!-- ****** IMPORTANT: ALL DATATYPES MUST BE MENTIONED TO BE PARSED
****** -->
<rdfs:Datatype rdf:about="&Coords;#longitudeT"/>
<rdfs:Datatype rdf:about="&Coords;#easternLongitude"/>
<rdfs:Datatype rdf:about="&Coords;#latitudeT"/>
<!-- ****** USE THEM IN A RESTRICTION
************************************ -->
<owl:Restriction rdf:about="&mon;EasternHemisphere">
<owl:onProperty rdf:resource="&mon;longitude"/>
<owl:someValuesFrom rdf:resource="&Coords;#easternLongitude"/>
</owl:Restriction>
<mon:City mon:name="Berlin">
<mon:longitude rdf:datatype="&xsd;#int">13</mon:longitude>
<mon:latitude rdf:datatype="&xsd;#int">52</mon:latitude>
</mon:City>
<mon:City mon:name="Lisbon">
<mon:longitude rdf:datatype="&Coords;#longitudeT">-9</mon:longitude>
<mon:latitude rdf:datatype="&Coords;#latitudeT">38</mon:latitude>
</mon:City>
</rdf:RDF>
may at s2:~/teaching/SemWeb/RDF$ more coordinates.sparql
prefix : <http://www.semwebtech.de/mondial/10/meta#>
select ?N
from <file:coordinates.rdf>
where {?X :name ?N . ?X a :EasternHemisphere}
***************** 2nd example ***********************************
may at s2:~/teaching/SemWeb/RDF$ more adult.n3
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix : <foo://bla/names#> .
:kate :name "Kate"; :age 62; :child :john.
:john :name "John"; :age 35; :child [:name "Alice"], [:name "Bob"; :age
8].
:child rdfs:domain :Person; rdfs:range :Person.
:age a owl:FunctionalProperty; a owl:DatatypeProperty; rdfs:range xsd:int.
:name a owl:FunctionalProperty; a owl:DatatypeProperty; rdfs:range
xsd:string.
:atLeast18 a owl:DataRange;
owl:onDataRange xsd:int; owl:minInclusive 18.
:Adult owl:intersectionOf (:Person
[ a owl:Restriction;
owl:onProperty :age;
owl:allValuesFrom :atLeast18]).
:Child owl:intersectionOf (:Person
[ owl:complementOf :Adult ]).
may at s2:~/teaching/SemWeb/RDF$ more adult.sparql
prefix : <foo://bla/names#>
select ?AN ?CN ?X ?Y
from <file:adult.n3>
where {{?A a :Adult; :name ?AN} UNION
{?C a :Child; :name ?CN} UNION
{?X :age ?Y}}
More information about the Pellet-users
mailing list