org.eclipse.rdf4j.query.algebra.FunctionCall Java Examples

The following examples show how to use org.eclipse.rdf4j.query.algebra.FunctionCall. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConstantOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Determines if the provided zero-arg function is a function that should return a constant value for the entire
 * query execution (e.g NOW()), or if it should generate a new value for every call (e.g. RAND()).
 *
 * @param functionCall a zero-arg function call.
 * @return <code>true<code> iff the provided function returns a constant value for the query execution, <code>false</code>
 *         otherwise.
 */
private boolean isConstantZeroArgFunction(FunctionCall functionCall) {
	Function function = FunctionRegistry.getInstance()
			.get(functionCall.getURI())
			.orElseThrow(() -> new QueryEvaluationException(
					"Unable to find function with the URI: " + functionCall.getURI()));

	// we treat constant functions as the 'regular case' and make
	// exceptions for specific SPARQL built-in functions that require
	// different treatment.
	if (function instanceof Rand || function instanceof UUID || function instanceof STRUUID) {
		return false;
	}

	return true;
}
 
Example #2
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private FunctionCall createFunctionCall(String uri, SimpleNode node, int minArgs, int maxArgs)
		throws VisitorException {
	FunctionCall functionCall = new FunctionCall(uri);

	int noOfArguments = node.jjtGetNumChildren();

	if (noOfArguments > maxArgs || noOfArguments < minArgs) {
		throw new VisitorException("unexpected number of arguments (" + noOfArguments + ") for function " + uri);
	}

	for (int i = 0; i < noOfArguments; i++) {
		Node argNode = node.jjtGetChild(i);
		functionCall.addArg((ValueExpr) argNode.jjtAccept(this, null));
	}

	return functionCall;
}
 
Example #3
Source File: SerqlValueExprRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public void meet(FunctionCall theOp) throws Exception {
	mBuffer.append(theOp.getURI()).append("(");
	boolean aFirst = true;
	for (ValueExpr aArg : theOp.getArgs()) {
		if (!aFirst) {
			mBuffer.append(", ");
		} else {
			aFirst = false;
		}

		aArg.visit(this);
	}
	mBuffer.append(")");
}
 
Example #4
Source File: QueryRuleset.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void meet(final Filter node) throws QueryRulesetException {
    final ValueExpr condition = node.getCondition();
    // If the condition is a function call, and we don't know about the function, don't try to test for it.
    if (condition instanceof FunctionCall) {
        final String uri = ((FunctionCall) condition).getURI();
        if (FunctionRegistry.getInstance().get(uri) == null) {
            // Just extract statement patterns from the child as if there were no filter.
            node.getArg().visit(this);
        }
    }
    // Otherwise, assume we can test for it: extract rules from below this node, and add the condition to each one.
    else {
        final RulesetVisitor childVisitor = new RulesetVisitor();
        node.getArg().visit(childVisitor);
        for (final CopyRule rule : childVisitor.rules) {
            rule.addCondition(condition);
            rules.add(rule);
        }
        superclasses.addAll(childVisitor.superclasses);
        superproperties.addAll(childVisitor.superproperties);
    }
}
 
