Hi all,

At $-work, we are building an application on top of Apache Jena. After three 
years, it slowly comes together, and the first role out will be soon. YAY, one 
Apache Jena Business Application more! ;-)

Nevertheless, we still frequently stumble over the API. Here are two examples I 
remember directly.



Graph defines contains(Triple) and contains(Node, Node, Node), same for find. 
But only delete(Triple), add(Triple) and remove(Node,Node,Node). Why no comfort 
variants for delete, add and remove?



Graph.contains work with matches because the same holds for Graph.find a 
"contains exactly" question is not answerable. With exactly we mean 
Graph.containsExactly(t1) is true iff the graph contains a triple t2 with 
t1.equals(t2). Contains works differently compared to Set.contains, but why? 
See snippet-1



To be honest, we can live with a "because nobody requested it this way" :D If 
so, I would like to contribute our findings for version 4.0. I would like to 
see Apache Jena profit from library user view or otherwise get enlightened.



Best Merlin



Code Snippet-1:

var o1 = NodeFactory.createLiteral("0", XSDDatatype.XSDdouble);

var o2 = NodeFactory.createLiteral("0.0", XSDDatatype.XSDdouble);

var t1 = Triple.create(s, p, o1);

var t2 = Triple.create(s, p, o2);



var graph = graph.add(t1); // GraphFactory.createDefaultGraph() omitted



t1.equals(t2); // false because o1 != o2

graph.contains(s, p, o2); // true because (s,p,o1) matches

graph.contains(t2); // true, even if t2 is not in the graph

Reply via email to