backend/schema/catalog/property_graph.proto (91 lines of code) (raw):

// // Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // syntax = "proto2"; package google.spanner.emulator.backend.catalog; // TODO: remove this proto and use the ZetaSQL one once when it's released. // Top-level protobuf to describe a property graph. message PropertyGraphProto { // Name of the catalog containing the property graph. optional string catalog = 1; // Name of the schema containing the property graph. optional string schema = 2; // Name of the property graph. optional string name = 3; repeated GraphElementTableProto node_tables = 4; repeated GraphElementTableProto edge_tables = 5; repeated GraphElementLabelProto labels = 6; repeated GraphPropertyDeclarationProto property_declarations = 7; } // To describe a node or edge within a property graph. message GraphElementTableProto { enum Kind { KIND_UNSPECIFIED = 0; NODE = 1; EDGE = 2; } // Name of the graph element table. optional string name = 1; optional Kind kind = 2; // Name of the catalog containing the base table. optional string base_catalog_name = 3; // Name of the schema containing the base table. optional string base_schema_name = 4; // Name of the table that this element table is based on. optional string base_table_name = 5; // Names of the columns that are part of the element key. At least one. repeated string key_columns = 6; // Cross-references to the `name` field in `GraphElementLabelProto`. repeated string label_names = 7; repeated GraphPropertyDefinitionProto property_definitions = 8; // The SQL expression that defines the dynamic label. optional string dynamic_label_expr = 11; // The SQL expression that defines the dynamic property. optional string dynamic_property_expr = 12; // source_node_table and destination_node_table are only set when `kind` is // EDGE. optional GraphNodeTableReferenceProto source_node_table = 9; optional GraphNodeTableReferenceProto destination_node_table = 10; } // To describe a source or destination node of an edge. message GraphNodeTableReferenceProto { // Cross-references to the `name` field in `GraphElementTableProto`. optional string node_table_name = 1; // Names of the columns that are part of the source or destination key. At // least one. repeated string edge_table_columns = 2; repeated string node_table_columns = 3; } // To describe a label. message GraphElementLabelProto { // Name of the label. optional string name = 1; // Cross-references to the `name` field in `GraphPropertyDeclarationProto`. repeated string property_declaration_names = 2; } // To describe a property declaration. message GraphPropertyDeclarationProto { // Name of the property. optional string name = 1; // Type of the property. optional string type = 2; } // To describe a property definition. message GraphPropertyDefinitionProto { // Cross-references to the `name` field in `GraphPropertyDeclarationProto`. optional string property_declaration_name = 1; // The SQL expression that defines the property. optional string value_expression_sql = 2; }