use of org.openrdf.model.impl.ContextStatementImpl in project blueprints by tinkerpop.
the class SailHelper method addStatement.
protected static void addStatement(final Resource subject, final URI predicate, final Value object, final Resource context, final SailConnection sailConnection) {
Statement statement;
if (null != context) {
statement = new ContextStatementImpl(subject, predicate, object, context);
} else {
statement = new StatementImpl(subject, predicate, object);
}
SailHelper.addStatement(statement, sailConnection);
}
use of org.openrdf.model.impl.ContextStatementImpl in project blueprints by tinkerpop.
the class SailEdge method setProperty.
public void setProperty(final String key, final Object value) {
if (key.equals(SailTokens.NAMED_GRAPH)) {
try {
URI namedGraph = new URIImpl(this.graph.expandPrefix(value.toString()));
SailHelper.removeStatement(this.rawEdge, this.graph.getSailConnection().get());
this.rawEdge = new ContextStatementImpl(this.rawEdge.getSubject(), this.rawEdge.getPredicate(), this.rawEdge.getObject(), namedGraph);
SailHelper.addStatement(this.rawEdge, this.graph.getSailConnection().get());
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
} else {
throw new IllegalArgumentException(NAMED_GRAPH_PROPERTY);
}
}
Aggregations