Class 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[] contexts
      The contexts to add the statements to.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractRDFInserter​(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.
    • Field Detail

      • contexts

        protected org.eclipse.rdf4j.model.Resource[] contexts
        The contexts to add the statements to. If this variable is a non-empty array, statements will be added to the corresponding contexts.
    • Constructor Detail

      • AbstractRDFInserter

        protected AbstractRDFInserter​(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 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