Search in sources :

Example 16 with AttributeType

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

the class ThingTypeSteps method thing_type_set_owns_attribute_type.

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

Example 17 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.

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

Example 18 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.

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

Example 19 with AttributeType

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

the class AttributeTypeSteps method attribute_type_as_value_type_does_not_have_any_regex.

@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) does not have any regex")
public void attribute_type_as_value_type_does_not_have_any_regex(String typeLabel, AttributeType.ValueType valueType) {
    if (!valueType.equals(AttributeType.ValueType.STRING))
        fail();
    AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
    assertNull(attributeType.asString().getRegex());
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) Then(io.cucumber.java.en.Then)

Example 20 with AttributeType

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

the class AttributeTypeSteps method attribute_type_get_supertype_value_type.

@Then("attribute\\( ?{type_label} ?) get supertype value type: {value_type}")
public void attribute_type_get_supertype_value_type(String typeLabel, AttributeType.ValueType valueType) {
    AttributeType supertype = tx().concepts().getAttributeType(typeLabel).getSupertype().asAttributeType();
    assertEquals(valueType, supertype.getValueType());
}
Also used : AttributeType(com.vaticle.typedb.core.concept.type.AttributeType) Then(io.cucumber.java.en.Then)

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