Example #1
0
 /**
  * Get the {@link QueryData} from a query and the corpus names
  *
  * @param query The AQL query.
  * @param rawCorpusNames The name of the toplevel corpus names seperated by ",".
  * @return calculated {@link QueryData} for the given parametes.
  * @throws WebApplicationException Thrown if some corpora are unknown to the system.
  */
 private QueryData queryDataFromParameters(String query, String rawCorpusNames)
     throws WebApplicationException {
   List<String> corpusNames = splitCorpusNamesFromRaw(rawCorpusNames);
   List<Long> corpusIDs = annisDao.mapCorpusNamesToIds(corpusNames);
   if (corpusIDs.size() != corpusNames.size()) {
     throw new WebApplicationException(
         Response.status(Response.Status.NOT_FOUND)
             .type("text/plain")
             .entity("one ore more corpora are unknown to the system")
             .build());
   }
   return annisDao.parseAQL(query, corpusIDs);
 }
Example #2
0
 /**
  * Return true if this is a valid query or throw exception when invalid
  *
  * @param query Query to check for validity
  * @return
  */
 @GET
 @Path("check")
 public String check(@QueryParam("q") String query) {
   annisDao.parseAQL(query, new LinkedList<Long>());
   return "ok";
 }