private boolean isObsolete(Resource ctx) throws SailException { CloseableIteration<? extends Statement, SailException> stmts; stmts = super.getStatements(null, null, null, true, ctx); try { while (stmts.hasNext()) { Statement st = stmts.next(); URI pred = st.getPredicate(); Value obj = st.getObject(); String ns = pred.getNamespace(); if (Audit.NAMESPACE.equals(ns) || PROV.equals(ns) || AUDIT_2012.equals(ns)) continue; if (RDF.SUBJECT.equals(pred) || RDF.PREDICATE.equals(pred) || RDF.OBJECT.equals(pred)) continue; if (RDF.TYPE.equals(pred) && obj instanceof URI) { ns = ((URI) obj).getNamespace(); if (Audit.NAMESPACE.equals(ns) || PROV.equals(ns) || AUDIT_2012.equals(ns) || RDF.NAMESPACE.equals(ns)) continue; } return false; } } finally { stmts.close(); } return true; }
public AuditingConnection( AuditingSail sail, SailConnection wrappedCon, Set<Resource> predecessors) throws DatatypeConfigurationException { super(wrappedCon); this.sail = sail; factory = DatatypeFactory.newInstance(); vf = sail.getValueFactory(); entityResolver = new OperationEntityResolver(vf); currentTrx = vf.createURI(CURRENT_TRX.stringValue()); this.predecessors = predecessors; informedBy = vf.createURI(WAS_INFORMED_BY); qualifiedUsage = vf.createURI(QUALIFIED_USAGE); usedEntity = vf.createURI(ENTITY); changed = vf.createURI(CHANGED); subject = vf.createURI(RDF.SUBJECT.stringValue()); predicate = vf.createURI(RDF.PREDICATE.stringValue()); object = vf.createURI(RDF.OBJECT.stringValue()); }