use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class TypeService method setOwns.
private void setOwns(ThingType thingType, ConceptProto.ThingType.SetOwns.Req setOwnsRequest, UUID reqID) {
AttributeType attributeType = getThingType(setOwnsRequest.getAttributeType()).asAttributeType();
boolean isKey = setOwnsRequest.getIsKey();
if (setOwnsRequest.hasOverriddenType()) {
AttributeType overriddenType = getThingType(setOwnsRequest.getOverriddenType()).asAttributeType();
thingType.setOwns(attributeType, overriddenType, isKey);
} else {
thingType.setOwns(attributeType, isKey);
}
transactionSvc.respond(setOwnsRes(reqID));
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_as_value_type_get_subtypes_contain.
@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) get subtypes contain:")
public void attribute_type_as_value_type_get_subtypes_contain(String typeLabel, AttributeType.ValueType valueType, List<String> subLabels) {
AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
Set<String> actuals = attributeType.getSubtypes().map(ThingType::getLabel).map(Label::toString).toSet();
assertTrue(actuals.containsAll(subLabels));
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_as_value_type_get_regex.
@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) get regex: {}")
public void attribute_type_as_value_type_get_regex(String typeLabel, AttributeType.ValueType valueType, String regex) {
if (!valueType.equals(AttributeType.ValueType.STRING))
fail();
AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
assertEquals(regex, attributeType.asString().getRegex().pattern());
}
use of com.vaticle.typedb.core.concept.type.AttributeType in project grakn by graknlabs.
the class AttributeTypeSteps method attribute_type_get_owners_as_attribute_do_not_contains.
@Then("attribute\\( ?{type_label} ?) get attribute owners do not contain:")
public void attribute_type_get_owners_as_attribute_do_not_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();
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_as_value_type_get_subtypes_do_not_contain.
@Then("attribute\\( ?{type_label} ?) as\\( ?{value_type} ?) get subtypes do not contain:")
public void attribute_type_as_value_type_get_subtypes_do_not_contain(String typeLabel, AttributeType.ValueType valueType, List<String> subLabels) {
AttributeType attributeType = attribute_type_as_value_type(typeLabel, valueType);
Set<String> actuals = attributeType.getSubtypes().map(ThingType::getLabel).map(Label::toString).toSet();
for (String subLabel : subLabels) {
assertFalse(actuals.contains(subLabel));
}
}
Aggregations