Search in sources :

Example 26 with ReasonerQueryImpl

use of ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl in project grakn by graknlabs.

the class QueryTest method testQueryReiterationCondition_AcyclicalRuleGraph.

@Test
public void testQueryReiterationCondition_AcyclicalRuleGraph() {
    EmbeddedGraknTx<?> graph = snbGraph.tx();
    String patternString = "{($x, $y) isa recommendation;}";
    ReasonerQueryImpl query = ReasonerQueries.create(conjunction(patternString, graph), graph);
    assertFalse(query.requiresReiteration());
}
Also used : ReasonerQueryImpl(ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl) Test(org.junit.Test)

Example 27 with ReasonerQueryImpl

use of ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl in project grakn by graknlabs.

the class ReasonerTest method testParsingQueryWithResourceVariable_BoundWithNonSpecificVP.

@Test
public void testParsingQueryWithResourceVariable_BoundWithNonSpecificVP() {
    String patternString = "{$x isa person;$x has age <10;}";
    String patternString2 = "{$x isa person;$x has age $y;$y val <10;}";
    ReasonerQueryImpl query = ReasonerQueries.atomic(conjunction(patternString, snbKB.tx()), snbKB.tx());
    ReasonerQueryImpl query2 = ReasonerQueries.atomic(conjunction(patternString2, snbKB.tx()), snbKB.tx());
    assertEquals(query, query2);
}
Also used : ReasonerQueryImpl(ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl) Test(org.junit.Test)

Example 28 with ReasonerQueryImpl

use of ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl in project grakn by graknlabs.

the class ReasonerTest method testParsingQueryWithResourceVariable_BoundWithSpecificVP.

@Test
public void testParsingQueryWithResourceVariable_BoundWithSpecificVP() {
    EmbeddedGraknTx<?> graph = snbKB.tx();
    String patternString = "{$x has firstname 'Bob', has lastname 'Geldof';}";
    String patternString2 = "{$x has firstname 'Bob';$x has lastname 'Geldof';}";
    String patternString3 = "{$x has firstname $x1;$x has lastname $x2;$x1 val 'Bob';$x2 val 'Geldof';}";
    String patternString4 = "{$x has firstname $x2;$x has lastname $x1;$x2 val 'Bob';$x1 val 'Geldof';}";
    ReasonerQueryImpl query = ReasonerQueries.create(conjunction(patternString, graph), graph);
    ReasonerQueryImpl query2 = ReasonerQueries.create(conjunction(patternString2, graph), graph);
    ReasonerQueryImpl query3 = ReasonerQueries.create(conjunction(patternString3, graph), graph);
    ReasonerQueryImpl query4 = ReasonerQueries.create(conjunction(patternString4, graph), graph);
    assertEquals(query, query3);
    assertEquals(query, query4);
    assertEquals(query2, query3);
    assertEquals(query2, query4);
}
Also used : ReasonerQueryImpl(ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl) Test(org.junit.Test)

Aggregations

ReasonerQueryImpl (ai.grakn.graql.internal.reasoner.query.ReasonerQueryImpl)28 Test (org.junit.Test)20 Atom (ai.grakn.graql.internal.reasoner.atom.Atom)11 ResolutionPlan (ai.grakn.graql.internal.reasoner.plan.ResolutionPlan)7 Var (ai.grakn.graql.Var)5 HashSet (java.util.HashSet)5 ConceptId (ai.grakn.concept.ConceptId)4 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)4 ArrayList (java.util.ArrayList)4 Set (java.util.Set)4 Stream (java.util.stream.Stream)4 GraknTx (ai.grakn.GraknTx)3 Rule (ai.grakn.concept.Rule)3 SchemaConcept (ai.grakn.concept.SchemaConcept)3 Answer (ai.grakn.graql.admin.Answer)3 Atomic (ai.grakn.graql.admin.Atomic)3 Unifier (ai.grakn.graql.admin.Unifier)3 UnifierType (ai.grakn.graql.internal.reasoner.UnifierType)3 ValuePredicate (ai.grakn.graql.internal.reasoner.atom.predicate.ValuePredicate)3 Sets (com.google.common.collect.Sets)3