Exemplo n.º 1
0
def step_impl(context: Context, root_label: RootLabel, type_label: str,
              att_type_label: str):
    attribute_type = context.tx().concepts().get_attribute_type(att_type_label)
    context.get_thing_type(root_label, type_label).as_remote(
        context.tx()).set_owns(attribute_type)
Exemplo n.º 2
0
def step_impl(context: Context, type_label: str):
    assert_that(
        calling(context.tx().concepts().get_entity_type(type_label).as_remote(
            context.tx()).create), raises(TypeDBClientException))
Exemplo n.º 3
0
def step_impl(context: Context, type_label: str, var: str):
    assert_that(
        context.tx().concepts().get_entity_type(type_label).as_remote(
            context.tx()).get_instances(), has_item(context.get(var)))
Exemplo n.º 4
0
def step_impl(context: Context):
    context.tx().query().delete(query=context.text)
Exemplo n.º 5
0
def step_impl(context: Context, exception: str):
    assert_that(calling(next).with_args(context.tx().query().insert(query=context.text)), raises(GraknClientException, exception))
Exemplo n.º 6
0
def step_impl(context: Context):
    context.clear_answers()
    context.numeric_answer_groups = [group for group in context.tx().query().match_group_aggregate(query=context.text)]
Exemplo n.º 7
0
def step_impl(context: Context):
    context.tx().query().undefine(query=context.text)
Exemplo n.º 8
0
def step_impl(context: Context, var1: str, role_label: str, var2: str):
    relation = context.get(var1).as_relation()
    relation.as_remote(context.tx()).add_player(
        relation.get_type().as_remote(context.tx()).get_relates(role_label),
        context.get(var2))
Exemplo n.º 9
0
def step_impl(context: Context):
    context.tx().commit()
Exemplo n.º 10
0
def step_impl(context: Context, var1: str, var2: str):
    assert_that(
        context.get(var1).as_relation().as_remote(context.tx()).get_players(),
        not_(has_item(context.get(var2))))
Exemplo n.º 11
0
def step_impl(context: Context, var1: str, role_label: str, var2: str):
    relation = context.get(var1).as_relation()
    assert_that(
        relation.as_remote(context.tx()).get_players(role_types=[
            relation.get_type().as_remote(context.tx()).get_relates(role_label)
        ]), not_(has_item(context.get(var2))))
Exemplo n.º 12
0
def step_impl(context: Context, root_label: RootLabel, type_label: str,
              is_abstract):
    is_abstract = parse_bool(is_abstract)
    assert_that(
        context.get_thing_type(root_label, type_label).as_remote(
            context.tx()).is_abstract(), is_(is_abstract))
Exemplo n.º 13
0
def step_impl(context: Context, root_label: RootLabel, type_label: str,
              get_label: str):
    assert_that(
        context.get_thing_type(root_label, type_label).as_remote(
            context.tx()).get_label().name(), is_(get_label))
Exemplo n.º 14
0
def step_impl(context: Context, root_label: RootLabel, type_label: str,
              new_label: str):
    context.get_thing_type(root_label, type_label).as_remote(
        context.tx()).set_label(new_label)
Exemplo n.º 15
0
def step_impl(context: Context):
    context.clear_answers()
    context.numeric_answer = next(context.tx().query().match_aggregate(query=context.text))
Exemplo n.º 16
0
def step_impl(context: Context):
    try:
        context.tx().commit()
        assert False
    except GraknClientException:
        pass
Exemplo n.º 17
0
def step_impl(context: Context):
    context.clear_answers()
    context.answer_groups = [group for group in context.tx().query().match_group(query=context.text)]
Exemplo n.º 18
0
def step_impl(context: Context, exception: str):
    assert_that(calling(context.tx().commit), raises(GraknClientException, exception))
Exemplo n.º 19
0
def step_impl(context: Context):
    for answer in context.answers:
        query = apply_query_template(template=context.text, answer=answer)
        assert_that(list(context.tx().query().match(query)), has_length(1))
Exemplo n.º 20
0
def step_impl(context: Context, type_label: str, var: str):
    assert_that(
        context.get(var),
        is_in(context.tx().concepts().get_attribute_type(type_label).as_remote(
            context.tx()).get_instances()))
Exemplo n.º 21
0
def step_impl(context: Context):
    context.tx().query().insert(query=context.text)
Exemplo n.º 22
0
def step_impl(context: Context, var1: str, var2: str):
    assert_that(
        context.get(var2),
        not_(is_in(context.get(var1).as_remote(context.tx()).get_owners())))
Exemplo n.º 23
0
def step_impl(context: Context):
    assert_that(calling(next).with_args(context.tx().query().delete(query=context.text)), raises(GraknClientException))
Exemplo n.º 24
0
def step_impl(context: Context, var: str, value_type: ValueType):
    assert_that(
        context.get(var).as_remote(context.tx()).get_type().get_value_type(),
        is_(value_type))
Exemplo n.º 25
0
def step_impl(context: Context):
    context.clear_answers()
    context.answers = [answer for answer in context.tx().query().insert(query=context.text)]
Exemplo n.º 26
0
def step_impl(context: Context, type_label: str, value: int):
    assert_that(
        calling(
            context.tx().concepts().get_attribute_type(type_label).as_remote(
                context.tx()).put).with_args(value),
        raises(GraknClientException))
Exemplo n.º 27
0
def step_impl(context: Context, var: str, type_label: str):
    context.put(
        var,
        context.tx().concepts().get_entity_type(type_label).as_remote(
            context.tx()).create())
Exemplo n.º 28
0
def step_impl(context: Context, var: str, type_label: str, value: int):
    context.put(
        var,
        context.tx().concepts().get_attribute_type(type_label).as_remote(
            context.tx()).put(value))
Exemplo n.º 29
0
def step_impl(context: Context, type_label: str):
    assert_that(
        calling(next).with_args(
            context.tx().concepts().get_entity_type(type_label).as_remote(
                context.tx()).get_instances()), raises(StopIteration))
Exemplo n.º 30
0
def step_impl(context: Context, root_label: RootLabel, type_label: str,
              super_label: str):
    supertype = context.get_thing_type(root_label, super_label)
    assert_that(
        context.get_thing_type(root_label, type_label).as_remote(
            context.tx()).get_supertype(), is_(supertype))