Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literal.isDifferent can return wrong result for numeric literals #34

Open
tobias-hammerschmidt opened this issue Aug 18, 2016 · 0 comments

Comments

@tobias-hammerschmidt
Copy link
Contributor

tobias-hammerschmidt commented Aug 18, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant