Hk,
On 08/11/15 09:24, Philipp wrote:
Hi all,
I just started using Jena and so far just used it to parse an ontology from an
XML file. My problem is that Jena doesn't complain about unmet restrictions.
I'm developing one tool in a toolchain for bootstrapping an ontology from a relational
database schema. That tool is responsible for translating the schema information into an
intermediate specification language also developed by me, which is then processed by the
rest of the toolchain. My idea was to heavily base that specification language on OWL,
ideally requiring the input just to be valid OWL importing a certain "header",
in which the actual restrictions are formulated.
But when I wrote a small test ontology in which the restrictions formulated
before (in the same file) _don't_ hold, Jena accepted it without even a
warning. Did I do something wrong?
Yes, there's a problem in the namespaces. You have defined the default
namespace to be OWL rather than your http://example.com/myontology.
The way to see this is to reserialize your ontology in Turtle which gives:
"""
@prefix : <http://www.w3.org/2002/07/owl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://example.com/myontology#theWrongObject>
a <http://example.com/myontology#TheWrongSubClass> .
<http://example.com/myontology#TheClass>
a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:allValuesFrom
<http://example.com/myontology#TheCorrectSubClass> ;
owl:onProperty
<http://example.com/myontology#theProperty>
] .
<http://example.com/myontology#TheWrongSubClass>
a owl:Class ;
rdfs:subClassOf <http://example.com/myontology#TheClass> ;
owl:disjointWith
<http://example.com/myontology#TheCorrectSubClass> .
<http://example.com/myontology#TheCorrectSubClass>
a owl:Class ;
rdfs:subClassOf <http://example.com/myontology#TheClass> ;
owl:disjointWith
<http://example.com/myontology#TheWrongSubClass> .
<http://example.com/myontology#theProperty>
a owl:ObjectProperty ;
rdfs:domain
<https://www.mn.uio.no/ifi/english/research/groups/logid/db2osl#TheClass> ;
rdfs:range
<https://www.mn.uio.no/ifi/english/research/groups/logid/db2osl#TheClass> .
<http://example.com/myontology>
a owl:Ontology ;
owl:imports <http://isnt.accessed> .
<http://example.com/myontology#theObject>
a <http://example.com/myontology#TheClass> ;
owl:theProperty <http://example.com/myontology#theWrongObject> .
"""
As you can see the you have defined a restriction on the property
http://example.com/myontology#theProperty but in your test instance you
have used the property owl:theProperty which is probably not what you meant.
BTW you shouldn't see those DEBUG statements unless you have turned on
DEBUG level logging for the whole of Jena.
Dave