use of ai.grakn.graql.Printer in project grakn by graknlabs.
the class GraqlPrinterTest method whenGettingOutputForRelation_TheResultShouldHaveCommasBetweenRolePlayers.
@Test
public void whenGettingOutputForRelation_TheResultShouldHaveCommasBetweenRolePlayers() {
Printer printer = Printers.graql(true);
Match match = rule.tx().graql().match(var("r").isa("has-cluster"));
Relationship relationship = match.get("r").iterator().next().asRelationship();
long numRolePlayers = relationship.rolePlayers().count();
long numCommas = numRolePlayers - 1;
String relationString = printer.graqlString(relationship);
assertEquals(relationString + " should have " + numCommas + " commas separating role-players", numCommas, StringUtils.countMatches(relationString, ","));
}
use of ai.grakn.graql.Printer in project grakn by graknlabs.
the class GraqlPrinterTest method whenPrintingNull_ResultIsNullString.
@Test
public void whenPrintingNull_ResultIsNullString() {
Printer printer = Printers.graql(false);
assertEquals("null", printer.graqlString(null));
}
use of ai.grakn.graql.Printer in project grakn by graknlabs.
the class GraqlPrinterTest method testConcept.
@Test
public void testConcept() {
Printer printer = Printers.graql(true);
SchemaConcept concept = rule.tx().admin().getMetaConcept();
String conceptString = printer.graqlString(concept);
assertThat(conceptString, containsString("label"));
assertThat(conceptString, containsString(Schema.MetaSchema.THING.getLabel().getValue()));
assertThat(conceptString, not(containsString("sub")));
assertThat(conceptString, not(containsString("isa")));
}
use of ai.grakn.graql.Printer in project grakn by graknlabs.
the class GraqlPrinterTest method whenPrintingWitholorizeFalse_ResultIsNotColored.
@Test
public void whenPrintingWitholorizeFalse_ResultIsNotColored() {
Printer printer = Printers.graql(false);
Type production = rule.tx().getEntityType("production");
String productionString = printer.graqlString(production);
assertThat(productionString, not(containsString("\u001B")));
}
Aggregations