Search in sources :

Example 36 with AttributeType

use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.

the class AttributeTypeSteps method attribute_type_get_owners_as_attribute_contains.

@Then("attribute\\( ?{type_label} ?) get attribute owners contain:")
public void attribute_type_get_owners_as_attribute_contains(String typeLabel, List<String> ownerLabels) {
    AttributeType attributeType = tx().concepts().getAttributeType(typeLabel);
    Set<String> actuals = attributeType.getOwners(false).map(ThingType::getLabel).map(Label::toString).toSet();
    assertTrue(actuals.containsAll(ownerLabels));
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) ThingType(com.vaticle.typedb.core.concept.type.ThingType) Then(io.cucumber.java.en.Then)

Example 37 with AttributeType

use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.

the class ThingTypeSteps method thing_type_set_owns_key_type_throws_exception.

@Then("{root_label}\\( ?{type_label} ?) set owns key type: {type_label}; throws exception")
public void thing_type_set_owns_key_type_throws_exception(RootLabel rootLabel, String typeLabel, String attributeLabel) {
    AttributeType attributeType = tx().concepts().getAttributeType(attributeLabel);
    assertThrows(() -> get_thing_type(rootLabel, typeLabel).setOwns(attributeType, true));
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) Then(io.cucumber.java.en.Then)

Example 38 with AttributeType

use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.

the class ThingTypeSteps method thing_type_set_owns_key_type_as_throws_exception.

@Then("{root_label}\\( ?{type_label} ?) set owns key type: {type_label} as {type_label}; throws exception")
public void thing_type_set_owns_key_type_as_throws_exception(RootLabel rootLabel, String typeLabel, String attributeLabel, String overriddenLabel) {
    AttributeType attributeType = tx().concepts().getAttributeType(attributeLabel);
    AttributeType overriddenType = tx().concepts().getAttributeType(overriddenLabel);
    assertThrows(() -> get_thing_type(rootLabel, typeLabel).setOwns(attributeType, overriddenType, true));
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) Then(io.cucumber.java.en.Then)

Example 39 with AttributeType

use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.

the class ThingTypeSteps method thing_type_unset_owns_key_type.

@When("{root_label}\\( ?{type_label} ?) unset owns key type: {type_label}")
public void thing_type_unset_owns_key_type(RootLabel rootLabel, String typeLabel, String attributeLabel) {
    AttributeType attributeType = tx().concepts().getAttributeType(attributeLabel);
    get_thing_type(rootLabel, typeLabel).unsetOwns(attributeType);
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) When(io.cucumber.java.en.When)

Example 40 with AttributeType

use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.

the class ThingTypeSteps method thing_type_unset_owns_attribute_type.

@When("{root_label}\\( ?{type_label} ?) unset owns attribute type: {type_label}")
public void thing_type_unset_owns_attribute_type(RootLabel rootLabel, String typeLabel, String attributeLabel) {
    AttributeType attributeType = tx().concepts().getAttributeType(attributeLabel);
    get_thing_type(rootLabel, typeLabel).unsetOwns(attributeType);
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) When(io.cucumber.java.en.When)

Aggregations

AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)53 EntityType (com.vaticle.typedb.core.concept.type.EntityType)27 Test (org.junit.Test)24 ConceptManager (com.vaticle.typedb.core.concept.ConceptManager)21 CoreSession (com.vaticle.typedb.core.database.CoreSession)20 CoreTransaction (com.vaticle.typedb.core.database.CoreTransaction)20 RelationType (com.vaticle.typedb.core.concept.type.RelationType)16 Then (io.cucumber.java.en.Then)16 ConceptMap (com.vaticle.typedb.core.concept.answer.ConceptMap)13 CoreDatabaseManager (com.vaticle.typedb.core.database.CoreDatabaseManager)11 ThingType (com.vaticle.typedb.core.concept.type.ThingType)10 LogicManager (com.vaticle.typedb.core.logic.LogicManager)9 When (io.cucumber.java.en.When)7 TypeDB (com.vaticle.typedb.core.TypeDB)4 Options (com.vaticle.typedb.core.common.parameters.Options)4 Attribute (com.vaticle.typedb.core.concept.thing.Attribute)4 RoleType (com.vaticle.typedb.core.concept.type.RoleType)4 Conjunction (com.vaticle.typedb.core.pattern.Conjunction)3 Variable (com.vaticle.typedb.core.pattern.variable.Variable)3 ThingVariable (com.vaticle.typeql.lang.pattern.variable.ThingVariable)3