Class AbstractRDFInserter
- java.lang.Object
-
- org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler
-
- org.eclipse.rdf4j.repository.util.AbstractRDFInserter
-
- All Implemented Interfaces:
RDFHandler
- Direct Known Subclasses:
RDFInserter
public abstract class AbstractRDFInserter extends AbstractRDFHandler
An RDFHandler that adds RDF data to some RDF sink.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.rdf4j.model.Resource[]contextsThe contexts to add the statements to.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRDFInserter(org.eclipse.rdf4j.model.ValueFactory vf)Creates a new RDFInserter object that preserves bnode IDs and that does not enforce any context upon statements that are reported to it.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddNamespace(String prefix, String name)protected abstract voidaddStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource ctxt)voidendRDF()voidenforceContext(org.eclipse.rdf4j.model.Resource... contexts)Enforces the supplied contexts upon all statements that are reported to this RDFInserter.booleanenforcesContext()Checks whether this RDFInserter enforces its contexts upon all statements that are reported to it.org.eclipse.rdf4j.model.Resource[]getContexts()Gets the contexts that this RDFInserter enforces upon all statements that are reported to it (in case enforcesContext() returns true).voidhandleNamespace(String prefix, String name)voidhandleStatement(org.eclipse.rdf4j.model.Statement st)booleanpreservesBNodeIDs()Checks whether this RDFInserter preserves blank node IDs.voidsetPreserveBNodeIDs(boolean preserveBNodeIDs)Sets whether this RDFInserter should preserve blank node IDs.-
Methods inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler
handleComment, startRDF
-
-
-
-
Method Detail
-
setPreserveBNodeIDs
public void setPreserveBNodeIDs(boolean preserveBNodeIDs)
Sets whether this RDFInserter should preserve blank node IDs.- Parameters:
preserveBNodeIDs- The new value for this flag.
-
preservesBNodeIDs
public boolean preservesBNodeIDs()
Checks whether this RDFInserter preserves blank node IDs.
-
enforceContext
public void enforceContext(org.eclipse.rdf4j.model.Resource... contexts)
Enforces the supplied contexts upon all statements that are reported to this RDFInserter.- Parameters:
contexts- the contexts to use. Use an empty array (not null!) to indicate no context(s) should be enforced.
-
enforcesContext
public boolean enforcesContext()
Checks whether this RDFInserter enforces its contexts upon all statements that are reported to it.- Returns:
- true if it enforces its contexts, false otherwise.
-
getContexts
public org.eclipse.rdf4j.model.Resource[] getContexts()
Gets the contexts that this RDFInserter enforces upon all statements that are reported to it (in case enforcesContext() returns true).- Returns:
- A Resource[] identifying the contexts, or an empty array if no contexts is enforced.
-
addNamespace
protected abstract void addNamespace(String prefix, String name) throws org.eclipse.rdf4j.common.exception.RDF4JException
- Throws:
org.eclipse.rdf4j.common.exception.RDF4JException
-
addStatement
protected abstract void addStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource ctxt) throws org.eclipse.rdf4j.common.exception.RDF4JException- Throws:
org.eclipse.rdf4j.common.exception.RDF4JException
-
endRDF
public void endRDF() throws RDFHandlerException- Specified by:
endRDFin interfaceRDFHandler- Overrides:
endRDFin classAbstractRDFHandler- Throws:
RDFHandlerException
-
handleNamespace
public void handleNamespace(String prefix, String name)
- Specified by:
handleNamespacein interfaceRDFHandler- Overrides:
handleNamespacein classAbstractRDFHandler
-
handleStatement
public void handleStatement(org.eclipse.rdf4j.model.Statement st) throws RDFHandlerException- Specified by:
handleStatementin interfaceRDFHandler- Overrides:
handleStatementin classAbstractRDFHandler- Throws:
RDFHandlerException
-
-