Example #5
Source File: PeriodicQueryUtil.java    From rya with Apache License 2.0 6 votes vote down vote up
public void meet(Filter node) {
    if (node.getCondition() instanceof FunctionCall) {
        try {
            Optional<PeriodicQueryNode> optNode = getPeriodicQueryNode((FunctionCall) node.getCondition(), node.getArg());
            if (optNode.isPresent()) {
                if (count > 0) {
                    throw new IllegalArgumentException("Query cannot contain more than one PeriodicQueryNode");
                }
                periodicNode = optNode.get();
                node.replaceWith(periodicNode);
                count++;
                periodicNode.visit(this);
            } else {
                super.meet(node);
            }
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    } else {
        super.meet(node);
    }
}
 
Example #6
Source File: SPARQLValueExprRenderer.java    From semagrow with Apache License 2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public void meet(FunctionCall theOp)
        throws Exception
{
    mBuffer.append("<").append(theOp.getURI()).append(">(");
    boolean aFirst = true;
    for (ValueExpr aArg : theOp.getArgs()) {
        if (!aFirst) {
            mBuffer.append(", ");
        }
        else {
            aFirst = false;
        }

        aArg.visit(this);
    }
    mBuffer.append(")");
}
 
Example #7
Source File: EventQueryNode2IT.java    From rya with Apache License 2.0 6 votes vote down vote up
private static Value[] extractArguments(final String matchName, final FunctionCall call) {
    final Value args[] = new Value[call.getArgs().size() - 1];
    int argI = 0;
    for (int i = 0; i != call.getArgs().size(); ++i) {
        final ValueExpr arg = call.getArgs().get(i);
        if (argI == i && arg instanceof Var && matchName.equals(((Var)arg).getName())) {
            continue;
        }
        if (arg instanceof ValueConstant) {
            args[argI] = ((ValueConstant)arg).getValue();
        } else if (arg instanceof Var && ((Var)arg).hasValue()) {
            args[argI] = ((Var)arg).getValue();
        } else {
            throw new IllegalArgumentException("Query error: Found " + arg + ", expected a Literal, BNode or URI");
        }
        ++argI;
    }
    return args;
}
 
Example #8
Source File: StrictEvaluationStrategy.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Evaluates a function.
 */
public Value evaluate(FunctionCall node, BindingSet bindings)
		throws QueryEvaluationException {
	Function function = FunctionRegistry.getInstance()
			.get(node.getURI())
			.orElseThrow(() -> new QueryEvaluationException("Unknown function '" + node.getURI() + "'"));

	// the NOW function is a special case as it needs to keep a shared
	// return
	// value for the duration of the query.
	if (function instanceof Now) {
		return evaluate((Now) function, bindings);
	}

	List<ValueExpr> args = node.getArgs();

	Value[] argValues = new Value[args.size()];

	for (int i = 0; i < args.size(); i++) {
		argValues[i] = evaluate(args.get(i), bindings);
	}

	return function.evaluate(tripleSource.getValueFactory(), argValues);

}
 
Example #9
Source File: HalyardValueExprEvaluation.java    From Halyard with Apache License 2.0 6 votes vote down vote up
/**
 * Evaluates a function.
 */
private Value evaluate(FunctionCall node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException {
    Optional<Function> function = FunctionRegistry.getInstance().get(node.getURI());
    if (!function.isPresent()) {
        throw new QueryEvaluationException("Unknown function '" + node.getURI() + "'");
    }
    // the NOW function is a special case as it needs to keep a shared return
    // value for the duration of the query.
    if (function.get() instanceof Now) {
        return evaluate((Now) function.get(), bindings);
    }
    List<ValueExpr> args = node.getArgs();
    Value[] argValues = new Value[args.size()];
    for (int i = 0; i < args.size(); i++) {
        argValues[i] = evaluate(args.get(i), bindings);
    }
    return function.get().evaluate(valueFactory, argValues);
}
 
Example #10
Source File: EventQueryNode.java    From rya with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance of {@link EventQueryNode}.
 * @param usedFilters
 *
 * @param type - The type of {@link Event} this node matches. (not null)
 * @param patterns - The query StatementPatterns that are solved using an
 *   Event of the Type. (not null)
 * @param entities - The {@link EventStorage} that will be searched to match
 *   {@link BindingSet}s when evaluating a query. (not null)
 */
private EventQueryNode(final EventStorage eventStore, final StatementPattern geoPattern, final StatementPattern temporalPattern, final Collection<IndexingExpr> geoFilters, final Collection<IndexingExpr> temporalFilters, final Collection<FunctionCall> usedFilters) throws IllegalStateException {
    this.geoPattern = requireNonNull(geoPattern);
    this.temporalPattern = requireNonNull(temporalPattern);
    this.geoFilters = requireNonNull(geoFilters);
    this.temporalFilters = requireNonNull(temporalFilters);
    this.eventStore = requireNonNull(eventStore);
    this.usedFilters = requireNonNull(usedFilters);
    bindingNames = new HashSet<>();

    // Subject based preconditions.
    verifySameSubjects(getPatterns());
    // Predicate based preconditions.
    verifyAllPredicatesAreConstants(getPatterns());

    // The Subject may either be constant or a variable.
    final Var subject = patterns.iterator().next().getSubjectVar();
    subjectIsConstant = subject.isConstant();
    if(subjectIsConstant) {
        subjectConstant = Optional.of( subject.getValue().toString() );
        subjectVar = Optional.empty();
    } else {
        subjectConstant = Optional.empty();
        subjectVar = Optional.of( subject.getName() );
    }
}
 
Example #11
Source File: GeoParseUtils.java    From rya with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts the arguments used in a {@link FunctionCall}.
 * @param matchName - The variable name to match to arguments used in the {@link FunctionCall}.
 * @param call - The {@link FunctionCall} to match against.
 * @return - The {@link Value}s matched.
 */
public static Object[] extractArguments(final String matchName, final FunctionCall call) {
    final Object[] args = new Object[call.getArgs().size() - 1];
    int argI = 0;
    for (int i = 0; i != call.getArgs().size(); ++i) {
        final ValueExpr arg = call.getArgs().get(i);
        if (argI == i && arg instanceof Var && matchName.equals(((Var)arg).getName())) {
            continue;
        }
        if (arg instanceof ValueConstant) {
            args[argI] = ((ValueConstant)arg).getValue();
        } else if (arg instanceof Var && ((Var)arg).hasValue()) {
            args[argI] = ((Var)arg).getValue();
        } else {
            args[argI] = arg;
        }
        ++argI;
    }
    return args;
}
 
Example #12
Source File: ParallelSplitFunction.java    From Halyard with Apache License 2.0 6 votes vote down vote up
@Override
public void meet(FunctionCall node) throws IllegalArgumentException {
    if (PARALLEL_SPLIT_FUNCTION.toString().equals(node.getURI())) {
        List<ValueExpr> args = node.getArgs();
        if (args.size() < 2) throw new IllegalArgumentException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function has at least two mandatory arguments: <constant number of parallel forks> and <binding variable(s) to filter by>");
        try {
            int num = Integer.parseInt(((ValueConstant)args.get(0)).getValue().stringValue());
            if (num < 1) throw new NullPointerException();
            if (forks == 0) {
                forks = num;
            } else if (forks != num) {
                throw new IllegalArgumentException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function is used twice with different first argument (number of forks)");
            }
        } catch (ClassCastException | NullPointerException | NumberFormatException ex) {
            throw new IllegalArgumentException(PARALLEL_SPLIT_FUNCTION.getLocalName() + " function first argument (number of forks) must be integer constant >0");
        }
    }
}
 
Example #13
Source File: DistanceQuerySpec.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public DistanceQuerySpec(FunctionCall distanceFunction, ValueExpr distanceExpr, String distVar, Filter filter) {
	this.distanceFunction = distanceFunction;
	this.distanceExpr = distanceExpr;
	this.distanceVar = distVar;
	this.filter = filter;
	if (distanceFunction != null) {
		List<ValueExpr> args = distanceFunction.getArgs();
		this.from = getLiteral(args.get(0));
		this.geoVar = getVarName(args.get(1));
		this.units = getURI(args.get(2));
	} else {
		this.from = null;
		this.geoVar = null;
		this.units = null;
	}
	if (distanceExpr != null) {
		Literal dist = getLiteral(distanceExpr);
		this.distance = (dist != null) ? dist.doubleValue() : Double.NaN;
	} else {
		this.distance = Double.NaN;
	}
}
 
Example #14
Source File: FilterFunctionOptimizer.java    From rya with Apache License 2.0 6 votes vote down vote up
private Value[] extractArguments(final String matchName, final FunctionCall call) {
    final Value args[] = new Value[call.getArgs().size() - 1];
    int argI = 0;
    for (int i = 0; i != call.getArgs().size(); ++i) {
        final ValueExpr arg = call.getArgs().get(i);
        if (argI == i && arg instanceof Var && matchName.equals(((Var)arg).getName())) {
            continue;
        }
        if (arg instanceof ValueConstant) {
            args[argI] = ((ValueConstant)arg).getValue();
        } else if (arg instanceof Var && ((Var)arg).hasValue()) {
            args[argI] = ((Var)arg).getValue();
        } else {
            throw new IllegalArgumentException("Query error: Found " + arg + ", expected a Literal, BNode or URI");
        }
        ++argI;
    }
    return args;
}
 
Example #15
Source File: RegexAsStringFunctionOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void strstartsCandidate(Regex node, String regex) {
	final String potential = regex.substring(1, regex.length());
	if (plain(potential)) {
		ValueConstant vc = new ValueConstant(vf.createLiteral(potential));
		node.replaceWith(new FunctionCall(FN.STARTS_WITH.stringValue(), node.getArg(), vc));
	}
}
 
Example #16
Source File: GeoTemporalMongoDBStorageStrategyTest.java    From rya with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsInstantAfterInterval_onlyOneGeo() throws Exception {
    final String query =
      "PREFIX geo: <http://www.opengis.net/ont/geosparql#>"
    + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>"
    + "SELECT ?point ?wkt "
    + "WHERE { "
      + "  ?point geo:asWKT ?wkt . "
      + "  FILTER(geof:sfWithin(?wkt, \"POLYGON((-3 -2, -3 2, 1 2, 1 -2, -3 -2))\"^^geo:wktLiteral)) "
    + "}";
    final List<IndexingExpr> geoFilters = new ArrayList<>();
    final List<StatementPattern> sps = getSps(query);
    final List<FunctionCall> filters = getFilters(query);
    for(final FunctionCall filter : filters) {
        //should only be one.
        final Var objVar = IndexingFunctionRegistry.getResultVarFromFunctionCall(VF.createIRI(filter.getURI()), filter.getArgs());
        final Value[] arguments = extractArguments(objVar.getName(), filter);
        final IndexingExpr expr = new IndexingExpr(VF.createIRI(filter.getURI()), sps.get(0), Arrays.stream(arguments).toArray());
        geoFilters.add(expr);
    }
    final List<IndexingExpr> temporalFilters = new ArrayList<>();
    final Document actual = adapter.getFilterQuery(geoFilters, temporalFilters);
    final String expectedString =
        "{ "
        + "\"location\" : { "
          + "\"$geoWithin\" : { "
            + "\"$geometry\" : { "
              + "\"coordinates\" : [ [ [ -3.0 , -2.0] , [ -3.0 , 2.0] , [ 1.0 , 2.0] , [ 1.0 , -2.0] , [ -3.0 , -2.0]]] , "
              + "\"type\" : \"Polygon\""
            + "}"
          + "}"
        + "}"
      + "}";
    final Document expected = Document.parse(expectedString);
    assertEqualMongo(expected, actual);
}
 
Example #17
Source File: SpinFunctionInterpreter.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(FunctionCall node) throws RDF4JException {
	String name = node.getURI();
	if (!functionRegistry.has(name)) {
		IRI funcUri = vf.createIRI(name);
		Function f = parser.parseFunction(funcUri, tripleSource);
		functionRegistry.add(f);
	}
	super.meet(node);
}
 
Example #18
Source File: SpinRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(FunctionCall node) throws RDFHandlerException {
	Resource currentSubj = subject;
	flushPendingStatement();
	handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, toValue(node)));
	List<ValueExpr> args = node.getArgs();
	for (int i = 0; i < args.size(); i++) {
		predicate = toArgProperty(i + 1);
		args.get(i).visit(this);
	}
	subject = currentSubj;
	predicate = null;
}
 
