pellet
pellet copied to clipboard
Literal.isDifferent can return wrong result for numeric literals
Due to the datatype simplification for numbers in pellet (see com.clarkparsia.pellet.datatypes.OWLRealUtils.getCanonicalObject(Number)
) the method isDifferent
in class org.mindswap.pellet.Literal
might return wrong results for numeric literals. I've observed this behavior for 2 literals where one literal represented the value 0
using the java class Byte
and one literal representing the value 200
using the java class Short
. Due to the different classes the check within isDifferent
always returns false:
@Override
public boolean isDifferent(Node node) {
if( super.isDifferent( node ) ) {
return true;
}
Literal literal = (Literal) node;
if( hasValue && literal.hasValue ) {
return value.getClass().equals( literal.value.getClass() )
&& !value.equals( literal.value );
}
return false;
}
so 0
and 200
are not threated as different and are even considered for merging.