Search in sources :

Example 6 with Entity

use of com.vaticle.typedb.core.concept.thing.Entity in project grakn by graknlabs.

the class EntitySteps method entity_type_create_new_instance_with_key.

@When("{var} = entity\\( ?{type_label} ?) create new instance with key\\( ?{type_label} ?): {int}")
public void entity_type_create_new_instance_with_key(String var, String type, String keyType, int keyValue) {
    Attribute.Long key = tx().concepts().getAttributeType(keyType).asLong().put(keyValue);
    Entity entity = tx().concepts().getEntityType(type).create();
    entity.setHas(key);
    put(var, entity);
}
Also used : Entity(com.vaticle.typedb.core.concept.thing.Entity) Attribute(com.vaticle.typedb.core.concept.thing.Attribute) When(io.cucumber.java.en.When)

Example 7 with Entity

use of com.vaticle.typedb.core.concept.thing.Entity in project grakn by graknlabs.

the class EntitySteps method entity_type_create_new_instance_with_key.

@When("{var} = entity\\( ?{type_label} ?) create new instance with key\\( ?{type_label} ?): {datetime}")
public void entity_type_create_new_instance_with_key(String var, String type, String keyType, LocalDateTime keyValue) {
    Attribute.DateTime key = tx().concepts().getAttributeType(keyType).asDateTime().put(keyValue);
    Entity entity = tx().concepts().getEntityType(type).create();
    entity.setHas(key);
    put(var, entity);
}
Also used : Entity(com.vaticle.typedb.core.concept.thing.Entity) Attribute(com.vaticle.typedb.core.concept.thing.Attribute) When(io.cucumber.java.en.When)

Aggregations

Entity (com.vaticle.typedb.core.concept.thing.Entity)7 Attribute (com.vaticle.typedb.core.concept.thing.Attribute)5 Test (org.junit.Test)4 When (io.cucumber.java.en.When)3 ConceptManager (com.vaticle.typedb.core.concept.ConceptManager)2 ConceptMap (com.vaticle.typedb.core.concept.answer.ConceptMap)2 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)2 EntityType (com.vaticle.typedb.core.concept.type.EntityType)2 CoreDatabaseManager (com.vaticle.typedb.core.database.CoreDatabaseManager)2 CoreSession (com.vaticle.typedb.core.database.CoreSession)2 CoreTransaction (com.vaticle.typedb.core.database.CoreTransaction)2 Identifier (com.vaticle.typedb.core.traversal.common.Identifier)2 Map (java.util.Map)2 TypeDB (com.vaticle.typedb.core.TypeDB)1 TypeInference (com.vaticle.typedb.core.logic.tool.TypeInference)1 Disjunction (com.vaticle.typedb.core.pattern.Disjunction)1 TypeQLDefine (com.vaticle.typeql.lang.query.TypeQLDefine)1 TypeQLInsert (com.vaticle.typeql.lang.query.TypeQLInsert)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1