Examples of Query


Examples of net.didion.jwnl.dictionary.database.Query

  }

  public Query getRandomIndexWordQuery(POS pos) throws JWNLException {
    MinMax minMax = _minMaxIds.get(pos);
    if (minMax == null) {
      Query query = createPOSQuery(pos, COUNT_INDEX_WORDS_SQL);
      try {
        query.execute();
        query.getResults().next();
        minMax = new MinMax(query.getResults().getInt(1), query
            .getResults().getInt(2));
        _minMaxIds.put(pos, minMax);
      } catch (SQLException ex) {
        throw new JWNLException("DICTIONARY_EXCEPTION_023", ex);
      } finally {
        if (query != null) {
          query.close();
        }
      }
    }
    int id = minMax.getMin()
        + _rand.nextInt(minMax.getMax() - minMax.getMin());
View Full Code Here

Examples of net.fortytwo.twitlogic.proof.Query

            NodeSet ns = new NodeSet(v.value, (float) v.weight, infStep, context);
            answers.add(ns);
        }

        Information info = new Information(queryRawString, context);
        Query query = new Query(info, answers, context);
        return new QueryResult(query);
    }
View Full Code Here

Examples of net.hamnaberg.json.Query

    public void parseQueriesCollection() throws IOException {
        Collection collection = parser.parse(new InputStreamReader(getClass().getResourceAsStream("/queries.json")));
        assertNotNull(collection);
        assertEquals(URI.create("http://example.org/friends/"), collection.getHref().orElse(null));
        assertEquals(1, collection.getQueries().size());
        Query query = collection.getQueries().get(0);
        assertEquals("search", query.getData().get(0).get().getName());
    }
View Full Code Here

Examples of net.hydromatic.tpcds.query.Query

  @Test public void testQuery72Plan() {
    checkQuery(72).planContains("xx");
  }

  private OptiqAssert.AssertQuery checkQuery(int i) {
    final Query query = Query.of(i);
    String sql = query.sql(-1, new Random(0));
    switch (i) {
    case 72:
      // Work around OPTIQ-304: Support '<DATE> + <INTEGER>'.
      sql = sql.replace("+ 5", "+ interval '5' day");
    }
View Full Code Here

Examples of net.java.ao.Query

  }

  @Override
  public List<Level> all(Category category)
  {
    Query query = Query.select().where("CATEGORY = ?", category).order("LEVEL_NUMBER ASC");
    return Arrays.asList(ao.find(getClazz(), query));
  }
View Full Code Here

Examples of net.kuujo.copycat.Query

        Command command = findAnnotation(method, Command.class);
        if (command != null) {
          addCommandMethod(method, command);
        } else {
          // Check whether this method is a "query" method.
          Query query = findAnnotation(method, Query.class);
          if (query != null) {
            addQueryMethod(method, query);
          }
        }
      }
View Full Code Here

Examples of net.nutch.searcher.Query

    }
  }

/** Parse a query. */
  final public Query parse() throws ParseException {
  Query query = new Query();
  ArrayList terms;
  Token token;
  String field;
  boolean stop;
  boolean prohibited;
    nonOpOrTerm();
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case WORD:
      case ACRONYM:
      case SIGRAM:
      case PLUS:
      case MINUS:
      case QUOTE:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      stop=true; prohibited=false; field = Clause.DEFAULT_FIELD;
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PLUS:
      case MINUS:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case PLUS:
          jj_consume_token(PLUS);
              stop=false;
          break;
        case MINUS:
          jj_consume_token(MINUS);
                                        stop=false;prohibited=true;
          break;
        default:
          jj_la1[1] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[2] = jj_gen;
        ;
      }
      if (jj_2_1(2147483647)) {
        token = jj_consume_token(WORD);
        jj_consume_token(COLON);
                             field = token.image;
      } else {
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case QUOTE:
        terms = phrase(field);
                           stop=false;
        break;
      case WORD:
      case ACRONYM:
      case SIGRAM:
        // quoted terms or
              terms = compound(field);
        break;
      default:
        jj_la1[3] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      nonOpOrTerm();
      String[] array = (String[])terms.toArray(new String[terms.size()]);

      if (stop && terms.size()==1 && isStopWord(array[0])) {
        // ignore stop words only when single, unadorned terms
      } else {
        if (prohibited)
          query.addProhibitedPhrase(array, field);
        else
          query.addRequiredPhrase(array, field);
      }
    }
    {if (true) return query;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

Examples of net.opentsdb.core.Query

      final boolean rate = parts[--i].startsWith("rate");
      final RateOptions rate_options = QueryRpc.parseRateOptions(rate, parts[i]);
      if (rate) {
        i--;  // Move to the next part.
      }
      final Query tsdbquery = tsdb.newQuery();
      try {
        tsdbquery.setTimeSeries(metric, parsedtags, agg, rate, rate_options);
      } catch (NoSuchUniqueName e) {
        throw new BadRequestException(e.getMessage());
      }
      // downsampling function & interval.
      if (i > 0) {
        final int dash = parts[1].indexOf('-', 1)// 1st char can't be `-'.
        if (dash < 0) {
          throw new BadRequestException("Invalid downsampling specifier '"
                                        + parts[1] + "' in m=" + m);
        }
        Aggregator downsampler;
        try {
          downsampler = Aggregators.get(parts[1].substring(dash + 1));
        } catch (NoSuchElementException e) {
          throw new BadRequestException("No such downsampling function: "
                                        + parts[1].substring(dash + 1));
        }
        final long interval = DateTime.parseDuration(parts[1].substring(0, dash));
        tsdbquery.downsample(interval, downsampler);
      } else {
        tsdbquery.downsample(1000, agg);
      }
      tsdbqueries[nqueries++] = tsdbquery;
    }
    return tsdbqueries;
  }
View Full Code Here

Examples of net.sf.domainbeans.operation.annotation.Db.query

    }
    return null;
  }

  private Object doQuery() {
    query qry = getMethod().getAnnotation(query.class);
    String whereClause = qry.where();
    String cleanWhereClause = whereClause.replaceAll(":this.", ":");
    String queryString  = "from "+getOriginalObject().getClass().getCanonicalName()+((whereClause.length()==0)?"":" where "+cleanWhereClause);
    Query query = getEntityManager().createQuery(queryString);
    if(whereClause.lastIndexOf(":this.")>0){
      String[] whereCondition = whereClause.split(" ");
View Full Code Here

Examples of net.sf.hibernate.Query

                               String spec) throws YPersistenceException {
        if (!enabled) return;

        try {
            if (pmgr != null) {
                Query query = pmgr.createQuery("select from YLogIdentifier where case_id=" + caseid);
                for (Iterator it = query.iterate(); it.hasNext();) {
                    YLogIdentifier logid = (YLogIdentifier) it.next();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.