assertNotEquals(testNull.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testNull.ntriplesString()); assertNotEquals(testNull.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testNull.ntriplesString()); assertEquals(testAutomatic1.ntriplesString(), testAutomatic1.ntriplesString()); assertEquals(testAutomatic2.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic2.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testManual3a.ntriplesString()); assertEquals(testManual3b.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testManual4.ntriplesString());
assertNotEquals(testNull.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testNull.ntriplesString()); assertNotEquals(testNull.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testNull.ntriplesString()); assertEquals(testAutomatic1.ntriplesString(), testAutomatic1.ntriplesString()); assertEquals(testAutomatic2.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic2.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testManual3a.ntriplesString()); assertEquals(testManual3b.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testManual4.ntriplesString());
@Test public void testPossiblyInvalidBlankNode() throws Exception { BlankNode withColon; try { withColon = factory.createBlankNode("with:colon"); } catch (final IllegalArgumentException ex) { // Good! return; } // Factory allows :colon, which is OK as long as it's not causing an // invalid ntriplesString assertFalse(withColon.ntriplesString().contains("with:colon")); // and creating it twice gets the same ntriplesString assertEquals(withColon.ntriplesString(), factory.createBlankNode("with:colon").ntriplesString()); }
@Test public void testPossiblyInvalidBlankNode() throws Exception { BlankNode withColon; try { withColon = factory.createBlankNode("with:colon"); } catch (UnsupportedOperationException ex) { Assume.assumeNoException("createBlankNode(String) not supported", ex); return; } catch (IllegalArgumentException ex) { // Good! return; } // Factory allows :colon, which is OK as long as it's not causing an // invalid ntriplesString assertFalse(withColon.ntriplesString().contains("with:colon")); // and creating it twice gets the same ntriplesString assertEquals(withColon.ntriplesString(), factory.createBlankNode("with:colon").ntriplesString()); }
@Test public void testCreateBlankNodeIdentifierTwice() throws Exception { BlankNode bnode1, bnode2, bnode3; try { bnode1 = factory.createBlankNode("example1"); bnode2 = factory.createBlankNode("example1"); bnode3 = factory.createBlankNode("differ"); } catch (UnsupportedOperationException ex) { Assume.assumeNoException(ex); return; } assertEquals(bnode1.internalIdentifier(), bnode2.internalIdentifier()); // We don't know what the ntriplesString is, but it MUST be the same assertEquals(bnode1.ntriplesString(), bnode2.ntriplesString()); // and here it MUST differ assertNotEquals(bnode1.ntriplesString(), bnode3.ntriplesString()); }
@Test public void testCreateBlankNodeIdentifierTwice() throws Exception { BlankNode bnode1, bnode2, bnode3; bnode1 = factory.createBlankNode("example1"); bnode2 = factory.createBlankNode("example1"); bnode3 = factory.createBlankNode("differ"); // We don't know what the identifier is, but it MUST be the same assertEquals(bnode1.uniqueReference(), bnode2.uniqueReference()); // We don't know what the ntriplesString is, but it MUST be the same assertEquals(bnode1.ntriplesString(), bnode2.ntriplesString()); // and here it MUST differ assertNotEquals(bnode1.uniqueReference(), bnode3.uniqueReference()); assertNotEquals(bnode1.ntriplesString(), bnode3.ntriplesString()); }
@Test public void testBnodes() { final BlankNode bn1 = rdf.createBlankNode(); final BlankNode bn2 = rdf.createBlankNode(); final Triple triple = rdf.createTriple(bn1, DC.subject, bn2); final LabelledTriple t = new LabelledTriple(triple, null, null); assertEquals(bn1.ntriplesString(), t.getSubject(), "Subject bnode value doesn't match!"); assertEquals(bn2.ntriplesString(), t.getObject(), "Object bnode value doesn't match!"); assertEquals(bn2.ntriplesString(), t.getObjectLabel(), "Object bnode label doesn't match!"); } }