You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "arne-bdt (via GitHub)" <gi...@apache.org> on 2023/05/14 10:11:52 UTC

[GitHub] [jena] arne-bdt opened a new issue, #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory

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: issues-unsubscribe@jena.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] arne-bdt commented on issue #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory

Posted by "arne-bdt (via GitHub)" <gi...@apache.org>.
arne-bdt commented on issue #1867:
URL: https://github.com/apache/jena/issues/1867#issuecomment-1546971802

   Hi @afs - thanks for your response.
   
   I found the "Literal term equality" definition [here](https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal).
   
   If I understand the implications correctly, any new implementation would be better off ignoring:
   - org.apache.jena.graph.Node#sameValueAs
   - org.apache.jena.graph.Node#getIndexingValue
   
   DatasetGraphInMemory seems to behave as expected.
   So what should happen with the current GraphMem implementation? Should be left untouched since it has exhibited this particular behavior for years now?


-- 
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: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs closed issue #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs closed issue #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory
URL: https://github.com/apache/jena/issues/1867


-- 
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: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs commented on issue #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on issue #1867:
URL: https://github.com/apache/jena/issues/1867#issuecomment-1546931793

   Hi @arne-bdt - thanks for the report.
   
   I think you observe the difference because there is a literal in the predicate position (this means it is not possible via the Model API) and the code doesn't handle it as a value-based search on the find route.
   
   SPARQL - when executed in Fuseki - uses DatasetGraphInMemory mostly.
   
   [There is a discussion](https://lists.apache.org/thread/jl6rj08k55xbhznrjwphm009scm9xtbj) of upcoming external changes leading to a possible Jena5.
   
   That would be a good time to switching to term-equality consistently (lead GraphMem in the codebase but not the default choice).
   
   For any new Graph/Dataset, I'm favour of term-equality. _If_ necessary with an overlay of value equality.
   


-- 
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: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs commented on issue #1867: Inconsitent behavior of Graph#contains and Graph#find for literal nodes in GraphMem and DatasetGraphInMemory

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on issue #1867:
URL: https://github.com/apache/jena/issues/1867#issuecomment-1616088740

   This is overtaken by #1912 - the new graphs are "same term" graphs.
   


-- 
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: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org