@Test public void literalsInDataset() throws Exception { final RDFDataset dataset = new RDFDataset(); dataset.addQuad("http://example.com/p", "http://example.com/p", "Same", null, null, "http://example.com/g1"); dataset.addQuad("http://example.com/p", "http://example.com/p", "Different", null, null, "http://example.com/g1"); final List<Quad> quads = dataset.getQuads("http://example.com/g1"); final Quad q1 = quads.get(0); final Quad q2 = quads.get(1); assertNotEquals(q1, q2); assertNotEquals(0, q1.compareTo(q2)); assertNotEquals(0, q1.getObject().compareTo(q2.getObject())); }
@Test public void compareToNull() throws Exception { assertNotEquals(0, q.compareTo(null)); }
@Test public void compareToDifferentObject() throws Exception { final Quad q2 = new Quad("http://example.com/s1", "http://example.com/p1", "http://example.com/other", "http://example.com/g1"); assertNotEquals(0, q.compareTo(q2)); }
@Test public void compareToDifferentObjectType() throws Exception { final Quad q2 = new Quad("http://example.com/s1", "http://example.com/p1", "http://example.com/other", null, null, // literal "http://example.com/g1"); assertNotEquals(0, q.compareTo(q2)); }
@Test public void compareToSame() throws Exception { final Quad q2 = new Quad("http://example.com/s1", "http://example.com/p1", "http://example.com/o1", "http://example.com/g1"); assertEquals(0, q.compareTo(q2)); // Should still compare equal, even if extra attributes are added q2.put("example", "value"); assertEquals(0, q.compareTo(q2)); }
@Test public void compareToDifferentPredicate() throws Exception { final Quad q2 = new Quad("http://example.com/s1", "http://example.com/other", "http://example.com/o1", "http://example.com/g1"); assertNotEquals(0, q.compareTo(q2)); }
@Test public void compareToDifferentGraph() throws Exception { final Quad q2 = new Quad("http://example.com/s1", "http://example.com/p1", "http://example.com/o1", "http://example.com/other"); assertNotEquals(0, q.compareTo(q2)); }
@Test public void compareToDifferentSubject() throws Exception { final Quad q2 = new Quad("http://example.com/other", "http://example.com/p1", "http://example.com/o1", "http://example.com/g1"); assertNotEquals(0, q.compareTo(q2)); }