Class AnswerSyncer

java.lang.Object
org.aksw.qa.commons.sparql.AnswerSyncer

public class AnswerSyncer extends Object
Fires IQuestions against an endpoint and sets the endpoint's answers as golden answers.
Author:
jhuth
  • Constructor Details

    • AnswerSyncer

      public AnswerSyncer()
  • Method Details

    • syncAnswers

      public static void syncAnswers(IQuestion q, String endpoint) throws ExecutionException
      Retrieves answers for the sparql in this IQuestion from given endpoint, and sets it as goldenAnswers.

      If the resultSet of server is null(e.g. sparql timed out) golden answers will be an empty Set.

      Using syncAnswers(List, String) for multiple questions may increase performance.

      Parameters:
      q -
      endpoint - an endpoint e.g. SPARQLEndpoints.DBPEDIA_ORG
      Throws:
      ExecutionException - e.g. server error, times out, thread gets interrupted....
    • syncAnswers

      public static void syncAnswers(IQuestion q, String endpoint, int queryTimeoutInSecs) throws ExecutionException
      Retrieves answers for the sparql in this IQuestion from given endpoint, and sets it as goldenAnswers.

      If the resultSet of server is null(e.g. sparql timed out) golden answers will be an empty Set.

      Using syncAnswers(List, String) for multiple questions may increase performance.

      Parameters:
      q -
      endpoint - an endpoint e.g. SPARQLEndpoints.DBPEDIA_ORG
      queryTimeoutInSecs - Self-explanatory. if ! > 0 it will be ignored. (default 10secs)
      Throws:
      ExecutionException - e.g. server error, times out, thread gets interrupted....
    • syncAnswers

      public static void syncAnswers(List<IQuestion> questions, String endpoint) throws ExecutionException
      Retrieves answers for the sparql in all IQuestions from given endpoint, and sets it as goldenAnswers.

      If the resultSet of server is null(e.g. sparql timed out) golden answers will be an empty Set.

      Parameters:
      q -
      endpoint - an endpoint e.g. SPARQLEndpoints.DBPEDIA_ORG
      queryTimeoutInSecs - Self-explanatory. if ! > 0 it will be ignored. (default 10secs)
      Throws:
      ExecutionException - e.g. server error, times out, thread gets interrupted....
    • syncAnswers

      public static void syncAnswers(List<IQuestion> questions, String endpoint, int queryTimeoutInSecs) throws ExecutionException
      Retrieves answers for the sparql in all IQuestions from given endpoint, and sets it as goldenAnswers.

      If the resultSet of server is null(e.g. sparql timed out) golden answers will be an empty Set.

      Parameters:
      q -
      endpoint - an endpoint e.g. SPARQLEndpoints.DBPEDIA_ORG
      Throws:
      ExecutionException - e.g. server error, times out, thread gets interrupted....
    • answer

      private static void answer(ThreadedSPARQL sp, IQuestion q) throws ExecutionException
      Throws:
      ExecutionException