
net.fortytwo.sesametools.ReusableRDFHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Common utilities for Sesametools
The newest version!
package net.fortytwo.sesametools;
import org.openrdf.model.Statement;
import org.openrdf.rio.RDFHandler;
import org.openrdf.rio.RDFHandlerException;
/**
* An RDFHandler
which wraps another handler and ignores calls
* to startRDF
and endRDF
,
* allowing the base handler to be used multiple times.
* For example, there may be several distinct operations which push RDF statements
* into a wrapped RDFWriter before the document is terminated.
* To actually call the base handler's startRDF
and endRDF
methods,
* use reallyStartRDF
and reallyEndRDF
, respectively.
*
* @author Joshua Shinavier (http://fortytwo.net)
*/
public class ReusableRDFHandler implements RDFHandler {
private RDFHandler baseHandler;
public ReusableRDFHandler(final RDFHandler base) {
this.baseHandler = base;
}
public void startRDF() throws RDFHandlerException {
}
public void endRDF() throws RDFHandlerException {
}
public void reallyStartRDF() throws RDFHandlerException {
baseHandler.startRDF();
}
public void reallyEndRDF() throws RDFHandlerException {
baseHandler.endRDF();
}
public void handleNamespace(final String prefix, final String uri) throws RDFHandlerException {
baseHandler.handleNamespace(prefix, uri);
}
public void handleStatement(final Statement st) throws RDFHandlerException {
baseHandler.handleStatement(st);
}
public void handleComment(final String comment) throws RDFHandlerException {
baseHandler.handleComment(comment);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy