use of com.vaticle.typedb.core.pattern.variable.ThingVariable in project grakn by graknlabs.
the class AlphaEquivalenceTest method test_isa_equivalent.
@Test
public void test_isa_equivalent() {
ThingVariable a = parseVariable("a", "$a isa age").asThing();
ThingVariable b = parseVariable("b", "$b isa age").asThing();
AlphaEquivalence alphaEq = a.alphaEquals(b);
assertEquals(map(new Pair<>("$a", "$b"), new Pair<>("$_age", "$_age")), alphaMapToStringMap(alphaEq.asValid()));
testAlphaEquivalenceSymmetricReflexive(a, b, true);
}
use of com.vaticle.typedb.core.pattern.variable.ThingVariable in project grakn by graknlabs.
the class RelationConstraint method addTo.
@Override
public void addTo(GraphTraversal.Thing traversal) {
for (RolePlayer rolePlayer : rolePlayers) {
assert !rolePlayer.inferredRoleTypes.isEmpty();
ThingVariable player = rolePlayer.player();
int rep = rolePlayer.repetition();
if (rolePlayer.roleType().isPresent() && rolePlayer.roleType().get().id().isName()) {
Identifier.Scoped role = Identifier.Scoped.of(owner.id(), rolePlayer.roleType().get().id(), player.id(), rep);
traversal.relating(owner.id(), role);
traversal.playing(player.id(), role);
traversal.isa(role, rolePlayer.roleType().get().id());
traversal.types(role, rolePlayer.inferredRoleTypes());
} else {
traversal.rolePlayer(owner.id(), player.id(), rolePlayer.inferredRoleTypes(), rep);
}
}
}
Aggregations