@Override public void handleStatement(Statement st) throws RDFHandlerException { graph.add(st); }
@Override public void startRDF() throws RDFHandlerException { graph.clear(); }
Iterator<Statement> typeStatements = bufferedStatements.match(subject, RDF.TYPE, null, context); while (typeStatements.hasNext()) { Iterator<Statement> subjectStatements = bufferedStatements.match(subject, null, null, context); while (subjectStatements.hasNext()) { IRI predicate = subjectStatement.getPredicate(); if (!processedPredicates.contains(predicate)) { Iterator<Statement> toWrite = bufferedStatements.match(subject, predicate, null, context); while (toWrite.hasNext()) { bufferedStatements.clear(); contexts.clear();
/** * Adds the specified statement and makes sure that no other statements are present in the Graph with the * same subject and predicate. When contexts are specified, the (subj, pred) pair will occur exactly once * in each context, else the (subj, pred) pair will occur exactly once in the entire Graph. * * @deprecated since 2.8.0. Use {@link Models#setProperty(Model, Resource, IRI, Value, Resource...) } * instead. */ @Deprecated public static void setUniqueObject(Graph graph, Resource subj, IRI pred, Value obj, Resource... contexts) { Iterator<Statement> iter = graph.match(subj, pred, null, contexts); while (iter.hasNext()) { iter.next(); iter.remove(); } graph.add(subj, pred, obj, contexts); }
/** * Gets the subject of the statements with the specified predicate, object and (optionally) contexts from * the supplied graph. Calling this method is equivalent to calling * <tt>graph.match(null, pred, obj, contexts)</tt> and extracting the subjects of the matching statements * from the returned iterator. See {@link Graph#match(Resource, IRI, Value, Resource[])} for a description * of the parameter values. * * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...)} and * {@link Model#subjects()} instead. */ @Deprecated public static Iterator<Resource> getSubjectIterator(Graph graph, IRI pred, Value obj, Resource... contexts) { Iterator<Statement> iter = graph.match(null, pred, obj, contexts); return new ConvertingIterator<Statement, Resource>(iter) { @Override protected Resource convert(Statement st) throws RuntimeException { return st.getSubject(); } }; }
Iterator<Statement> typeStatements = bufferedStatements.match(subject, RDF.TYPE, null, context); while (typeStatements.hasNext()) { Iterator<Statement> subjectStatements = bufferedStatements.match(subject, null, null, context); while (subjectStatements.hasNext()) { IRI predicate = subjectStatement.getPredicate(); if (!processedPredicates.contains(predicate)) { Iterator<Statement> toWrite = bufferedStatements.match(subject, predicate, null, context); while (toWrite.hasNext()) { bufferedStatements.clear(); contexts.clear();
/** * Adds the specified statement and makes sure that no other statements are present in the Graph with the * same subject and predicate. When contexts are specified, the (subj, pred) pair will occur exactly once * in each context, else the (subj, pred) pair will occur exactly once in the entire Graph. * * @deprecated since 2.8.0. Use {@link Models#setProperty(Model, Resource, IRI, Value, Resource...) } * instead. */ @Deprecated public static void setUniqueObject(Graph graph, Resource subj, IRI pred, Value obj, Resource... contexts) { Iterator<Statement> iter = graph.match(subj, pred, null, contexts); while (iter.hasNext()) { iter.next(); iter.remove(); } graph.add(subj, pred, obj, contexts); }
/** * Gets the subject of the statements with the specified predicate, object and (optionally) contexts from * the supplied graph. Calling this method is equivalent to calling * <tt>graph.match(null, pred, obj, contexts)</tt> and extracting the subjects of the matching statements * from the returned iterator. See {@link Graph#match(Resource, IRI, Value, Resource[])} for a description * of the parameter values. * * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...)} and * {@link Model#subjects()} instead. */ @Deprecated public static Iterator<Resource> getSubjectIterator(Graph graph, IRI pred, Value obj, Resource... contexts) { Iterator<Statement> iter = graph.match(null, pred, obj, contexts); return new ConvertingIterator<Statement, Resource>(iter) { @Override protected Resource convert(Statement st) throws RuntimeException { return st.getSubject(); } }; }
Iterator<Statement> typeStatements = bufferedStatements.match(subject, RDF.TYPE, null, context); while (typeStatements.hasNext()) { Iterator<Statement> subjectStatements = bufferedStatements.match(subject, null, null, context); while (subjectStatements.hasNext()) { IRI predicate = subjectStatement.getPredicate(); if (!processedPredicates.contains(predicate)) { Iterator<Statement> toWrite = bufferedStatements.match(subject, predicate, null, context); while (toWrite.hasNext()) { bufferedStatements.clear(); contexts.clear();
@Override public void handleStatement(Statement st) throws RDFHandlerException { graph.add(st); }
@Override public void startRDF() throws RDFHandlerException { graph.clear(); }
/** * Gets the objects of the statements with the specified subject, predicate and (optionally) contexts from * the supplied graph. Calling this method is equivalent to calling * <tt>graph.match(subj, pred, null, contexts)</tt> and extracting the objects of the matching statements * from the returned iterator. See {@link Graph#match(Resource, IRI, Value, Resource[])} for a description * of the parameter values. * * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...)} and * {@link Model#objects()} instead. */ @Deprecated public static Iterator<Value> getObjectIterator(Graph graph, Resource subj, IRI pred, Resource... contexts) { Iterator<Statement> iter = graph.match(subj, pred, null, contexts); return new ConvertingIterator<Statement, Value>(iter) { @Override protected Value convert(Statement st) throws RuntimeException { return st.getObject(); } }; }
@Override public void handleStatement(Statement st) throws RDFHandlerException { graph.add(st); }
@Override public void startRDF() throws RDFHandlerException { graph.clear(); }
/** * Gets the objects of the statements with the specified subject, predicate and (optionally) contexts from * the supplied graph. Calling this method is equivalent to calling * <tt>graph.match(subj, pred, null, contexts)</tt> and extracting the objects of the matching statements * from the returned iterator. See {@link Graph#match(Resource, IRI, Value, Resource[])} for a description * of the parameter values. * * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...)} and * {@link Model#objects()} instead. */ @Deprecated public static Iterator<Value> getObjectIterator(Graph graph, Resource subj, IRI pred, Resource... contexts) { Iterator<Statement> iter = graph.match(subj, pred, null, contexts); return new ConvertingIterator<Statement, Value>(iter) { @Override protected Value convert(Statement st) throws RuntimeException { return st.getObject(); } }; }
@Override public void handleStatement(Statement st) throws RDFHandlerException { graph.add(st); }
@Override public void startRDF() throws RDFHandlerException { graph.clear(); }