Behavior of Literal's Number in Integraal
I have encountered issues multiple times with number literals in Integraal.
In Integraal, the literal 0
(Integer) is distinct from 0L
(Long), integers are different from floating-point numbers (0 != 0.0
), and 0.0
(Double) is distinct from 0.0f
(Float).
This design choice aligns with W3C standards for the Semantic Web, where numbers of different types are treated as distinct. See W3C RDF 1.1 Concepts and Abstract Syntax for more details.
However, this approach is not very practical from the user's perspective, as it requires careful attention to types. Unfortunately, there is no perfect solution to this problem, in my opinion.
Here are three potential options to address this:
- Retain the current behavior but provide thorough documentation to inform users about standard functions for converting literals (
toLong
,toInteger
,toDouble
, etc.) and clarify the default types (Integer for integers and Double for floating-point numbers). - Treat numbers of different types as equal. However, this complicates implementation—for example, when performing joins, it would require testing across all types to find a match.
- Normalize all numbers to a single type while preserving the original type for export purposes.
We need to discuss this issue because users may not understand why their program doesn't work, even though all their rules and queries are correct.