Search in sources :

Example 1 with ContextStatementImpl

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);
}
Also used : ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl) Statement(org.openrdf.model.Statement) StatementImpl(org.openrdf.model.impl.StatementImpl) ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl)

Example 2 with ContextStatementImpl

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);
    }
}
Also used : ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl) URIImpl(org.openrdf.model.impl.URIImpl) URI(org.openrdf.model.URI)

Aggregations

ContextStatementImpl (org.openrdf.model.impl.ContextStatementImpl)2 Statement (org.openrdf.model.Statement)1 URI (org.openrdf.model.URI)1 StatementImpl (org.openrdf.model.impl.StatementImpl)1 URIImpl (org.openrdf.model.impl.URIImpl)1