You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commonsrdf.apache.org by "Stian Soiland-Reyes (JIRA)" <ji...@apache.org> on 2016/07/07 10:20:11 UTC

[jira] [Commented] (COMMONSRDF-15) Can foreign BlankNode impls be used with .contains() and .getTriples()?

    [ https://issues.apache.org/jira/browse/COMMONSRDF-15?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15365916#comment-15365916 ] 

Stian Soiland-Reyes commented on COMMONSRDF-15:
-----------------------------------------------

I wonder if we can Close this jira without specifying this. The assumed semantics of graph.contains() and graph.remove() would be to use the Triple.equals() IRI.equals() Literal.equals() and BlankNode.equals() - and thus the answer is "Yes, normally".

It is however not stated explicitly that a triple added with graph.add() can later be retrieved in an ".equals()" compatible form - in fact concurrency and reasoning might break this, and I think it should be allowed for a graph store to NOT preserve the blankNode.uniqueReference() - e.g. it should be allowed to return triples with "substituted" BlankNodes with other uniqueReference()s. 

However it would be reasonable for Graph to do such mapping consistently, e.g. for g.add(bnode1, p1, iri1);   g.add(bnode1, p2, iri2);   should then (assuming no other changes) return two Triples with predicate  p1 and p2  and a getSubject() that is equal across the two. Once the graph has a consistent mapping then I don't see a big reason why it can't also do .contains(bnode1, p1, iri1) - however if g.stream(bnode1, p1, iri1);  also does mapping it might return a Triple which .getSubject() is not equal to bnode1 - and that I think should be allowed (even if weird).


If we do NOT want to support this, then g.add() should return the new (possibly transformed) Triple. That might be a less ambigious solution.

> Can foreign BlankNode impls be used with .contains() and .getTriples()?
> -----------------------------------------------------------------------
>
>                 Key: COMMONSRDF-15
>                 URL: https://issues.apache.org/jira/browse/COMMONSRDF-15
>             Project: Apache Commons RDF
>          Issue Type: Improvement
>            Reporter: Stian Soiland-Reyes (old)
>            Priority: Minor
>             Fix For: 0.3.0
>
>
> What happens if I add a 'foreign' `BlankNode` to a Graph (either directly with `Graph.add(s,t,o)` or within a foreign `Triple` to `Graph.add()` -- will I be able to match using that original blank node object "later" in other calls like `.contains()` and `.getTriples()`?
> This is of course straight-forward for IRI and Literal, but trickier for BlankNode.
> e.g. pseudocode:
> {code}
> impl1 = new Impl1TermFactory();
> b1 = impl1.createBlankNode();
> knows = impl1.createIRI("http://xmlns.com/foaf/0.1/knows");
> alice = impl1.createIRI("http://example.com/alice");
> impl2 = new Impl2TermFactory();
> g2 = impl2.createGraph();
> g2.add(b1, knows, alice);
> assertTrue(g2.contains(b1, knows, alice));
> {code}
> As discussed under COMMONSRDF-8 and pull request 7 https://github.com/apache/incubator-commonsrdf/pull/7



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)