use of org.eclipse.rdf4j.model.NamespaceAware in project rdf4j by eclipse.
the class Rio method write.
/**
* Writes the given statements to the given {@link RDFHandler}.
* <p>
* If the collection is a {@link Model}, its namespaces will also be written.
*
* @param model
* A collection of statements, such as a {@link Model}, to be written.
* @throws RDFHandlerException
* Thrown if there is an error writing the statements.
*/
public static void write(Iterable<Statement> model, RDFHandler writer) throws RDFHandlerException {
writer.startRDF();
if (model instanceof NamespaceAware) {
for (Namespace nextNamespace : ((NamespaceAware) model).getNamespaces()) {
writer.handleNamespace(nextNamespace.getPrefix(), nextNamespace.getName());
}
}
for (final Statement st : model) {
writer.handleStatement(st);
}
writer.endRDF();
}
Aggregations