Example #19
Source File: RegexAsStringFunctionOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void strendsCandidate(Regex node, String regex) {
	final String potential = regex.substring(0, regex.length() - 1);
	if (plain(potential)) {
		ValueConstant vc = new ValueConstant(vf.createLiteral(potential));
		node.replaceWith(new FunctionCall(FN.ENDS_WITH.stringValue(), node.getArg(), vc));
	}
}
 
Example #20
Source File: GeoTemporalMongoDBStorageStrategyTest.java    From rya with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsInstantAfterInterval_onlyOneTemporal() throws Exception {
    final String query =
      "PREFIX time: <http://www.w3.org/2006/time#> \n"
    + "PREFIX tempo: <tag:rya-rdf.org,2015:temporal#> \n"
    + "SELECT ?event ?time "
    + "WHERE { "
      + "  ?event time:atTime ?time . "
      + "  FILTER(tempo:equals(?time, \"2015-12-30T12:00:00Z\")) . "
    + "}";
    final List<IndexingExpr> geoFilters = new ArrayList<>();
    final List<IndexingExpr> temporalFilters = new ArrayList<>();
    final List<StatementPattern> sps = getSps(query);
    final List<FunctionCall> filters = getFilters(query);
    for(final FunctionCall filter : filters) {
        //should only be one.
        final Var objVar = IndexingFunctionRegistry.getResultVarFromFunctionCall(VF.createIRI(filter.getURI()), filter.getArgs());
        final Value[] arguments = extractArguments(objVar.getName(), filter);
        final IndexingExpr expr = new IndexingExpr(VF.createIRI(filter.getURI()), sps.get(0), Arrays.stream(arguments).toArray());
        temporalFilters.add(expr);
    }
    final Document actual = adapter.getFilterQuery(geoFilters, temporalFilters);
    final String expectedString =
    "{ "
    + "\"instant\" : {"
      + "\"$date\" : \"2015-12-30T12:00:00.000Z\""
    + "}"
  + "}";
    final Document expected = Document.parse(expectedString);
    assertEqualMongo(expected, actual);
}
 
