Search in sources :

Example 1 with VarPropertyInternal

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

the class ConjunctionQuery method equivalentFragmentSetsOfVar.

private static Stream<EquivalentFragmentSet> equivalentFragmentSetsOfVar(VarPatternAdmin var) {
    Collection<EquivalentFragmentSet> traversals = new HashSet<>();
    Var start = var.var();
    var.getProperties().forEach(property -> {
        VarPropertyInternal propertyInternal = (VarPropertyInternal) property;
        Collection<EquivalentFragmentSet> newTraversals = propertyInternal.match(start);
        traversals.addAll(newTraversals);
    });
    if (!traversals.isEmpty()) {
        return traversals.stream();
    } else {
        // If this variable has no properties, only confirm that it is not internal and nothing else.
        return Stream.of(EquivalentFragmentSets.notInternalFragmentSet(null, start));
    }
}
Also used : VarPropertyInternal(ai.grakn.graql.internal.pattern.property.VarPropertyInternal) Var(ai.grakn.graql.Var) HashSet(java.util.HashSet)

Aggregations

Var (ai.grakn.graql.Var)1 VarPropertyInternal (ai.grakn.graql.internal.pattern.property.VarPropertyInternal)1 HashSet (java.util.HashSet)1