On 25/04/13 20:00, David Jordan wrote:
Excuse my pickiness...
Your code would have been clearer as:
Copy paste error. I did say that I hacked up a quick example!
checkValid( m0, "m0, before" );
checkValid( m1, "m1, before" );
m1.addSubModel( m0 );
checkValid( m0, "m0, after" );
checkValid( m1, "m1, after" );
With the following output:
Model m0, before isValid() => null
Model m1, before isValid() => true
Model m0, after isValid() => null
Model m1, after isValid() => false
So what does it mean for validate() to return a null?
It means that there is nothing to provide a report. OntModelSpec.OWL_MEM
constructs an OntModel without a reasoner. I suppose that, in that case,
OntModelSpec could return a default ValidationReport denoting "no
validation because no reasoner", and if I was writing the code today I'd
probably consider doing that. But instead it returns null, which has the
same semantics, and I would hesitate to change the API without a good
reason.
You cannot tell from the documentation, it implies it always returns an
instance of ValidityReport.
If it can return null, the javadoc should state so with a reason why.
Jena is open source. Please feel free to submit a patch.
From your example, it appears that m0 is null because there is only a single
statement,
m0.add( c0, OWL.disjointWith, c1 );
m0 is never null. The validation report for m0 is null because it has no
reasoner.
In the first case, it is completely separate from m1
and in the second case because m1 contains m0,
so m1 knows about m0 but m0 does not know about m1.
Is that correct?
I'm not sure I understand the question. Ignore m0 for the time being. To
begin with, m1 is consistent because it contains an individual i with
two classes, which is perfectly legal in RDF and OWL. Now we add a
sub-model (or, if you prefer, import the ontology) which contains the
axioms for the classes. The only axiom is that c0 and c1 are disjoint,
which means that no individual can be a member of both classes. Since i
is a counter-example, m1 is not consistent, hence fails validation.
The point of the example was that the axiom - c0 :disjointWith c1 - was
in a sub-model of the model that validate() was called on, m1. So the
answer to the question "does validate() consider all of the sub-models
or only the base model" is clearly "it considers all of the sub-models".
Ian