Examples of OSQLPredicate


Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

      return;

    if (currentRecord == null)
      return;

    final Object result = new OSQLPredicate(iText).evaluate(currentRecord, null, null);

    if (result != null) {
      if (result instanceof OIdentifiable) {
        setResultset(new ArrayList<OIdentifiable>());
        currentRecord = ((OIdentifiable) result).getRecord();
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

      return;

    if (currentRecord == null)
      return;

    final Object result = new OSQLPredicate(iText).evaluate(currentRecord, null, null);
    if (result != null)
      out.println("\n" + result);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

  public Object evaluate(final OCommandContext iContext, final String iExpression) {
    if (iExpression == null)
      throw new OProcessException("Null expression");

    final OSQLPredicate predicate = new OSQLPredicate((String) resolveValue(iContext, iExpression, true));
    final Object result = predicate.evaluate(iContext);

    debug(iContext, "Evaluated expression '" + iExpression + "' = " + result);

    return result;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

    if (value instanceof String)
      value = OVariableParser.resolveVariables((String) value, "={", "}", new OVariableParserListener() {

        @Override
        public Object resolve(final String iVariable) {
          return new OSQLPredicate(iVariable).evaluate(iContext);
        }

      });
    return value;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

  }

  public Object execute(Object iThis, final OIdentifiable iRecord, final Object iCurrentResult, final Object[] iParams,
      OCommandContext iContext) {
    if (predicate == null)
      predicate = new OSQLPredicate((String) iParams[0].toString());

    final ODocument currentResult = iCurrentResult instanceof ODocument ? (ODocument) iCurrentResult : null;
    try {
      return predicate.evaluate(iRecord != null ? iRecord.getRecord() : null, currentResult, iContext);
    } catch (ArithmeticException e) {
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

  @Test
  public void traverseAPIandSQLIterating() {
    int cycles = 0;
    for (OIdentifiable id : new OTraverse().target(database.browseClass("Movie").iterator()).predicate(
        new OSQLPredicate("$depth <= 2"))) {
      cycles++;
    }
    Assert.assertTrue(cycles > 0);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

    graph.drop();
  }

  @Test
  public void testPredicate() throws Exception {
    Iterable<OrientVertex> p1 = (Iterable<OrientVertex>) luca.execute(new OSQLPredicate("out()"));
    Assert.assertTrue(p1.iterator().hasNext());
    Assert.assertEquals(p1.iterator().next(), bill);

    Iterable<OrientVertex> p2 = (Iterable<OrientVertex>) luca.execute(new OSQLPredicate("out().out('Friend')"));
    Assert.assertTrue(p2.iterator().hasNext());
    Assert.assertEquals(p2.iterator().next(), jay);

    Iterable<OrientVertex> p3 = (Iterable<OrientVertex>) luca.execute(new OSQLPredicate("out().out('Friend').out('Friend')"));
    Assert.assertTrue(p3.iterator().hasNext());
    Assert.assertEquals(p3.iterator().next(), steve);

  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

        try {
          runtimeParameters[i] = ((OCommandSQL) configuredParameters[i]).setContext(iContext).execute();
        } catch (OCommandExecutorNotFoundException e) {
          // TRY WITH SIMPLE CONDITION
          final String text = ((OCommandSQL) configuredParameters[i]).getText();
          final OSQLPredicate pred = new OSQLPredicate(text);
          runtimeParameters[i] = pred.evaluate(iCurrentRecord instanceof ORecord ? (ORecord) iCurrentRecord : null,
              (ODocument) iCurrentResult, iContext);
          // REPLACE ORIGINAL PARAM
          configuredParameters[i] = pred;

        }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.filter.OSQLPredicate

            try {
              runtimeParameters[i] = ((OCommandSQL) configuredParameters[i]).setContext(iContext).execute();
            } catch (OCommandExecutorNotFoundException e) {
              // TRY WITH SIMPLE CONDITION
              final String text = ((OCommandSQL) configuredParameters[i]).getText();
              final OSQLPredicate pred = new OSQLPredicate(text);
              runtimeParameters[i] = pred.evaluate(iCurrentRecord instanceof ORecord ? (ORecord) iCurrentRecord : null,
                  (ODocument) iCurrentResult, iContext);
              // REPLACE ORIGINAL PARAM
              configuredParameters[i] = pred;

            }
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.