syntax = "proto3"; package eu.zettoit.themis; service ObjectService{ rpc Create(Object) returns (Empty); rpc Delete(Object) returns (Empty); rpc Exists(Object) returns (ExistsResponse); } service RelationService { rpc Create(Relation) returns (Empty); rpc Delete(Relation) returns (Empty); rpc Exists(Relation) returns (ExistsResponse); } service QueryService { // check if one object or objectset is related to another by a relation rpc IsRelatedTo(Relation) returns (IsRelatedToResponse); // get all objects that are related to one object by a relation rpc GetRelatedTo(Set) returns (GetRelatedToResponse); // get all objects that the given object has a relation with rpc GetRelations(GetRelationsRequest) returns (GetRelationsResponse); } message ExistsResponse { bool exists = 1; } message IsRelatedToResponse{ bool related = 1; } message GetRelatedToResponse{ repeated Object objects = 1; } message GetRelationsRequest{ Object object = 1; string relation = 2; } message GetRelationsResponse{ repeated Object objects = 1; } message Object{ string namespace = 1; string id = 2; } message Set{ string namespace = 1; string id = 2; string relation = 3; } message ObjectOrSet { oneof object_or_set{ Object object = 1; Set set = 2; }; } message Relation{ oneof src{ Object src_obj = 1; Set src_set = 2; }; Object dst = 3; string relation = 4; } message Empty{}