Search in sources :

Example 31 with Match

use of ai.grakn.graql.Match in project grakn by graknlabs.

the class MatchTest method testIntPredicateQuery.

@Test
public void testIntPredicateQuery() {
    Match query = qb.match(x.has("tmdb-vote-count", lte(400)));
    assertThat(query, variable(x, containsInAnyOrder(apocalypseNow, theMuppets, chineseCoffee)));
}
Also used : Match(ai.grakn.graql.Match) Test(org.junit.Test)

Example 32 with Match

use of ai.grakn.graql.Match in project grakn by graknlabs.

the class MatchTest method testHasReleaseDate.

@Test
public void testHasReleaseDate() {
    Match query = qb.match(x.has("release-date", y));
    assertThat(query, variable(x, containsInAnyOrder(godfather, theMuppets, spy, chineseCoffee)));
}
Also used : Match(ai.grakn.graql.Match) Test(org.junit.Test)

Example 33 with Match

use of ai.grakn.graql.Match in project grakn by graknlabs.

the class MatchTest method testDoublePredicateQuery.

@Test
public void testDoublePredicateQuery() {
    Match query = qb.match(x.has("tmdb-vote-average", gt(7.8)));
    assertThat(query, variable(x, containsInAnyOrder(apocalypseNow, godfather)));
}
Also used : Match(ai.grakn.graql.Match) Test(org.junit.Test)

Example 34 with Match

use of ai.grakn.graql.Match in project grakn by graknlabs.

the class MatchTest method testTypeAsVariable.

@Test
public void testTypeAsVariable() {
    Match query = qb.match(label("genre").plays(x));
    assertThat(query, variable(x, containsInAnyOrder(genreOfProduction, keyNameOwner)));
}
Also used : Match(ai.grakn.graql.Match) Test(org.junit.Test)

Example 35 with Match

use of ai.grakn.graql.Match in project grakn by graknlabs.

the class MatchTest method testMatchHas.

@Test
public void testMatchHas() {
    Match query = qb.match(x.has("name"));
    assertThat(query, variable(x, containsInAnyOrder(person, language, genre, cluster, character)));
}
Also used : Match(ai.grakn.graql.Match) Test(org.junit.Test)

Aggregations

Match (ai.grakn.graql.Match)103 Test (org.junit.Test)98 Var (ai.grakn.graql.Var)8 ConceptId (ai.grakn.concept.ConceptId)5 Concept (ai.grakn.concept.Concept)4 SchemaConcept (ai.grakn.concept.SchemaConcept)4 PatternAdmin (ai.grakn.graql.admin.PatternAdmin)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 AttributeType (ai.grakn.concept.AttributeType)3 Label (ai.grakn.concept.Label)3 Relationship (ai.grakn.concept.Relationship)3 Printer (ai.grakn.graql.Printer)3 QueryBuilder (ai.grakn.graql.QueryBuilder)3 Answer (ai.grakn.graql.admin.Answer)3 MatchableConcept (ai.grakn.matcher.MatchableConcept)3 Matcher (org.hamcrest.Matcher)3 RelationshipType (ai.grakn.concept.RelationshipType)2 Role (ai.grakn.concept.Role)2 Thing (ai.grakn.concept.Thing)2 GraqlQueryException (ai.grakn.exception.GraqlQueryException)2