Example #21
Source File: GeoEnabledFilterFunctionOptimizer.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void meet(final FunctionCall fn) {
    final IRI fun = VF.createIRI(fn.getURI());
    final Var result = IndexingFunctionRegistry.getResultVarFromFunctionCall(fun, fn.getArgs());
    if (result != null && !searchProperties.contains(result)) {
        searchProperties.add(result);
    }
}
 
Example #22
Source File: SpinRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Value toValue(FunctionCall node) {
	String funcName = node.getURI();
	IRI funcUri = wellKnownFunctions.apply(funcName);
	if (funcUri == null) {
		funcUri = valueFactory.createIRI(funcName);
	}
	return funcUri;
}
 
Example #23
Source File: LocalSiteCapabilities.java    From semagrow with Apache License 2.0 5 votes vote down vote up
@Override
public boolean acceptsFilter(Plan p1, ValueExpr cond) {
    if (cond instanceof FunctionCall) {
        return acceptsFunction((FunctionCall)cond);
    }
    else
        return true;
}
 
Example #24
Source File: FilterFunctionOptimizer.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void meet(final FunctionCall fn) {
    final IRI fun = VF.createIRI(fn.getURI());
    final Var result = IndexingFunctionRegistry.getResultVarFromFunctionCall(fun, fn.getArgs());
    if (result != null && !searchProperties.contains(result)) {
        searchProperties.add(result);
    }
}
 
