use of ai.grakn.concept.SchemaConcept in project grakn by graknlabs.
the class SchemaConceptPropertyTest method whenASchemaConceptHasAnIndirectSub_ItIsAnIndirectSuperOfThatSub.
@Property
public void whenASchemaConceptHasAnIndirectSub_ItIsAnIndirectSuperOfThatSub(@Open GraknTx tx, @FromTx SchemaConcept superConcept, long seed) {
SchemaConcept subConcept = PropertyUtil.choose(superConcept.subs(), seed);
assertThat(tx.admin().sups(subConcept).collect(toSet()), hasItem(superConcept));
}
use of ai.grakn.concept.SchemaConcept in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithDefaultProperties.
@Property
public void whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithDefaultProperties(@Open GraknTx graph, @Unused Label label, @From(PutSchemaConceptFunctions.class) BiFunction<GraknTx, Label, SchemaConcept> putSchemaConcept) {
SchemaConcept concept = putSchemaConcept.apply(graph, label);
assertThat("Concept should only have one sub-type: itself", concept.subs().collect(toSet()), contains(concept));
assertFalse("Concept should not be implicit", concept.isImplicit());
assertThat("Rules of hypotheses should be empty", concept.getRulesOfHypothesis().collect(toSet()), empty());
assertThat("Rules of conclusion should be empty", concept.getRulesOfConclusion().collect(toSet()), empty());
}
use of ai.grakn.concept.SchemaConcept in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithTheGivenLabel.
@Property
public void whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithTheGivenLabel(@Open GraknTx graph, @Unused Label label, @From(PutSchemaConceptFunctions.class) BiFunction<GraknTx, Label, SchemaConcept> putSchemaConcept) {
SchemaConcept type = putSchemaConcept.apply(graph, label);
assertEquals(label, type.getLabel());
}
use of ai.grakn.concept.SchemaConcept in project grakn by graknlabs.
the class SchemaConceptPropertyTest method whenDeletingASchemaConceptWithDirectSubs_Throw.
@Property
public void whenDeletingASchemaConceptWithDirectSubs_Throw(@NonMeta SchemaConcept schemaConcept) {
SchemaConcept superConcept = schemaConcept.sup();
assumeFalse(isMetaLabel(superConcept.getLabel()));
exception.expect(GraknTxOperationException.class);
exception.expectMessage(GraknTxOperationException.cannotBeDeleted(superConcept).getMessage());
superConcept.delete();
}
use of ai.grakn.concept.SchemaConcept in project grakn by graknlabs.
the class SchemaConceptPropertyTest method whenASchemaConceptHasAnIndirectSuper_ItIsAnIndirectSubOfThatSuper.
@Property
public void whenASchemaConceptHasAnIndirectSuper_ItIsAnIndirectSubOfThatSuper(@Open GraknTx tx, @FromTx SchemaConcept subConcept, long seed) {
SchemaConcept superConcept = PropertyUtil.choose(tx.admin().sups(subConcept), seed);
assertThat(superConcept.subs().collect(toSet()), hasItem(subConcept));
}
Aggregations