public Statement createStatement(Resource subject, URI predicate, Value object, Resource context) { return new ContextStatementImpl(subject, predicate, object, context); } }
@Override public RdbmsResource getContext() { return (RdbmsResource)super.getContext(); }
@Override public boolean equals(Object other) { if (this == other) return true; if (!super.equals(other)) return false; if (getContext() == null) return ((Statement) other).getContext() == null; return getContext().equals(((Statement) other).getContext()); } }
@Override public Statement createStatement(final Resource subject, final URI predicate, final Value object, final Resource context) { return new ContextStatementImpl(subject, predicate, object, context); }
@Override public String toString() { StringBuilder sb = new StringBuilder(256); sb.append(super.toString()); sb.append(" [").append(getContext()).append("]"); return sb.toString(); } }
@Override public Statement createStatement(final Resource subject, final URI predicate, final Value object, final Resource context) { return new ContextStatementImpl(subject, predicate, object, context); }
private Statement stmt(Resource s, URI p, Value o, Resource c) { return new ContextStatementImpl(s, p, o, c); }
/** * Creates a new statement with the supplied subject, predicate and object * and associated context. * * @param subject The statement's subject. * @param predicate The statement's predicate. * @param object The statement's object. * @param context The statement's context. * @return The created statement. */ @Override public Statement createStatement(Resource subject, URI predicate, Value object, Resource context) { return new ContextStatementImpl(subject,predicate,object,context); }
/** * Creates a new statement with the supplied subject, predicate and object * and associated context. * * @param subject The statement's subject. * @param predicate The statement's predicate. * @param object The statement's object. * @param context The statement's context. * @return The created statement. */ @Override public Statement createStatement(Resource subject, URI predicate, Value object, Resource context) { return new ContextStatementImpl(subject,predicate,object,context); }
@SuppressWarnings("unchecked") public void add(Resource s, URI p, Value o, Resource c) { add((F)new ContextStatementImpl(s,p,o,c)); }
@SuppressWarnings("unchecked") public void add(Resource s, URI p, Value o, Resource c) { add((F)new ContextStatementImpl(s,p,o,c)); }
private Statement stmt(Resource s, URI p, Value o, Resource c) { return new ContextStatementImpl(s, p, o, c); }
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); }
private void writeObject(ObjectOutputStream s) throws IOException { // Write out any hidden serialization magic s.defaultWriteObject(); // Write in size s.writeInt(statements.size()); // Write in all elements for (ModelStatement st : statements) { Resource subj = st.getSubject(); URI pred = st.getPredicate(); Value obj = st.getObject(); Resource ctx = st.getContext(); s.writeObject(new ContextStatementImpl(subj, pred, obj, ctx)); } }
public Collection<Statement> getStatements() { Collection<Statement> statements = new ArrayList<Statement>(); if (getContexts() != null && getContexts().length > 1) { for (Resource contxt : getContexts()) { statements.add(new ContextStatementImpl(getSubject(), getPredicate(), getObject(), contxt)); } } else statements.add(this); return statements; }
Resource context = (Resource) input.readObject(); model.add(new ContextStatementImpl(subject,predicate,object,context)); } else { model.add(new StatementImpl(subject,predicate,object));
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); } }
@Override public CloseableIteration<? extends Statement, ? extends Exception> get( final Resource subject, final URI predicate, final Value object, final Resource context) throws IOException, IllegalStateException { try { final long ts = System.currentTimeMillis(); final CloseableIteration<? extends Statement, ? extends Exception> result; if (subject == null || predicate == null || object == null || context == null) { result = logClose(this.connection.getStatements(subject, predicate, object, false, context)); LOGGER.debug("getStatements() iteration obtained in {} ms", System.currentTimeMillis() - ts); } else { Iterator<Statement> iterator; if (this.connection.hasStatement(subject, predicate, object, true, context)) { iterator = Collections.emptyIterator(); } else { iterator = Iterators .<Statement>singletonIterator(new ContextStatementImpl(subject, predicate, object, context)); } result = new CloseableIteratorIteration<Statement, RuntimeException>(iterator); LOGGER.debug("hasStatement() evaluated in {} ms", System.currentTimeMillis() - ts); } return result; } catch (final RepositoryException ex) { throw new IOException("Error while retrieving matching statements", ex); } }
private void writeObject(ObjectOutputStream s) throws IOException { // Write out any hidden serialization magic s.defaultWriteObject(); // Write in size Model delegate = getDelegate(); s.writeInt(delegate.size()); // Write in all elements for (Statement st : delegate) { Resource subj = st.getSubject(); URI pred = st.getPredicate(); Value obj = st.getObject(); Resource ctx = st.getContext(); s.writeObject(new ContextStatementImpl(subj, pred, obj, ctx)); } }
/** * Handles a statement. * * @param st The statement. * @throws org.openrdf.rio.RDFHandlerException If the RDF handler has encountered an unrecoverable error. */ @Override public void handleStatement(Statement st) throws RDFHandlerException { Statement wrapped = new ContextStatementImpl(st.getSubject(),st.getPredicate(),st.getObject(), context); super.handleStatement(wrapped); } }