On further investigation I think I see what Andy was talking about. Classes that extend AdhocDatatype (or Basedatatype) and want to allow multiple instances of the datatype class to be considered equal must do the following:
1. overide BaseDatatype.isEqual(LiteralLabel litLabel1, LiteralLabel litLabel2) to call isEqualByTerm(LiteralLabel litLabel1, LiteralLabel litLabel2). -- this is the part I misunderstood in Andy's earlier post. 2. Override Object.equals(Object obj) 3. Override Object.hashCode(), potentially calling BaseDatatype.getHashCode( LiteralLabel lit ) I had missed the first step. I think there should be a warning in the log if TypeMapper.register( RDFDatatype type ) is called and: 1. there is an existing datatype registered for the type.getJavaClass() and 2. there registered type.isEquals( type.registeredType ) is false. I'll open an enhancement for this change. Claude On Mon, Oct 1, 2018 at 12:01 PM Andy Seaborne <a...@apache.org> wrote: > > > > On 01/10/18 07:52, Claude Warren wrote: > > I resolved it by following the Don't Do That pattern and not loading the > > datatype twice. > > > > Event with hashCode and equals on the datatype it does not match as the > > datatype equality is checked with ==. I will find and document the issue > > here. > > Good - my cursory look at the code showed only use of Objects.equals. > > > But I am leaning toward the type registry issuing a warning when a > > datatype is registered a second time. > > As long as parsing unknown datatypes isn't impacted. > > Andy > > > > > Claude > > > > On Fri, Sep 28, 2018 at 9:45 AM Andy Seaborne <a...@apache.org> wrote: > > > >> Claude - > >> > >> Did you resolve this? > >> > >> In experimentation, I found a subtype of AdhocDatatype had to implement > >> .hashCode and .equals. > >> > >> Andy > >> > > > > -- I like: Like Like - The likeliest place on the web LinkedIn: http://www.linkedin.com/in/claudewarren