use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_get_owners_as_key_do_not_contains.
@Then("attribute\\( ?{type_label} ?) get key owners do not contain:")
public void attribute_type_get_owners_as_key_do_not_contains(String typeLabel, List<String> ownerLabels) {
AttributeType attributeType = tx().concepts().getAttributeType(typeLabel);
Set<String> actuals = attributeType.getOwners(true).map(ThingType::getLabel).map(Label::toString).toSet();
for (String ownerLabel : ownerLabels) {
assertFalse(actuals.contains(ownerLabel));
}
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_get_owners_as_key_contains.
@Then("attribute\\( ?{type_label} ?) get key owners contain:")
public void attribute_type_get_owners_as_key_contains(String typeLabel, List<String> ownerLabels) {
AttributeType attributeType = tx().concepts().getAttributeType(typeLabel);
Set<String> actuals = attributeType.getOwners(true).map(ThingType::getLabel).map(Label::toString).toSet();
assertTrue(actuals.containsAll(ownerLabels));
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_as_value_type_set_regex.
@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) set regex: {}")
public void attribute_type_as_value_type_set_regex(String typeLabel, AttributeType.ValueType valueType, String regex) {
if (!valueType.equals(AttributeType.ValueType.STRING))
fail();
AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
attributeType.asString().setRegex(Pattern.compile(regex));
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_as_value_type_unset_regex.
@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) unset regex")
public void attribute_type_as_value_type_unset_regex(String typeLabel, AttributeType.ValueType valueType) {
if (!valueType.equals(AttributeType.ValueType.STRING))
fail();
AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
attributeType.asString().unsetRegex();
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class ThingTypeSteps method thing_type_set_owns_attribute_throws_exception.
@Then("{root_label}\\( ?{type_label} ?) set owns attribute type: {type_label}; throws exception")
public void thing_type_set_owns_attribute_throws_exception(RootLabel rootLabel, String typeLabel, String attributeLabel) {
AttributeType attributeType = tx().concepts().getAttributeType(attributeLabel);
assertThrows(() -> get_thing_type(rootLabel, typeLabel).setOwns(attributeType));
}
Aggregations