Example #25
Source File: PeriodicQueryUtilTest.java    From rya with Apache License 2.0 5 votes vote down vote up
@Test
public void periodicNodeFractionalDurationTest() throws Exception {
    
    List<ValueExpr> values = Arrays.asList(new Var("time"), new ValueConstant(VF.createLiteral(1)), new ValueConstant(VF.createLiteral(.5)), new ValueConstant(VF.createIRI(PeriodicQueryUtil.temporalNameSpace + "hours")));
    FunctionCall func = new FunctionCall(PeriodicQueryUtil.PeriodicQueryURI, values);
    Optional<PeriodicQueryNode> node1 = PeriodicQueryUtil.getPeriodicQueryNode(func, new Join());
    Assert.assertEquals(true, node1.isPresent());
    
    double window = 1*60*60*1000;
    double period = .5*3600*1000;
    
    PeriodicQueryNode node2 = new PeriodicQueryNode((long) window, (long) period, TimeUnit.MILLISECONDS, "time", new Join());
    
    Assert.assertEquals(true, periodicNodesEqualIgnoreArg(node1.get(), node2));
}
 
Example #26
Source File: PeriodicQueryUtilTest.java    From rya with Apache License 2.0 5 votes vote down vote up
@Test
public void periodicNodePresentTest() throws Exception {
    
    List<ValueExpr> values = Arrays.asList(new Var("time"), new ValueConstant(VF.createLiteral(12.0)), new ValueConstant(VF.createLiteral(6.0)), new ValueConstant(VF.createIRI(PeriodicQueryUtil.temporalNameSpace + "hours")));
    FunctionCall func = new FunctionCall(PeriodicQueryUtil.PeriodicQueryURI, values);
    Optional<PeriodicQueryNode> node1 = PeriodicQueryUtil.getPeriodicQueryNode(func, new Join());
    Assert.assertEquals(true, node1.isPresent());
    
    PeriodicQueryNode node2 = new PeriodicQueryNode(12*60*60*1000L, 6*3600*1000L, TimeUnit.MILLISECONDS, "time", new Join());
    
    Assert.assertEquals(true, periodicNodesEqualIgnoreArg(node1.get(), node2));
}
 
