Class FileSeparatorQuerySource

java.lang.Object
org.aksw.iguana.cc.query.source.QuerySource
org.aksw.iguana.cc.query.source.impl.FileSeparatorQuerySource
Direct Known Subclasses:
FileLineQuerySource

public class FileSeparatorQuerySource extends QuerySource
The FileSeparatorQuerySource reads queries from a file with (multiline) queries that are separated by a separator.
Author:
frensing
  • Field Details

  • Constructor Details

    • FileSeparatorQuerySource

      public FileSeparatorQuerySource(Path path) throws IOException
      This constructor indexes the queries inside the given file. It assumes, that the queries inside the file are separated with the default separator ('###').
      Parameters:
      path - path to the queries-file
      Throws:
      IOException
    • FileSeparatorQuerySource

      public FileSeparatorQuerySource(Path path, String separator) throws IOException
      This constructor indexes the queries inside the given file. Queries inside the file should be separated with the given separator string. If the separator string parameter is blank, it assumes that the queries inside the file are separated by blank lines.
      Parameters:
      path - path to the queries-file
      separator - string with which the queries inside the file are separated
      Throws:
      IOException
  • Method Details

    • size

      public int size()
      Description copied from class: QuerySource
      This method returns the amount of queries in the source.
      Specified by:
      size in class QuerySource
      Returns:
      the number of queries in the source
    • getQuery

      public String getQuery(int index) throws IOException
      Description copied from class: QuerySource
      This method returns the query at the given index.
      Specified by:
      getQuery in class QuerySource
      Parameters:
      index - the index of the query counted from the first query (in the first file)
      Returns:
      String of the query
      Throws:
      IOException - if the query could not be read
    • getQueryStream

      public InputStream getQueryStream(int index) throws IOException
      Specified by:
      getQueryStream in class QuerySource
      Throws:
      IOException
    • getAllQueries

      public List<String> getAllQueries() throws IOException
      Description copied from class: QuerySource
      This method returns all queries in the source as a list of Strings.
      Specified by:
      getAllQueries in class QuerySource
      Returns:
      List of Strings of all queries
      Throws:
      IOException - if the queries could not be read