arne-bdt opened a new issue, #1867:
URL: https://github.com/apache/jena/issues/1867
### Version
4.8.0
### What happened?
The following test code demonstrates inconsistent behavior of different
Graph implementations in Apache Jena:
```java
var containedTriple = Triple.create(
NodeFactory.createURI("x"),
NodeFactory.createLiteral("0.1", XSDDouble.XSDdouble),
NodeFactory.createURI("R"));
graph.add(containedTriple);
var match = Triple.create(
NodeFactory.createURI("x"),
NodeFactory.createLiteral("0.10", XSDDouble.XSDdouble),
NodeFactory.createURI("R"));
Assert.assertTrue(graph.contains(match));
Assert.assertEquals(containedTriple, graph.find(match).next());
```
GraphMem#contains returns true, but find does not locate the matching triple.
The default graph in DatasetGraphInMemory answers the contains call with
false and consistently does not locate the triple.
If I put the literal node in the position of the subject (switch the first
two nodes in the example):
GraphMem#contains returns true and locates the matching triple.
The default graph in DatasetGraphInMemory answers the contains call with
false and consistently does not locate the triple.
If I put the literal node in the position of the object (switch the last two
nodes in the example):
GraphMem#contains returns true and locates the matching triple.
The default graph in DatasetGraphInMemory answers the contains call with
false and consistently does not locate the triple.
From the implementation of GraphMem, I would deduce:
- Matching for literal value equality is supposed to work for object nodes
- The fact that #contains also supports literal value equality for subjects
and predicates might be accidental
- The fact that #find supports literal value equality for subjects might be
accidental
- The fact that #find does not support literal value equality for predicates
is likely intentional
DatasetGraphInMemory seems to consistently not support matching literal
nodes by value equality.
What should be the defined behavior in these cases?
Depending on how SPARQL is executed, could this lead to inconsistent query
results depending on the Graph implementation?
### Relevant output and stacktrace
_No response_
### Are you interested in making a pull request?
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]