The minimal example is a degenerate case of a different bug. if Model m = a newly constructed model; Model m2 = a new constructed model; Resource r = a resource "of" m2 (e.g. r.getModel() == m2)
then Alt a = m.getAlt( r ); a.getModel() != m a.getModel().equals( m ) == false a.isIsomorphicWith( m ) == true (because both are empty) a.getModel() == m2 <---- I think this is wrong. I am going to open a couple of bugs now that I have complete tests for them Claude On Sun, Sep 22, 2013 at 11:17 AM, Chris_Dollin <[email protected]> wrote: > 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 > -- I like: Like Like - The likeliest place on the web<http://like-like.xenei.com> LinkedIn: http://www.linkedin.com/in/claudewarren
