Search in sources :

Example 1 with ValueProperty

use of ai.grakn.graql.internal.pattern.property.ValueProperty in project grakn by graknlabs.

the class GreedyTraversalPlan method processFragmentWithDependencies.

private static void processFragmentWithDependencies(Map<NodeId, Node> allNodes, Fragment fragment) {
    // it's either neq or value fragment
    Node start = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
    Node other = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.dependencies().iterator().next(), allNodes);
    start.getFragmentsWithDependency().add(fragment);
    other.getDependants().add(fragment);
    // check whether it's value fragment
    if (fragment.varProperty() instanceof ValueProperty) {
        // as value fragment is not symmetric, we need to add it again
        other.getFragmentsWithDependency().add(fragment);
        start.getDependants().add(fragment);
    }
}
Also used : Node(ai.grakn.graql.internal.gremlin.spanningtree.graph.Node) ValueProperty(ai.grakn.graql.internal.pattern.property.ValueProperty)

Example 2 with ValueProperty

use of ai.grakn.graql.internal.pattern.property.ValueProperty in project grakn by graknlabs.

the class ValuePredicate method extractPredicate.

private static ai.grakn.graql.ValuePredicate extractPredicate(VarPattern pattern) {
    Iterator<ValueProperty> properties = pattern.admin().getProperties(ValueProperty.class).iterator();
    ValueProperty property = properties.next();
    if (properties.hasNext()) {
        throw GraqlQueryException.valuePredicateAtomWithMultiplePredicates();
    }
    return property.predicate();
}
Also used : ValueProperty(ai.grakn.graql.internal.pattern.property.ValueProperty)

Aggregations

ValueProperty (ai.grakn.graql.internal.pattern.property.ValueProperty)2 Node (ai.grakn.graql.internal.gremlin.spanningtree.graph.Node)1