Class AbstractNIFParser

java.lang.Object
org.aksw.gerbil.io.nif.AbstractNIFParser
All Implemented Interfaces:
NIFParser
Direct Known Subclasses:
TurtleNIFParser

public abstract class AbstractNIFParser extends Object implements NIFParser
  • Field Details

  • Constructor Details

    • AbstractNIFParser

      public AbstractNIFParser(String httpContentType)
  • Method Details

    • parseNIF

      public List<Document> parseNIF(String nifString)
      Description copied from interface: NIFParser
      Parses the NIF data inside the given String and returns the list of documents that could be found.
      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      nifString - a String containing the NIF data
      Returns:
      a list of Document instances found in the given NIF
    • parseNIF

      public List<Document> parseNIF(String nifString, org.apache.jena.rdf.model.Model model)
      Description copied from interface: NIFParser
      Like NIFParser.parseNIF(String), this method parses the NIF data inside the given String and returns the list of documents that could be found. But it uses the given model to store this information.

      Note that the parser will use and change the data that is already inside the given model.

      The aim of this method is to take a reference to a model (that might be empty) and store all additional information that has been read but could not be added to the created Document instances.

      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      nifString - a String containing the NIF data
      model - a model which is used to store the NIF data
      Returns:
      a list of Document instances found in the given NIF
    • parseNIF

      public List<Document> parseNIF(Reader reader)
      Description copied from interface: NIFParser
      Parses the NIF data read from the given Reader and returns the list of documents that could be found.

      Note that following the recommendations of the Jena framework we highly recommend to use NIFParser.parseNIF(InputStream) instead of using a Reader since the InputStream is not relying on a specific encoding.

      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      reader - a Reader from which the NIF data is read
      Returns:
      a list of Document instances found in the given NIF
    • parseNIF

      public List<Document> parseNIF(Reader reader, org.apache.jena.rdf.model.Model nifModel)
      Description copied from interface: NIFParser
      Like NIFParser.parseNIF(Reader), this method parses the NIF data inside the given String and returns the list of documents that could be found. But it uses the given model to store this information.

      Note that following the recommendations of the Jena framework we highly recommend to use NIFParser.parseNIF(InputStream, Model) instead of using a Reader since the InputStream is not relying on a specific encoding.

      Note that the parser will use and change the data that is already inside the given model.

      The aim of this method is to take a reference to a model (that might be empty) and store all additional information that has been read but could not be added to the created Document instances.

      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      reader - a Reader from which the NIF data is read
      nifModel - a model which is used to store the NIF data
      Returns:
      a list of Document instances found in the given NIF
    • parseNIFModel

      protected abstract org.apache.jena.rdf.model.Model parseNIFModel(Reader reader, org.apache.jena.rdf.model.Model nifModel)
    • parseNIF

      public List<Document> parseNIF(InputStream is)
      Description copied from interface: NIFParser
      Parses the NIF data read from the given InputStream and returns the list of documents that could be found.
      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      is - an InputStream from which the NIF data is read
      Returns:
      a list of Document instances found in the given NIF
    • parseNIF

      public List<Document> parseNIF(InputStream is, org.apache.jena.rdf.model.Model nifModel)
      Description copied from interface: NIFParser
      Like NIFParser.parseNIF(InputStream), this method parses the NIF data inside the given String and returns the list of documents that could be found. But it uses the given model to store this information.

      Note that the parser will use and change the data that is already inside the given model.

      The aim of this method is to take a reference to a model (that might be empty) and store all additional information that has been read but could not be added to the created Document instances.

      Specified by:
      parseNIF in interface NIFParser
      Parameters:
      is - an InputStream from which the NIF data is read
      nifModel - a model which is used to store the NIF data
      Returns:
      a list of Document instances found in the given NIF
    • parseNIFModel

      protected abstract org.apache.jena.rdf.model.Model parseNIFModel(InputStream is, org.apache.jena.rdf.model.Model nifModel)
    • getHttpContentType

      public String getHttpContentType()
      Description copied from interface: NIFParser
      This method should return the HTTP content type string for the data that can be handled by this reader.
      Specified by:
      getHttpContentType in interface NIFParser
      Returns:
      the HTTP content type string
    • getDocumentListParser

      public DocumentListParser getDocumentListParser()
      Description copied from interface: NIFParser
      Returns the DocumentListParser used by this parser.
      Specified by:
      getDocumentListParser in interface NIFParser
      Returns:
      the DocumentListParser used by this parser
    • setDocumentListParser

      public void setDocumentListParser(DocumentListParser listParser)
      Description copied from interface: NIFParser
      Sets the DocumentListParser used by this parser.
      Specified by:
      setDocumentListParser in interface NIFParser
      Parameters:
      listParser - the DocumentListParser used by this parser
    • infereTypes

      protected void infereTypes(org.apache.jena.rdf.model.Model nifModel)