[
https://issues.apache.org/jira/browse/JENA-818?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne closed JENA-818.
------------------------------
Resolution: Fixed
Fix Version/s: Jena 2.12.2
Fix applied so users can try this out prior to a release.
> Literal.sameValueAs isn't consistent or symmetric
> -------------------------------------------------
>
> Key: JENA-818
> URL: https://issues.apache.org/jira/browse/JENA-818
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 2.12.1
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
> Fix For: Jena 2.12.2
>
>
> Literal.sameValue can give some unexpected answers. It only check the
> lexical form in some cases of ill-formed literals, ignoring the datatype.
> It should be conservative (return true if and only if the values are known to
> be the same) and symmetric.
> {noformat}
> static void exec(String str1, String str2) {
> Node n1 = SSE.parseNode(str1) ;
> Node n2 = SSE.parseNode(str2) ;
> System.out.printf("%-5s :: %-46s %s\n", n1.sameValueAs(n2),n1, n2) ;
> }
> public static void main(String[] args) {
> exec("'1'^^xsd:integer", "'abc'^^<http://example/dt>") ;
> exec("'abc'^^<http://example/dt>", "'1'^^xsd:integer") ;
> System.out.println() ;
> exec("'abc'^^xsd:integer", "'abc'^^<http://example/dt>") ;
> exec("'abc'^^<http://example/dt>", "'abc'^^xsd:integer") ;
> System.out.println() ;
> exec("'1'^^xsd:integer", "'1'^^xsd:dateTime") ;
> exec("'1'^^xsd:dateTime", "'1'^^xsd:integer") ;
> }
> {noformat}
> gives:
> {noformat}
> false :: "1"^^http://www.w3.org/2001/XMLSchema#integer
> "abc"^^http://example/dt
> false :: "abc"^^http://example/dt
> "1"^^http://www.w3.org/2001/XMLSchema#integer
> false :: "abc"^^http://www.w3.org/2001/XMLSchema#integer
> "abc"^^http://example/dt
> true :: "abc"^^http://example/dt
> "abc"^^http://www.w3.org/2001/XMLSchema#integer
> true :: "1"^^http://www.w3.org/2001/XMLSchema#integer
> "1"^^http://www.w3.org/2001/XMLSchema#dateTime
> false :: "1"^^http://www.w3.org/2001/XMLSchema#dateTime
> "1"^^http://www.w3.org/2001/XMLSchema#integer
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)