On 06/04/16 18:44, Stian Soiland-Reyes wrote:
Right, different .equals.. And I don't think we would want to have
hierarchical .equals as you show, that could lead to weird collection
behaviour. Also the Quad should probably include the Graph IRI in its
.hashCode()

It's not specific to RDF. It's a Java thing when .equals is based on fields, not object identity.

(discussions on StackOverflow)

e.g.
http://www.javapractices.com/topic/TopicAction.do?Id=17

http://stackoverflow.com/questions/13162188/java-equals-method-in-base-class-and-in-subclasses


Perhaps Quad just happens to look like Triple, without the same interface

If you mean same names of methods: getGraph, getsubject, getPredciate, getObject then yes to that.

And an asTriple to project it to a triple.

        Andy

(or a TripleLike super-interface, SubjectPredicateObject ?). Quad can have
a .asTriple() method? In which case that Triple wotxnSafeExtendedIteratoruld 
.equals, even between
Q1.asTriple() and Q2.asTriple().

Sounds like Quad needs crafting out as a branch so we can see the
implications. Given the quad formats and that JSON-LD is popular (although
@graph isn't :) I think this is within scope of Commons RDF (Commons
Dataset ? ;)

How do the equivalent of Quads and Triple differ in the different
frameworks? What about Dataset and Graph?

On 6 Apr 2016 14:09, "Andy Seaborne" <[email protected]> wrote:

On 04/04/16 16:15, Stian Soiland-Reyes wrote:

This raises good questions about Quads which I think we should also
think about - e.g. if we imply make a Dataset as a subclass of Graph,
and Quad a subclass of Triple,  then does .size() and .contains()
relate to only the default graph or all the quads?


Triples and Quads are different.

I think .equals brings this out: Java .equals must be transitive.

Q1: <g1> <s> <p> <o>
Q2: <g2> <s> <p> <o>
T:  <s> <p> <o>

Q1 equals T . T equals Q2

but not Q1 equals Q2.

So Set<Triple> ???

         Andy





Reply via email to