-
Notifications
You must be signed in to change notification settings - Fork 44
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 comparison for Decimal values #77
Comments
@satra, this is unintended. It is caused by the conversion from the value of a class Literal(object):
def __init__(self, value, datatype=None, langtag=None):
self._value = six.text_type(value) # value is always a string I'm not sure there is a good solution for this, unless the equality check of This is clearly undesirable. However, I'm reluctant to implement the handling of XSD types in equality check, which might be time-consuming. I wonder if there is a simple solution. |
i agree that this shouldn't be done in equality. by representing the value as a string, it may also have some unfortunate side effects especially for floating point numbers. one option is to handle it in the representation as is done in rdflib, which maps literals to native python types. http://rdflib.readthedocs.org/en/stable/rdf_terms.html#literals a number of the current failures are from lexical comparison of decimals. |
Thank you for the pointer, @satra. We've actually done that for a few XSD datatypes, but now I can extend that to cover more with the example in rdflib. |
@trungdong in prov/model.py the way literal comparison is implemented, it results in:
pm.Literal(10, datatype=pm.XSD_DECIMAL) != pm.Literal(10.0, datatype=pm.XSD_DECIMAL)
is that intended?
The text was updated successfully, but these errors were encountered: