@Override public Integer run() { return graph.size(); } });
@Override protected int performSize() { return triples.size(); }
@Override public Integer run() { return graph.size(); } });
@Override public int performSize() { return graph.size(); }
@Override public int performSize() { int size = 0; for (Graph graph : baseTripleCollections) { size += graph.size(); } return size; }
@Override public int size() { return wrapped.size(); }
@Override protected int performSize() { return triples.size(); }
@Override public int size() { return wrapped.size(); }
@Override public int size() { checkRead(); return wrapped.size(); }
@Override public int size() { // TODO: How to get the proper size based on graphType return graphNameIndex.getGraph().size(); }
@Test public void testGetSize() throws Exception { Graph graph = getEmptyGraph(); // The test graph must always be empty after test fixture setup Assert.assertEquals(0, graph.size()); }
@Test public void testRemoveAllTriples() { Graph graph = getEmptyGraph(); Assert.assertEquals(0, graph.size()); graph.add(new TripleImpl(uriRef1, uriRef2, uriRef3)); graph.add(new TripleImpl(uriRef2, uriRef3, uriRef4)); Assert.assertEquals(2, graph.size()); graph.clear(); Assert.assertEquals(0, graph.size()); }
@Test public void testAddSingleTriple() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertEquals(0, graph.size()); Assert.assertTrue(graph.add(triple)); Assert.assertEquals(1, graph.size()); }
@Test public void testAddSingleTriple() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertEquals(0, graph.size()); Assert.assertTrue(graph.add(triple)); Assert.assertEquals(1, graph.size()); }
@Test public void testAddSameTripleTwice() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertEquals(0, graph.size()); Assert.assertTrue(graph.add(triple)); Assert.assertFalse(graph.add(triple)); // ImmutableGraph does not change Assert.assertEquals(1, graph.size()); }
@Test public void testAddSameTripleTwice() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertEquals(0, graph.size()); Assert.assertTrue(graph.add(triple)); Assert.assertFalse(graph.add(triple)); // ImmutableGraph does not change Assert.assertEquals(1, graph.size()); }
@Test public void testUseTypedLiterals() { Graph graph = getEmptyGraph(); Assert.assertEquals(0, graph.size()); Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType); final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value); graph.add(triple1); Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null); Assert.assertTrue(tripleIter.hasNext()); RDFTerm gotValue = tripleIter.next().getObject(); Assert.assertEquals(value, gotValue); }
@Test public void testUseTypedLiterals() { Graph graph = getEmptyGraph(); Assert.assertEquals(0, graph.size()); Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType); final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value); graph.add(triple1); Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null); Assert.assertTrue(tripleIter.hasNext()); RDFTerm gotValue = tripleIter.next().getObject(); Assert.assertEquals(value, gotValue); }
@Test public void testRemoveSingleTriple() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertTrue(graph.add(triple)); Assert.assertTrue(graph.remove(triple)); Assert.assertEquals(0, graph.size()); }
@Test public void testRemoveSingleTriple() throws Exception { Graph graph = getEmptyGraph(); final Triple triple= createTriple( "http://example.org/ontology/Person", "http://example.org/ontology/hasName", "http://example.org/people/alice"); Assert.assertTrue(graph.add(triple)); Assert.assertTrue(graph.remove(triple)); Assert.assertEquals(0, graph.size()); }