protected UpdateDropClear(String iri, boolean silent) { this(Target.create(iri), silent) ; }
public static Target create(Node graphName) { return new Target(graphName) ; }
@Override final public boolean equalTo(Update obj, NodeIsomorphismMap isoMap) { if (this == obj) return true ; if (getClass() != obj.getClass()) return false ; UpdateBinaryOp other = (UpdateBinaryOp)obj ; if (silent != other.silent) return false ; return dest.equalTo(other.dest, isoMap) && src.equalTo(other.src, isoMap) ; } }
private static void checkTarget(Target target) { if ( ! target.isDefault() && ! target.isOneNamedGraph() ) throw new ARQException("Illegal target: must identify a single graph: "+target) ; }
protected static Graph graph(DatasetGraph datasetGraph, Target target) { if ( target.isDefault() ) return datasetGraph.getDefaultGraph(); if ( target.isOneNamedGraph() ) return graph(datasetGraph, target.getGraph()); error("Target does not name one graph: " + target); return null; }
protected void printTarget(Target target) { if ( target.isAll() ) { out.print("ALL") ; } else if ( target.isAllNamed() ) { out.print("NAMED") ; } else if ( target.isDefault() ) { out.print("DEFAULT") ; } else if ( target.isOneNamedGraph() ) { out.print("GRAPH ") ; String s = FmtUtils.stringForNode(target.getGraph(), sCxt) ; out.print(s) ; } else { out.print("Target BROKEN") ; throw new ARQException("Malformed Target") ; } }
public boolean equalTo(Target other, NodeIsomorphismMap isoMap) { return equals(other) ; }
public boolean isOneGraph() { return target.isOneNamedGraph() ; }
public boolean isAll() { return target.isAll() ; } public boolean isAllNamed() { return target.isAllNamed() ; }
public boolean isAllNamed() { return target.isAllNamed() ; } public boolean isOneGraph() { return target.isOneNamedGraph() ; }
public boolean isDefault() { return target.isDefault() ; } public boolean isAll() { return target.isAll() ; }
public Node getGraph() { return target.getGraph() ; }
protected void printTargetUpdate2(Target target) { if ( target.isDefault() ) { out.print("DEFAULT") ; } else if ( target.isOneNamedGraph() ) { //out.print("GRAPH ") ; String s = FmtUtils.stringForNode(target.getGraph(), sCxt) ; out.print(s) ; } else { out.print("Target BROKEN / Update2") ; throw new ARQException("Malformed Target / Update2") ; } }
/** Copy from src to dst : copy overwrites (= deletes) the old contents */ protected static void gsCopy(DatasetGraph dsg, Target src, Target dest, boolean isSilent) { if ( dest.equals(src) ) return ; gsClear(dsg, dest, true) ; gsAddTriples(dsg, src, dest) ; }
@Override public String toString() { if ( isOneNamedGraph() ) return decl.toString()+" "+FmtUtils.stringForNode(graphIRI) ; else return decl.toString() ; }
protected UpdateDropClear(Node target, boolean silent) { this(Target.create(target), silent) ; }
private boolean validBinaryGraphOp(UpdateBinaryOp update) { if ( update.getSrc().isDefault() ) return true; if ( update.getSrc().isOneNamedGraph() ) { Node gn = update.getSrc().getGraph(); if ( !datasetGraph.containsGraph(gn) ) { if ( !update.getSilent() ) error("No such graph: " + gn); return false; } return true; } error("Invalid source target for oepration; " + update.getSrc()); return false; }
@Override public void visit(UpdateAdd update) { // ADD SILENT? (DEFAULT or GRAPH) TO (DEFAULT or GRAPH) if ( !validBinaryGraphOp(update) ) return; if ( update.getSrc().equals(update.getDest()) ) return; // Different source and destination. gsAddTriples(datasetGraph, update.getSrc(), update.getDest()); }
@Override public boolean equalTo(Update obj, NodeIsomorphismMap isoMap) { if (this == obj) return true ; if (obj == null) return false ; if (getClass() != obj.getClass()) return false ; UpdateDropClear other = (UpdateDropClear)obj ; if ( silent != other.silent ) return false ; return target.equalTo(other.target, isoMap) ; } }