Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Explanations in RPC #131

Merged
merged 4 commits into from
Mar 30, 2021
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
4 changes: 3 additions & 1 deletion common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ proto_library(

proto_library(
name = "logic-proto",
srcs = ["logic.proto"]
srcs = ["logic.proto"],
deps = [":answer-proto"]
)

proto_library(
Expand All @@ -45,6 +46,7 @@ proto_library(
srcs = ["query.proto"],
deps = [
":answer-proto",
":logic-proto",
":options-proto",
],
)
Expand Down
17 changes: 16 additions & 1 deletion common/answer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ package grakn.protocol;

message ConceptMap {
map<string, Concept> map = 1;
string pattern = 2;
Explainables explainables = 2;
}

message Explainables {
map<string, Explainable> relations = 1;
map<string, Explainable> attributes = 2;
map<string, Owned> ownerships = 3;

message Owned {
map<string, Explainable> owned = 1;
}
}

message Explainable {
string conjunction = 1;
int64 id = 2;
}

message ConceptMapGroup {
Expand Down
14 changes: 14 additions & 0 deletions common/logic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -106,3 +109,14 @@ message Rule {
message Res {}
}
}

message Explanation {
Rule rule = 1;
map<string, VarList> var_mapping = 2;
ConceptMap condition = 3;
ConceptMap conclusion = 4;

message VarList {
repeated string vars = 1;
}
}
13 changes: 13 additions & 0 deletions common/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}

Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand Down