Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Diagnosis Example Fixes #115

Merged
merged 4 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kglib/kgcn/examples/diagnosis/diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ def get_thing_types(tx):
"match $x sub thing; "
"not {$x sub @has-attribute;}; "
"not {$x sub @key-attribute;}; "
"get;").get('x')
thing_types = [schema_concept.label() for schema_concept in schema_concepts]
"get;")
thing_types = [schema_concept.get('x').label() for schema_concept in schema_concepts]
[thing_types.remove(el) for el in
['thing', 'relation', 'entity', 'attribute', 'candidate-diagnosis', 'example-id', 'probability-exists',
'probability-non-exists', 'probability-preexists']]
Expand All @@ -284,8 +284,8 @@ def get_role_types(tx):
"not{$x sub @key-attribute-owner;}; "
"not{$x sub @has-attribute-value;}; "
"not{$x sub @has-attribute-owner;};"
"get;").get('x')
role_types = ['has'] + [role.label() for role in schema_concepts]
"get;")
role_types = ['has'] + [role.get('x').label() for role in schema_concepts]
[role_types.remove(el) for el in ['role', 'candidate-patient', 'candidate-diagnosed-disease']]
return role_types

Expand Down
3 changes: 2 additions & 1 deletion kglib/kgcn/examples/diagnosis/diagnosis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def test_query_made_as_expected(self):
expected_query = (f'match'
f'$p id V123;'
f'$d id V1235;'
f'$kgcn isa kgcn;'
f'insert'
f'$pd(predicted-patient: $p, predicted-diagnosed-disease: $d) isa predicted-diagnosis,'
f'$pd(patient: $p, diagnosed-disease: $d, diagnoser: $kgcn) isa diagnosis,'
f'has probability-exists 0.993,'
f'has probability-non-exists 0.007,'
f'has probability-preexists 0.000;')
Expand Down
6 changes: 3 additions & 3 deletions kglib/utils/graph/thing/queries_to_graph_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ def test_graph_is_built_from_grakn_as_expected(self):
with session.transaction().read() as tx:
combined_graph = build_graph_from_queries(query_sampler_variable_graph_tuples, tx)

person_exp = build_thing(tx.query('match $x isa person; get;').collect_concepts()[0])
name_exp = build_thing(tx.query('match $x isa name; get;').collect_concepts()[0])
parentship_exp = build_thing(tx.query('match $x isa parentship; get;').collect_concepts()[0])
person_exp = build_thing(next(tx.query('match $x isa person; get;')).get('x'))
name_exp = build_thing(next(tx.query('match $x isa name; get;')).get('x'))
parentship_exp = build_thing(next(tx.query('match $x isa parentship; get;')).get('x'))

expected_combined_graph = nx.MultiDiGraph()
expected_combined_graph.add_node(person_exp, type='person')
Expand Down