Example #27
Source File: PeriodicQueryUtilTest.java    From rya with Apache License 2.0 5 votes vote down vote up
@Test
public void periodicNodeNotPresentTest() throws Exception {
    
    List<ValueExpr> values = Arrays.asList(new Var("time"), new ValueConstant(VF.createLiteral(12.0)), new ValueConstant(VF.createLiteral(6.0)), new ValueConstant(VF.createIRI(PeriodicQueryUtil.temporalNameSpace + "hours")));
    FunctionCall func = new FunctionCall("uri:func", values);
    Optional<PeriodicQueryNode> node1 = PeriodicQueryUtil.getPeriodicQueryNode(func, new Join());
    Assert.assertEquals(false, node1.isPresent());
}
 
Example #28
Source File: PeriodicQueryUtil.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a PeriodicQueryNode for all {@link FunctionCall}s that represent PeriodicQueryNodes, otherwise
 * an empty Optional is returned.
 * @param functionCall - FunctionCall taken from a {@link TupleExpr}
 * @param arg - TupleExpr that will be the argument of the PeriodicQueryNode if it is created
 * @return - Optional containing a PeriodicQueryNode if FunctionCall represents PeriodicQueryNode and empty Optional otherwise
 * @throws Exception
 */
public static Optional<PeriodicQueryNode> getPeriodicQueryNode(FunctionCall functionCall, TupleExpr arg) throws Exception {

    if (functionCall.getURI().equals(PeriodicQueryURI)) {
        return Optional.of(parseAndSetValues(functionCall.getArgs(), arg));
    }

    return Optional.empty();
}
 
Example #29
Source File: GeoTemporalIndexSetProvider.java    From rya with Apache License 2.0 5 votes vote down vote up
private void buildMaps(final QuerySegment<EventQueryNode> node) {
    final List<QueryModelNode> unused = new ArrayList<>();
    for (final QueryModelNode pattern : node.getOrderedNodes()) {
        if(pattern instanceof FunctionCall) {
            discoverFilter((FunctionCall) pattern, unused);
        }
        if(pattern instanceof StatementPattern) {
            discoverPatterns((StatementPattern) pattern, unused);
        }
    }
}
 
Example #30
Source File: GeoTemporalIndexSetProvider.java    From rya with Apache License 2.0 5 votes vote down vote up
private void discoverFilter(final FunctionCall filter, final List<QueryModelNode> unmatched) {
    try {
        filter.visit(new FilterVisitor());
    } catch (final Exception e) {
        LOG.error("Failed to match the filter object.", e);
    }
}