/** * {@inheritDoc } */ public URI getInsertContext() { return connection.getInsertContext(); }
/** * Assigns a URI to this connection to be used for new blob versions and the * default insert graph. * * @param bundle * a unique URI */ public void setVersionBundle(URI bundle) { versionBundle = bundle; if (null == getInsertContext()) { setInsertContext(bundle); } }
/** * Assigns a URI to this connection to be used for new blob versions and the * default insert graph. * * @param bundle * a unique URI */ public void setVersionBundle(URI bundle) { versionBundle = bundle; if (null == getInsertContext()) { setInsertContext(bundle); } }
@Override public void setResource(Resource resource) throws MalformedQueryException, RepositoryException, UpdateExecutionException { String subjectQuery = "DELETE {?old ?p ?o}" + " INSERT {?new ?p ?o}" + " WHERE {" + " BIND(<"+this.getResourceAsString()+"> as ?old)" + " BIND(<"+resource+"> as ?new)" + " ?old ?p ?o.};"; String predicateQuery = "DELETE {?s ?old ?o}" + " INSERT {?s ?new ?o}" + " WHERE {" + " BIND(<"+this.getResourceAsString()+"> as ?old)" + " BIND(<"+resource+"> as ?new)" + " ?s ?old ?o.};"; String objectQuery = "DELETE {?s ?p ?old}" + " INSERT {?s ?p ?new}" + " WHERE {" + " BIND(<"+this.getResourceAsString()+"> as ?old)" + " BIND(<"+resource+"> as ?new)" + " ?s ?p ?old.};"; String query; if (this.getObjectConnection().getInsertContext() != null) { String with = "With <" + this.getObjectConnection().getInsertContext().stringValue()+ "> "; query = with + subjectQuery + " " + with + predicateQuery + " " + with + objectQuery; } else { query = subjectQuery + " " + predicateQuery + " " + objectQuery; } this.getObjectConnection().getDelegate().prepareUpdate(QueryLanguage.SPARQL, query).execute(); this.resource = resource; }