@Override public boolean isEmpty() { return graph.isEmpty() ; }
@Override public Iterator<Node> listGraphNodes() { // Hide empty graphs. return graphs.entrySet().stream().filter(e->!e.getValue().isEmpty()).map(Entry::getKey).iterator(); }
/** Answer true iff this graph is empty. [Used to be in QueryHandler, but moved in here because it's a more primitive operation.] */ @Override public boolean isEmpty() { return fdata.getGraph().isEmpty(); }
@Override public boolean containsGraph(Node graphNode) { // Hide empty graphs. if ( Quad.isDefaultGraph(graphNode) ) return true; if ( Quad.isUnionGraph(graphNode) ) return true; Graph g = graphs.get(graphNode); return g != null && !g.isEmpty(); }
@Override public ExtendedIterator<Triple> _graphBaseFind(Triple s) { return L.isEmpty() ? NullIterator.instance() : super._graphBaseFind(s); } }
@Override public boolean isEmpty() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return holder.getBaseItem().isEmpty(); }
public void testEmpty() { Graph g = getGraph(); assertTrue( g.isEmpty() ); graphAdd( g, "x rdf:type rdf:Statement" ); assertFalse( g.isEmpty() ); graphAdd( g, "x rdf:subject Deconstruction" ); assertFalse( g.isEmpty() ); graphAdd( g, "x rdf:predicate rdfs:subTypeOf" ); assertFalse( g.isEmpty() ); graphAdd( g, "x rdf:object LiteraryCriticism" ); assertFalse( g.isEmpty() ); }
private void write(Graph graph) { writeBase(baseURI) ; writePrefixes(prefixMap) ; if ( !prefixMap.isEmpty() && !graph.isEmpty() ) out.println() ; writeGraphTTL(graph) ; } }
public void testAddWithReificationPreamble() { Graph g = getGraph(); xSPO( g ); assertFalse( g.isEmpty() ); }
public void testRemoveAll( String triples ) { Graph g = getGraph(); graphAdd( g, triples ); g.clear(); assertTrue( g.isEmpty() ); }
@Test public void load_17() { DatasetGraph dsg = RDFDataMgr.loadDatasetGraph(filename("D.ttl")) ; assertFalse(dsg.getDefaultGraph().isEmpty()) ; assertEquals(0, Iter.count(dsg.listGraphNodes())) ; }
@ContractTest public void testAddWithReificationPreamble() { Graph g = producer.newInstance(); txnBegin(g); xSPO(g); txnCommit(g); txnBegin(g); assertFalse(g.isEmpty()); txnRollback(g); }
@Test public void load_dataset_01() { DatasetGraphTDB dsg = fresh() ; TDBLoader.load(dsg, DIR + "data-1.nq", false) ; assertTrue(dsg.getDefaultGraph().isEmpty()) ; assertEquals(1, dsg.getGraph(g).size()) ; }
@Test public void load_dataset_03() { DatasetGraph dsg = fresh(); DataLoader loader = maker.apply(dsg, null); loader.startBulk(); RDFDataMgr.parse(loader.stream(), DIR + "data-1.nq"); loader.finishBulk(); Txn.executeRead(dsg, ()->{ assertTrue(dsg.getDefaultGraph().isEmpty()) ; assertEquals(1, dsg.getGraph(g).size()) ; }); }
@Test public void load_dataset_01() { DatasetGraph dsg = fresh() ; load(dsg, maker, DIR + "data-1.nq") ; Txn.executeRead(dsg, ()->{ assertTrue(dsg.getDefaultGraph().isEmpty()) ; assertEquals(1, dsg.getGraph(g).size()) ; }); }
public void testAddLeftOnlyIfNecessary() { Graph L = graphWith( "" ), R = graphWith( "x R y" ); Graph du = new DisjointUnion( L, R ); graphAdd( du, "x R y" ); assertEquals( true, L.isEmpty() ); graphAdd( du, " a P b" ); assertIsomorphic( graphWith( "a P b" ), L ); assertIsomorphic( graphWith( "x R y" ), R ); } }