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

iot.jcypher.query.factories.xpression.P 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.xpression;

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.api.predicate.PFactory;
import iot.jcypher.query.values.IHas;
import iot.jcypher.query.values.ValueElement;

/**
 * 
JCYPHER FACTORY FOR PREDICATE EXPRESSIONS
*/ public class P { /** *
JCYPHER
*
takes an expression like 'n.property("age")', yielding a property,
*
or 'x.length()', calculating some value
*
e.g. ...valueOf(n.property("age"))...
*
*/ public static BooleanOperation valueOf(ValueElement val) { return PFactory.valueOf(val); } /** *
JCYPHER
*
tests for existence of node labels or node/relation properties,
*
accepts expressions like 'n.property("age")',
*
or 'n.label("Swedish")'
*
e.g. ...has(n.property("age"))
*
*/ public static Concatenator has(IHas val) { return PFactory.has(val); } /** *
JCYPHER
*
negate a boolean
*
e.g. ...NOT().has(n.property("age"))
*
*/ public static IBeforePredicate NOT() { return PFactory.NOT(); } /** *
JCYPHER
*
open a bracket; allows to nest expressions, must have a matching BR_CLOSE()
*
e.g. ...BR_OPEN() *
.valueOf(charlie.property("lastName")).EQUALS("Sheen")
.BR_CLOSE()
*
*/ public static Concat BR_OPEN() { return PFactory.BR_OPEN(); } /** *
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) { return PFactory.existsPattern(X); } /** *
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 = PFactory.holdsTrue(I); return ret; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy