From cf997e76f855b3adb695621529fc31f14042bcff Mon Sep 17 00:00:00 2001 From: joshua Date: Sun, 21 Mar 2021 14:22:22 +0000 Subject: [PATCH 1/4] ConceptMap has Explainables and Query can return Explanations add missing field numbers tmp publish npm, pip, and maven artifacts Move Explanation to //common/logic.proto update answer proto Make map style consistent Revert "Make map style consistent" This reverts commit a625c71f0e2c944a87c395de73557c54689bab1e. use snake-case split concepts into relation and attributes --- .grabl/automation.yml | 9 --------- common/BUILD | 4 +++- common/answer.proto | 19 ++++++++++++++++++- common/logic.proto | 14 ++++++++++++++ common/query.proto | 13 +++++++++++++ 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/.grabl/automation.yml b/.grabl/automation.yml index 45e33d46..c2e5d846 100644 --- a/.grabl/automation.yml +++ b/.grabl/automation.yml @@ -44,9 +44,6 @@ build: git diff --exit-code dependencies/maven/artifacts.snapshot bazel run @graknlabs_dependencies//tool/unuseddeps:unused-deps -- list deploy-maven-snapshot: - filter: - owner: graknlabs - branch: master image: graknlabs-ubuntu-20.04 dependencies: [build, build-dependency] command: | @@ -54,9 +51,6 @@ build: export DEPLOY_MAVEN_PASSWORD=$REPO_GRAKN_PASSWORD bazel run --define version=$(git rev-parse HEAD) //grpc/java:deploy-maven -- snapshot deploy-npm-snapshot: - filter: - owner: graknlabs - branch: master image: graknlabs-ubuntu-20.04 command: | curl https://cli-assets.heroku.com/apt/release.key | sudo apt-key add - @@ -69,9 +63,6 @@ build: bazel run --define version=$(git rev-parse HEAD) //grpc/nodejs:deploy-npm -- snapshot dependencies: [build, build-dependency] deploy-pip-snapshot: - filter: - owner: graknlabs - branch: master image: graknlabs-ubuntu-20.04 type: foreground command: | diff --git a/common/BUILD b/common/BUILD index 2cc1e572..b1ef042d 100644 --- a/common/BUILD +++ b/common/BUILD @@ -32,7 +32,8 @@ proto_library( proto_library( name = "logic-proto", - srcs = ["logic.proto"] + srcs = ["logic.proto"], + deps = [":answer-proto"] ) proto_library( @@ -45,6 +46,7 @@ proto_library( srcs = ["query.proto"], deps = [ ":answer-proto", + ":logic-proto", ":options-proto", ], ) diff --git a/common/answer.proto b/common/answer.proto index afe46be0..c63a772c 100644 --- a/common/answer.proto +++ b/common/answer.proto @@ -26,7 +26,24 @@ package grakn.protocol; message ConceptMap { map map = 1; - string pattern = 2; + Explainables explainables = 2; +} + +message Explainables { + map explainable_relations = 1; + map explainable_attributes = 2; + repeated ExplainableOwnership explainable_ownerships = 3; +} + +message ExplainableOwnership { + string owner = 1; + string attribute = 2; + Explainable explainable = 3; +} + +message Explainable { + string conjunction = 1; + int64 id = 2; } message ConceptMapGroup { diff --git a/common/logic.proto b/common/logic.proto index a207ca29..246700ec 100644 --- a/common/logic.proto +++ b/common/logic.proto @@ -20,6 +20,9 @@ syntax = "proto3"; option java_package = "grakn.protocol"; option java_outer_classname = "LogicProto"; +import "common/answer.proto"; + + package grakn.protocol; message LogicManager { @@ -106,3 +109,14 @@ message Rule { message Res {} } } + +message Explanation { + Rule rule = 1; + map var_mapping = 2; // TODO perhaps this should be a "context" and contain more information about source + ConceptMap then_answer = 3; + ConceptMap when_answer = 4; + + message VarsList { + repeated string vars = 1; + } +} diff --git a/common/query.proto b/common/query.proto index 7e3d35cf..91664eee 100644 --- a/common/query.proto +++ b/common/query.proto @@ -21,6 +21,7 @@ option java_package = "grakn.protocol"; option java_outer_classname = "QueryProto"; import "common/answer.proto"; +import "common/logic.proto"; import "common/options.proto"; package grakn.protocol; @@ -39,6 +40,7 @@ message QueryManager { Insert.Req insert_req = 106; Delete.Req delete_req = 107; Update.Req update_req = 108; + Explain.Req explain_req = 109; } } @@ -58,6 +60,7 @@ message QueryManager { MatchGroupAggregate.ResPart match_group_aggregate_res_part = 102; Insert.ResPart insert_res_part = 103; Update.ResPart update_res_part = 104; + Explain.ResPart explain_res_part = 105; } } @@ -100,6 +103,16 @@ message QueryManager { } } + message Explain { + message Req { + int64 explainable_id = 1; + } + + message ResPart { + repeated Explanation explanations = 1; + } + } + message Insert { message Req { string query = 1; From 8b5945be70d521822bbafa42085e09e1a48e620c Mon Sep 17 00:00:00 2001 From: joshua Date: Mon, 29 Mar 2021 13:06:23 +0100 Subject: [PATCH 2/4] re-add filters to snapshot deployment final tweaks and publish snapshots undo temporary snapshot publishing --- .grabl/automation.yml | 9 +++++++++ common/answer.proto | 14 ++++++-------- common/logic.proto | 8 ++++---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.grabl/automation.yml b/.grabl/automation.yml index c2e5d846..45e33d46 100644 --- a/.grabl/automation.yml +++ b/.grabl/automation.yml @@ -44,6 +44,9 @@ build: git diff --exit-code dependencies/maven/artifacts.snapshot bazel run @graknlabs_dependencies//tool/unuseddeps:unused-deps -- list deploy-maven-snapshot: + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 dependencies: [build, build-dependency] command: | @@ -51,6 +54,9 @@ build: export DEPLOY_MAVEN_PASSWORD=$REPO_GRAKN_PASSWORD bazel run --define version=$(git rev-parse HEAD) //grpc/java:deploy-maven -- snapshot deploy-npm-snapshot: + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 command: | curl https://cli-assets.heroku.com/apt/release.key | sudo apt-key add - @@ -63,6 +69,9 @@ build: bazel run --define version=$(git rev-parse HEAD) //grpc/nodejs:deploy-npm -- snapshot dependencies: [build, build-dependency] deploy-pip-snapshot: + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 type: foreground command: | diff --git a/common/answer.proto b/common/answer.proto index c63a772c..38e16a60 100644 --- a/common/answer.proto +++ b/common/answer.proto @@ -30,15 +30,13 @@ message ConceptMap { } message Explainables { - map explainable_relations = 1; - map explainable_attributes = 2; - repeated ExplainableOwnership explainable_ownerships = 3; -} + map relations = 1; + map attributes = 2; + map ownerships = 3; -message ExplainableOwnership { - string owner = 1; - string attribute = 2; - Explainable explainable = 3; + message Owned { + map owned = 1; + } } message Explainable { diff --git a/common/logic.proto b/common/logic.proto index 246700ec..b1767f93 100644 --- a/common/logic.proto +++ b/common/logic.proto @@ -112,11 +112,11 @@ message Rule { message Explanation { Rule rule = 1; - map var_mapping = 2; // TODO perhaps this should be a "context" and contain more information about source - ConceptMap then_answer = 3; - ConceptMap when_answer = 4; + map var_mapping = 2; + ConceptMap condition = 3; + ConceptMap conclusion = 4; - message VarsList { + message VarList { repeated string vars = 1; } } From db450964d23303ab73a04c781db0dd0ef53fa869 Mon Sep 17 00:00:00 2001 From: joshua Date: Tue, 30 Mar 2021 14:21:10 +0100 Subject: [PATCH 3/4] publish artifact --- .grabl/automation.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.grabl/automation.yml b/.grabl/automation.yml index 45e33d46..2fc436df 100644 --- a/.grabl/automation.yml +++ b/.grabl/automation.yml @@ -44,9 +44,9 @@ build: git diff --exit-code dependencies/maven/artifacts.snapshot bazel run @graknlabs_dependencies//tool/unuseddeps:unused-deps -- list deploy-maven-snapshot: - filter: - owner: graknlabs - branch: master +# filter: +# owner: graknlabs +# branch: master image: graknlabs-ubuntu-20.04 dependencies: [build, build-dependency] command: | @@ -54,9 +54,9 @@ build: export DEPLOY_MAVEN_PASSWORD=$REPO_GRAKN_PASSWORD bazel run --define version=$(git rev-parse HEAD) //grpc/java:deploy-maven -- snapshot deploy-npm-snapshot: - filter: - owner: graknlabs - branch: master +# filter +# owner: graknlabs +# branch: master image: graknlabs-ubuntu-20.04 command: | curl https://cli-assets.heroku.com/apt/release.key | sudo apt-key add - @@ -69,9 +69,9 @@ build: bazel run --define version=$(git rev-parse HEAD) //grpc/nodejs:deploy-npm -- snapshot dependencies: [build, build-dependency] deploy-pip-snapshot: - filter: - owner: graknlabs - branch: master +# filter: +# owner: graknlabs +# branch: master image: graknlabs-ubuntu-20.04 type: foreground command: | From 9a268f71fe869c61669e8a83789fd159709095fb Mon Sep 17 00:00:00 2001 From: joshua Date: Tue, 30 Mar 2021 16:10:42 +0100 Subject: [PATCH 4/4] don't publish snapshots --- .grabl/automation.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.grabl/automation.yml b/.grabl/automation.yml index 2fc436df..45e33d46 100644 --- a/.grabl/automation.yml +++ b/.grabl/automation.yml @@ -44,9 +44,9 @@ build: git diff --exit-code dependencies/maven/artifacts.snapshot bazel run @graknlabs_dependencies//tool/unuseddeps:unused-deps -- list deploy-maven-snapshot: -# filter: -# owner: graknlabs -# branch: master + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 dependencies: [build, build-dependency] command: | @@ -54,9 +54,9 @@ build: export DEPLOY_MAVEN_PASSWORD=$REPO_GRAKN_PASSWORD bazel run --define version=$(git rev-parse HEAD) //grpc/java:deploy-maven -- snapshot deploy-npm-snapshot: -# filter -# owner: graknlabs -# branch: master + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 command: | curl https://cli-assets.heroku.com/apt/release.key | sudo apt-key add - @@ -69,9 +69,9 @@ build: bazel run --define version=$(git rev-parse HEAD) //grpc/nodejs:deploy-npm -- snapshot dependencies: [build, build-dependency] deploy-pip-snapshot: -# filter: -# owner: graknlabs -# branch: master + filter: + owner: graknlabs + branch: master image: graknlabs-ubuntu-20.04 type: foreground command: |