@Override public StmtIterator listStatements() { return IteratorFactory.asStmtIterator( GraphUtil.findAll( graph ), this); }
@Override @Deprecated public void add(Graph g) { addIterator(GraphUtil.findAll(g), false) ; manager.notifyAddGraph(graph, g) ; }
/** Add triples into the destination (arg 1) from the source (arg 2)*/ public static void addInto(Graph dstGraph, Graph srcGraph ) { addIteratorWorker(dstGraph, GraphUtil.findAll( srcGraph )); dstGraph.getEventManager().notifyAddGraph( dstGraph, srcGraph ); }
/** Delete triples the destination (arg 1) as given in the source (arg 2) */ public static void deleteFrom(Graph dstGraph, Graph srcGraph) { deleteIteratorWorker(dstGraph, GraphUtil.findAll( srcGraph )); dstGraph.getEventManager().notifyDeleteGraph( dstGraph, srcGraph ); }
/** Answer a human-consumable representation of <code>that</code>. The string <code>prefix</code> will appear near the beginning of the string. Nodes may be prefix-compressed using <code>that</code>'s prefix-mapping. This default implementation will display all the triples exposed by the graph (ie including reification triples if it is Standard). */ public static String toString( String prefix, Graph that ) { PrefixMapping pm = that.getPrefixMapping(); StringBuffer b = new StringBuffer( prefix + " {" ); int count = 0; String gap = ""; ClosableIterator<Triple> it = GraphUtil.findAll( that ); while (it.hasNext() && count < TOSTRING_TRIPLE_LIMIT) { b.append( gap ); gap = "; "; count += 1; b.append( it.next().toString( pm ) ); } if (it.hasNext()) b.append( "..." ); it.close(); b.append( "}" ); return b.toString(); }
@Override @Deprecated public void delete( Graph g, boolean withReifications ) { if (g.dependsOn( graph )) delete( triplesOf( g ) ); else deleteIterator( GraphUtil.findAll( g ), false ); manager.notifyDeleteGraph( graph, g ); }
/** Answer the number of triples in this graph. Default implementation counts its way through the results of a findAll. Subclasses must override if they want size() to be efficient. */ protected int graphBaseSize() { ExtendedIterator<Triple> it = GraphUtil.findAll( this ); try { int tripleCount = 0; while (it.hasNext()) { it.next(); tripleCount += 1; } return tripleCount; } finally { it.close(); } }
/** Answer the number of triples in this graph. Default implementation counts its way through the results of a findAll. Subclasses must override if they want size() to be efficient. */ protected int graphBaseSize() { ExtendedIterator<Triple> it = GraphUtil.findAll( this ); try { int tripleCount = 0; while (it.hasNext()) { it.next(); tripleCount += 1; } return tripleCount; } finally { it.close(); } }
public static void removeAll( Graph g ) { ExtendedIterator<Triple> it = GraphUtil.findAll( g ); try { while (it.hasNext()) { it.next(); it.remove(); } } finally { it.close(); } } }
private int prepare(Graph otherm) { ClosableIterator<Triple> ss = GraphUtil.findAll( m ); myHashLevel = 0; int hash = 0; try { while ( ss.hasNext() ) { Triple s = ss.next(); AnonStatement ass = new AnonStatement(s); if ( ass.pattern == NOVARS ) { if ( !otherm.contains( s ) ) return -1; } else { hash += ass.myHashCode(ass.vars[0]); for (int i=0;i<ass.vars.length;i++) { ass.vars[i].occursIn.add(ass); for (int j=i+1;j<ass.vars.length;j++) { ass.vars[i].friends.add(ass.vars[j]); ass.vars[j].friends.add(ass.vars[i]); } } } } return hash==-1?1:hash; } finally { ss.close(); } } private Bucket smallestBucket() {
static public int hashCode(Graph g) { ClosableIterator<Triple> ci = GraphUtil.findAll( g ); int hash = 0; GraphMatcher gm = new GraphMatcher(g); while ( ci.hasNext() ) { Triple t = ci.next(); hash += gm.new AnonStatement(t).myHashCode(null); } return hash; } /**
/** * Find all the base triples matching tm, exclude the ones that are deleted, * add the ones that have been added. */ @Override protected ExtendedIterator<Triple> _graphBaseFind(TripleMatch tm) { return base.find(tm).filterDrop(ifIn(GraphUtil.findAll(R))).andThen(L.find(tm)) ; }
public static void removeAll(Graph g) { ExtendedIterator<Triple> it = GraphUtil.findAll(g); try { while (it.hasNext()) { Triple t = it.next(); g.delete(t); it.remove(); } } finally { it.close(); } // get rid of remaining blank nodes using a SPARQL DELETE if (g instanceof SparqlGraph) { ((SparqlGraph) g).removeAll(); } }