Search in sources :

Example 36 with PropertyContainer

use of org.neo4j.graphdb.PropertyContainer in project neo4j-mobile-android by neo4j-contrib.

the class PatternFinder method checkProperties.

private boolean checkProperties(AbstractPatternObject<? extends PropertyContainer> patternObject, PropertyContainer object) {
    PropertyContainer associatedObject = patternObject.getAssociation();
    if (associatedObject != null && !object.equals(associatedObject)) {
        return false;
    }
    for (Map.Entry<String, Collection<ValueMatcher>> matchers : patternObject.getPropertyConstraints()) {
        String key = matchers.getKey();
        Object propertyValue = object.getProperty(key, null);
        for (ValueMatcher matcher : matchers.getValue()) {
            if (!matcher.matches(propertyValue)) {
                return false;
            }
        }
    }
    return true;
}
Also used : PropertyContainer(org.neo4j.graphdb.PropertyContainer) Collection(java.util.Collection) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PropertyContainer (org.neo4j.graphdb.PropertyContainer)36 Test (org.junit.Test)11 Node (org.neo4j.graphdb.Node)11 LinkedList (java.util.LinkedList)8 Relationship (org.neo4j.graphdb.Relationship)7 Transaction (org.neo4j.graphdb.Transaction)6 HashSet (java.util.HashSet)4 IOException (java.io.IOException)3 List (java.util.List)3 Map (java.util.Map)3 GraphDatabaseAPI (org.neo4j.kernel.GraphDatabaseAPI)3 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)3 HashMap (java.util.HashMap)2 SystemException (javax.transaction.SystemException)2 NotFoundException (org.neo4j.graphdb.NotFoundException)2 Path (org.neo4j.graphdb.Path)2 TransactionFailureException (org.neo4j.graphdb.TransactionFailureException)2 ArrayBackedList (apoc.util.ArrayBackedList)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1