ContainsQuery.java

  1. /*
  2.  *  ContainsQuery.java
  3.  *
  4.  *  Copyright (c) 2007-2011, The University of Sheffield.
  5.  *
  6.  *  This file is part of GATE Mímir (see http://gate.ac.uk/family/mimir.html),
  7.  *  and is free software, licenced under the GNU Lesser General Public License,
  8.  *  Version 3, June 2007 (also included with this distribution as file
  9.  *  LICENCE-LGPL3.html).
  10.  *
  11.  *  Valentin Tablan, 20 Mar 2009
  12.  *  $Id: ContainsQuery.java 14541 2011-11-14 19:31:23Z ian_roberts $
  13.  */
  14. package gate.mimir.search.query;


  15. import gate.mimir.search.QueryEngine;

  16. import java.io.IOException;
  17. import java.util.Iterator;
  18. import java.util.LinkedList;


  19. /**
  20.  * Filtering query that matches hits from the target query that
  21.  * contain a hit of the filter query, i.e. any
  22.  * X that has a Y within it.
  23.  */
  24. public class ContainsQuery extends AbstractOverlapQuery {

  25.   private static final long serialVersionUID = -3152202241528149456L;

  26.   public ContainsQuery(QueryNode outerQuery, QueryNode innerQuery) {
  27.     super(innerQuery,  outerQuery);
  28.   }

  29.   public QueryExecutor getQueryExecutor(QueryEngine engine) throws IOException {
  30.     return new AbstractOverlapQuery.OverlapQueryExecutor(this, engine,
  31.             SubQuery.OUTER);
  32.   }
  33.  
  34.   public String toString(){
  35.     return "CONTAINS (\nOUTER:" + outerQuery.toString() + ",\nINNER:" +
  36.         innerQuery.toString() +"\n)";
  37.   }
  38. }