Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
362 lines (300 sloc) 6.67 KB
syntax = "proto3";
package gripql;
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
message Graph {
string graph = 1;
repeated Vertex vertices = 2;
repeated Edge edges = 3;
}
message GraphQuery {
string graph = 1;
repeated GraphStatement query = 2;
}
message QuerySet {
repeated GraphStatement query = 1;
}
message MatchQuerySet {
repeated QuerySet queries = 1;
}
message GraphStatement {
oneof statement {
// Tinkerpop methods
google.protobuf.ListValue v = 1;
google.protobuf.ListValue e = 2;
google.protobuf.ListValue in = 10;
google.protobuf.ListValue out = 11;
google.protobuf.ListValue both = 14;
google.protobuf.ListValue in_e = 12;
google.protobuf.ListValue out_e = 13;
google.protobuf.ListValue both_e = 15;
google.protobuf.ListValue in_v = 16;
google.protobuf.ListValue out_v = 17;
google.protobuf.ListValue both_v = 18;
string as = 20;
SelectStatement select = 21;
uint32 limit = 24;
uint32 skip = 25;
Range range = 33;
MatchQuerySet match = 28;
HasExpression has = 29;
google.protobuf.ListValue has_label = 34;
google.protobuf.ListValue has_key = 35;
google.protobuf.ListValue has_id = 36;
string count = 30;
// custom methods
google.protobuf.ListValue fields = 26;
google.protobuf.ListValue distinct = 27;
Aggregations aggregate = 31;
google.protobuf.Value render = 32;
}
}
message Range {
int32 start = 1;
int32 stop = 2;
}
message AggregationsRequest {
string graph = 1;
repeated Aggregate aggregations = 2;
}
message Aggregations {
repeated Aggregate aggregations = 1;
}
message Aggregate {
string name = 1;
oneof aggregation {
TermAggregation term = 2;
PercentileAggregation percentile = 3;
HistogramAggregation histogram = 4;
}
}
message TermAggregation {
string field = 2;
uint32 size = 3;
}
message PercentileAggregation {
string field = 2;
repeated double percents = 3;
}
message HistogramAggregation {
string field = 2;
uint32 interval = 3;
}
message NamedAggregationResult {
map<string, AggregationResult> aggregations = 3;
}
message AggregationResult {
repeated AggregationResultBucket buckets = 2;
}
message AggregationResultBucket {
google.protobuf.Value key = 1;
double value = 2;
}
message HasExpressionList {
repeated HasExpression expressions = 1;
}
message HasExpression {
oneof expression {
HasExpressionList and = 1;
HasExpressionList or = 2;
HasExpression not = 3;
HasCondition condition = 4;
}
}
message HasCondition {
string key = 1;
google.protobuf.Value value = 2;
Condition condition = 3;
}
enum Condition {
UNKNOWN_CONDITION = 0;
EQ = 1;
NEQ = 2;
GT = 3;
GTE = 4;
LT = 5;
LTE = 6;
INSIDE = 7;
OUTSIDE = 8;
BETWEEN = 9;
WITHIN = 10;
WITHOUT = 11;
CONTAINS = 12;
}
message SelectStatement {
repeated string marks = 1;
}
message Selection {
oneof result {
Vertex vertex = 1;
Edge edge = 2;
}
}
message Selections {
map<string, Selection> selections = 1;
}
message Vertex {
string gid = 1;
string label = 2;
google.protobuf.Struct data = 3;
}
message Edge {
string gid = 1;
string label = 2;
string from = 3;
string to = 4;
google.protobuf.Struct data = 5;
}
message QueryResult {
oneof result {
Vertex vertex = 1;
Edge edge = 2;
NamedAggregationResult aggregations = 3;
Selections selections = 4;
google.protobuf.Value render = 5;
uint32 count = 6;
}
}
message EditResult {
string id = 1;
}
message BulkEditResult {
int32 insert_count = 1;
int32 error_count = 2;
}
message GraphElement {
string graph = 1;
Vertex vertex = 2;
Edge edge = 3;
}
message GraphID {
string graph = 1;
}
message ElementID {
string graph = 1;
string id = 2;
}
message IndexID {
string graph = 1;
string label = 2;
string field = 3;
}
message Timestamp {
string timestamp = 1;
}
enum FieldType {
UNKNOWN = 0;
STRING = 1;
NUMERIC = 2;
BOOL = 3;
}
message Empty {}
message ListGraphsResponse {
repeated string graphs = 1;
}
message ListIndicesResponse {
repeated IndexID indices = 1;
}
message ListLabelsResponse {
repeated string vertex_labels = 1;
repeated string edge_labels = 2;
}
service Query {
rpc Traversal(GraphQuery) returns (stream QueryResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}/query"
body: "*"
};
}
rpc GetVertex(ElementID) returns (Vertex) {
option (google.api.http) = {
get: "/v1/graph/{graph}/vertex/{id}"
};
}
rpc GetEdge(ElementID) returns (Edge) {
option (google.api.http) = {
get: "/v1/graph/{graph}/edge/{id}"
};
}
rpc GetTimestamp(GraphID) returns (Timestamp) {
option (google.api.http) = {
get: "/v1/graph/{graph}/timestamp"
};
}
rpc GetSchema(GraphID) returns (Graph) {
option (google.api.http) = {
get: "/v1/graph/{graph}/schema"
};
}
rpc ListGraphs(Empty) returns (ListGraphsResponse) {
option (google.api.http) = {
get: "/v1/graph"
};
}
rpc ListIndices(GraphID) returns (ListIndicesResponse) {
option (google.api.http) = {
get: "/v1/graph/{graph}/index"
};
}
rpc ListLabels(GraphID) returns (ListLabelsResponse) {
option (google.api.http) = {
get: "/v1/graph/{graph}/label"
};
}
}
service Edit {
rpc AddVertex(GraphElement) returns (EditResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}/vertex"
body: "vertex"
};
}
rpc AddEdge(GraphElement) returns (EditResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}/edge"
body: "edge"
};
}
rpc BulkAdd(stream GraphElement) returns (BulkEditResult) {
option (google.api.http) = {
post: "/v1/graph"
};
}
rpc AddGraph(GraphID) returns (EditResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}"
};
}
rpc DeleteGraph(GraphID) returns (EditResult) {
option (google.api.http) = {
delete: "/v1/graph/{graph}"
};
}
rpc DeleteVertex(ElementID) returns (EditResult) {
option (google.api.http) = {
delete: "/v1/graph/{graph}/vertex/{id}"
};
}
rpc DeleteEdge(ElementID) returns (EditResult) {
option (google.api.http) = {
delete: "/v1/graph/{graph}/edge/{id}"
};
}
rpc AddIndex(IndexID) returns (EditResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}/index/{label}"
body: "*"
};
}
rpc DeleteIndex(IndexID) returns (EditResult) {
option (google.api.http) = {
delete: "/v1/graph/{graph}/index/{label}/{field}"
};
}
rpc AddSchema(Graph) returns (EditResult) {
option (google.api.http) = {
post: "/v1/graph/{graph}/schema"
body: "*"
};
}
}
You can’t perform that action at this time.