On Saturday, September 21, 2013 10:08:08 AM Claude Warren wrote:
> There are several methods listed in the Model and ModelCon interfaces that
> return the model for chaining purposes.
> 
> I want to test that the model is returned.
> 
> Assuming the a method call:
> 
> Model m = // create a model
> Model m2 = m.f(x)
> 
> I believe the requirement is for
> m2 == m to be true

Yes, that's how we've interpreted since ... gosh, pre Jena 2!

> A similar requirement is for items created on the model be "of" the model
> (not necessarily in the model). 

Yes: the RDFNode should refer to that model but need not appear
in any Statements of the model. Of course it's just layering over
Node. 

> The question is should the second test be s.getModel() == m or
> s.getModel().equals(m)?  

The Model's .equals() is the default Object.equals(), ie identity, ie ==.
The existence of bnodes means that testing two models for structural
equality is fragile and while I remember wondering at the time of
Jena 2 whether .equals() should call isIsomorphicTo that would have been
rather expensive.

> There is one case getAlt()
> Model m = // create model;
> Alt a = m.getAlt( Resource );
> 
> where both a.getModel() == m  and a.getMode().equals(m) are false.  However
> a.getModel.isIsomorphicWith( m ) is true.

Hmm. Could you show a minimal complete example? A quick look
at the code doesn't suggest anything but I could be looking in the wrong
place.

Chris

Reply via email to