Class QuerySource

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

public abstract class QuerySource extends Object
The abstract class for a QuerySource.
The QuerySource provides the queries to the QueryList. It abstracts the actual format of the query files.
Author:
frensing
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
    This integer represents the hashcode of the file or folder, that contains the queries.
    protected final Path
    This string represents the path of the file or folder, that contains the queries.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract List<String>
    This method returns all queries in the source as a list of Strings.
    This method returns the path of the file or folder, that contains the queries.
    abstract String
    getQuery(int index)
    This method returns the query at the given index.
    abstract InputStream
    getQueryStream(int index)
     
    int
     
    abstract int
    This method returns the amount of queries in the source.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • path

      protected final Path path
      This string represents the path of the file or folder, that contains the queries.
    • hashCode

      protected final int hashCode
      This integer represents the hashcode of the file or folder, that contains the queries. It is stored for performance reasons, so that the hashcode does not have to be calculated every time it is needed. (It's needed everytime the id of a query is requested.)
  • Constructor Details

    • QuerySource

      public QuerySource(Path path)
  • Method Details

    • size

      public abstract int size()
      This method returns the amount of queries in the source.
      Returns:
      the number of queries in the source
    • getQuery

      public abstract String getQuery(int index) throws IOException
      This method returns the query at the given index.
      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 abstract InputStream getQueryStream(int index) throws IOException
      Throws:
      IOException
    • getAllQueries

      public abstract List<String> getAllQueries() throws IOException
      This method returns all queries in the source as a list of Strings.
      Returns:
      List of Strings of all queries
      Throws:
      IOException - if the queries could not be read
    • getPath

      public Path getPath()
      This method returns the path of the file or folder, that contains the queries.
      Returns:
      the path of the file or folder, that contains the queries
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object