コード例 #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)
コード例 #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))
コード例 #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)))
コード例 #4
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.tx().query().delete(query=context.text)
コード例 #5
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context, exception: str):
    assert_that(calling(next).with_args(context.tx().query().insert(query=context.text)), raises(GraknClientException, exception))
コード例 #6
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
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)]
コード例 #7
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.tx().query().undefine(query=context.text)
コード例 #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))
コード例 #9
0
def step_impl(context: Context):
    context.tx().commit()
コード例 #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))))
コード例 #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))))
コード例 #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))
コード例 #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))
コード例 #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)
コード例 #15
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.clear_answers()
    context.numeric_answer = next(context.tx().query().match_aggregate(query=context.text))
コード例 #16
0
def step_impl(context: Context):
    try:
        context.tx().commit()
        assert False
    except GraknClientException:
        pass
コード例 #17
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.clear_answers()
    context.answer_groups = [group for group in context.tx().query().match_group(query=context.text)]
コード例 #18
0
def step_impl(context: Context, exception: str):
    assert_that(calling(context.tx().commit), raises(GraknClientException, exception))
コード例 #19
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
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))
コード例 #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()))
コード例 #21
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.tx().query().insert(query=context.text)
コード例 #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())))
コード例 #23
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    assert_that(calling(next).with_args(context.tx().query().delete(query=context.text)), raises(GraknClientException))
コード例 #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))
コード例 #25
0
ファイル: graql_steps.py プロジェクト: VladGan/client-python
def step_impl(context: Context):
    context.clear_answers()
    context.answers = [answer for answer in context.tx().query().insert(query=context.text)]
コード例 #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))
コード例 #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())
コード例 #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))
コード例 #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))
コード例 #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))