All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iot.jcypher.query.factories.clause.WHERE Maven / Gradle / Ivy

Go to download

Provides seamlessly integrated Java access to graph databases (Neo4J) at different levels of abstraction.

There is a newer version: 4.2.0
Show newest version
/************************************************************************
 * Copyright (c) 2014 IoT-Solutions e.U.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ************************************************************************/

package iot.jcypher.query.factories.clause;

import iot.jcypher.query.api.APIObject;
import iot.jcypher.query.api.APIObjectAccess;
import iot.jcypher.query.api.collection.IPredicateFunction;
import iot.jcypher.query.api.pattern.IElement;
import iot.jcypher.query.api.predicate.BooleanOperation;
import iot.jcypher.query.api.predicate.Concat;
import iot.jcypher.query.api.predicate.Concatenator;
import iot.jcypher.query.api.predicate.IBeforePredicate;
import iot.jcypher.query.ast.ASTNode;
import iot.jcypher.query.ast.ClauseType;
import iot.jcypher.query.factories.xpression.P;
import iot.jcypher.query.values.IHas;
import iot.jcypher.query.values.ValueElement;

/**
 * 
JCYPHER CLAUSE
*/ public class WHERE { /** *
JCYPHER
*
takes an expression like 'n.property("age")', yielding a property,
*
or 'x.length()', calculating some value
*
e.g. WHERE.valueOf(n.property("age"))...
*
*/ public static BooleanOperation valueOf(ValueElement val) { BooleanOperation ret = P.valueOf(val); ASTNode an = APIObjectAccess.getAstNode(ret); an.setClauseType(ClauseType.WHERE); return ret; } /** *
JCYPHER
*
tests for existence of node labels or node/relation properties,
*
accepts expressions like 'n.property("age")',
*
or 'n.label("Swedish")'
*
e.g. WHERE.has(n.property("age"))
*
*/ public static Concatenator has(IHas val) { Concatenator ret = P.has(val); ASTNode an = APIObjectAccess.getAstNode(ret); an.setClauseType(ClauseType.WHERE); return ret; } /** *
JCYPHER
*
negate a boolean
*
e.g. WHERE.NOT().has(n.property("age"))
*
*/ public static IBeforePredicate NOT() { IBeforePredicate ret = P.NOT(); ASTNode an = APIObjectAccess.getAstNode((APIObject) ret); an.setClauseType(ClauseType.WHERE); return ret; } /** *
JCYPHER
*
open a bracket; allows to nest expressions, must have a matching BR_CLOSE()
*
e.g. WHERE... ...BR_OPEN() *
.valueOf(charlie.property("lastName")).EQUALS("Sheen")
.BR_CLOSE()
*
*/ public static Concat BR_OPEN() { Concat ret = P.BR_OPEN(); ASTNode an = APIObjectAccess.getAstNode(ret); an.setClauseType(ClauseType.WHERE); return ret; } /** *
JCYPHER
*
matches a pattern expression against the graph. If the result is empty, returns false, else returns true
*
Use Factory Class X to create Expressions
*
e.g. ...existsPattern(X.node(n)...)
*
*/ public static Concatenator existsPattern(IElement X) { Concatenator ret = P.existsPattern(X); ASTNode an = APIObjectAccess.getAstNode(ret); an.setClauseType(ClauseType.WHERE); return ret; } /** *
JCYPHER
*
iterates over a collection allowing to test each element of the collection against a predicate expression
*
Use Factory Class I to create Expressions
*
e.g. ...holdsTrue(I.forAll(n)...)
*
*/ public static Concatenator holdsTrue(IPredicateFunction I) { Concatenator ret = P.holdsTrue(I); ASTNode an = APIObjectAccess.getAstNode(ret); an.setClauseType(ClauseType.WHERE); return ret; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy