1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.enterpriseknowledgegraph.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/enterpriseknowledgegraph/v1/job_state.proto"; 24import "google/cloud/enterpriseknowledgegraph/v1/operation_metadata.proto"; 25import "google/protobuf/empty.proto"; 26import "google/protobuf/struct.proto"; 27import "google/protobuf/timestamp.proto"; 28import "google/protobuf/wrappers.proto"; 29import "google/rpc/status.proto"; 30 31option csharp_namespace = "Google.Cloud.EnterpriseKnowledgeGraph.V1"; 32option go_package = "cloud.google.com/go/enterpriseknowledgegraph/apiv1/enterpriseknowledgegraphpb;enterpriseknowledgegraphpb"; 33option java_multiple_files = true; 34option java_outer_classname = "ServiceProto"; 35option java_package = "com.google.cloud.enterpriseknowledgegraph.v1"; 36option php_namespace = "Google\\Cloud\\EnterpriseKnowledgeGraph\\V1"; 37option ruby_package = "Google::Cloud::EnterpriseKnowledgeGraph::V1"; 38option (google.api.resource_definition) = { 39 type: "bigquery.googleapis.com/Dataset" 40 pattern: "projects/{project}/datasets/{dataset}" 41}; 42option (google.api.resource_definition) = { 43 type: "bigquery.googleapis.com/Table" 44 pattern: "projects/{project}/datasets/{dataset}/tables/{table}" 45}; 46option (google.api.resource_definition) = { 47 type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity" 48 pattern: "projects/{project}/locations/{location}/cloudKnowledgeGraphEntities/{cloud_knowledge_graph_entity}" 49}; 50option (google.api.resource_definition) = { 51 type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity" 52 pattern: "projects/{project}/locations/{location}/publicKnowledgeGraphEntities/{public_knowledge_graph_entity}" 53}; 54 55// APIs for enterprise knowledge graph product. 56service EnterpriseKnowledgeGraphService { 57 option (google.api.default_host) = "enterpriseknowledgegraph.googleapis.com"; 58 option (google.api.oauth_scopes) = 59 "https://www.googleapis.com/auth/cloud-platform"; 60 61 // Creates a EntityReconciliationJob. A EntityReconciliationJob once created 62 // will right away be attempted to start. 63 rpc CreateEntityReconciliationJob(CreateEntityReconciliationJobRequest) 64 returns (EntityReconciliationJob) { 65 option (google.api.http) = { 66 post: "/v1/{parent=projects/*/locations/*}/entityReconciliationJobs" 67 body: "entity_reconciliation_job" 68 }; 69 option (google.api.method_signature) = "parent,entity_reconciliation_job"; 70 } 71 72 // Gets a EntityReconciliationJob. 73 rpc GetEntityReconciliationJob(GetEntityReconciliationJobRequest) 74 returns (EntityReconciliationJob) { 75 option (google.api.http) = { 76 get: "/v1/{name=projects/*/locations/*/entityReconciliationJobs/*}" 77 }; 78 option (google.api.method_signature) = "name"; 79 } 80 81 // Lists Entity Reconciliation Jobs. 82 rpc ListEntityReconciliationJobs(ListEntityReconciliationJobsRequest) 83 returns (ListEntityReconciliationJobsResponse) { 84 option (google.api.http) = { 85 get: "/v1/{parent=projects/*/locations/*}/entityReconciliationJobs" 86 }; 87 option (google.api.method_signature) = "parent"; 88 } 89 90 // Cancels a EntityReconciliationJob. Success of cancellation is not 91 // guaranteed. 92 rpc CancelEntityReconciliationJob(CancelEntityReconciliationJobRequest) 93 returns (google.protobuf.Empty) { 94 option (google.api.http) = { 95 post: "/v1/{name=projects/*/locations/*/entityReconciliationJobs/*}:cancel" 96 body: "*" 97 }; 98 option (google.api.method_signature) = "name"; 99 } 100 101 // Deletes a EntityReconciliationJob. 102 // It only deletes the job when the job state is in FAILED, SUCCEEDED, and 103 // CANCELLED. 104 rpc DeleteEntityReconciliationJob(DeleteEntityReconciliationJobRequest) 105 returns (google.protobuf.Empty) { 106 option (google.api.http) = { 107 delete: "/v1/{name=projects/*/locations/*/entityReconciliationJobs/*}" 108 }; 109 option (google.api.method_signature) = "name"; 110 } 111 112 // Finds the Cloud KG entities with CKG ID(s). 113 rpc Lookup(LookupRequest) returns (LookupResponse) { 114 option (google.api.http) = { 115 get: "/v1/{parent=projects/*/locations/*}/cloudKnowledgeGraphEntities:Lookup" 116 }; 117 option (google.api.method_signature) = "parent,ids"; 118 } 119 120 // Searches the Cloud KG entities with entity name. 121 rpc Search(SearchRequest) returns (SearchResponse) { 122 option (google.api.http) = { 123 get: "/v1/{parent=projects/*/locations/*}/cloudKnowledgeGraphEntities:Search" 124 }; 125 option (google.api.method_signature) = "parent,query"; 126 } 127 128 // Finds the public KG entities with public KG ID(s). 129 rpc LookupPublicKg(LookupPublicKgRequest) returns (LookupPublicKgResponse) { 130 option (google.api.http) = { 131 get: "/v1/{parent=projects/*/locations/*}/publicKnowledgeGraphEntities:Lookup" 132 }; 133 option (google.api.method_signature) = "parent,ids"; 134 } 135 136 // Searches the public KG entities with entity name. 137 rpc SearchPublicKg(SearchPublicKgRequest) returns (SearchPublicKgResponse) { 138 option (google.api.http) = { 139 get: "/v1/{parent=projects/*/locations/*}/publicKnowledgeGraphEntities:Search" 140 }; 141 option (google.api.method_signature) = "parent,query"; 142 } 143} 144 145// The desired input location and metadata. 146message InputConfig { 147 // The type of entities we will support. Currently, we only support people, 148 // establishment, property, and product types. If the type is 149 // unspecified, it will be generic type. 150 enum EntityType { 151 // The default value. 152 ENTITY_TYPE_UNSPECIFIED = 0; 153 154 // People entity. 155 PEOPLE = 1 [deprecated = true]; 156 157 // Establishment entity. 158 ESTABLISHMENT = 2 [deprecated = true]; 159 160 // Property entity. e.g. real estate property. 161 PROPERTY = 3 [deprecated = true]; 162 163 // Product entity. 164 PRODUCT = 4; 165 166 // Organization entity. 167 ORGANIZATION = 5; 168 169 // Local Business entity. 170 LOCAL_BUSINESS = 6; 171 172 // Person entity. 173 PERSON = 7; 174 } 175 176 // Set of input BigQuery tables. 177 repeated BigQueryInputConfig bigquery_input_configs = 1; 178 179 // Entity type 180 EntityType entity_type = 2; 181 182 // Optional. Provide the bigquery table containing the previous results if 183 // cluster ID stability is desired. Format is 184 // `projects/*/datasets/*/tables/*`. 185 string previous_result_bigquery_table = 3 [ 186 (google.api.field_behavior) = OPTIONAL, 187 (google.api.resource_reference) = { type: "bigquery.googleapis.com/Table" } 188 ]; 189} 190 191// The input config for BigQuery tables. 192message BigQueryInputConfig { 193 // Required. Format is `projects/*/datasets/*/tables/*`. 194 string bigquery_table = 1 [ 195 (google.api.field_behavior) = REQUIRED, 196 (google.api.resource_reference) = { type: "bigquery.googleapis.com/Table" } 197 ]; 198 199 // Required. Schema mapping file 200 string gcs_uri = 2 [(google.api.field_behavior) = REQUIRED]; 201} 202 203// The desired output location and metadata. 204message OutputConfig { 205 // Format is “projects/*/datasets/*”. 206 string bigquery_dataset = 1 [(google.api.resource_reference) = { 207 type: "bigquery.googleapis.com/Dataset" 208 }]; 209} 210 211// Recon configs 212message ReconConfig { 213 // Options for experimental changes on entity clustering behavior. 214 message Options { 215 // If true, separate clusters by their geographic region (from geocoding). 216 // Uses the following entity features: 217 // 218 // - schema.org/addressLocality 219 // - schema.org/addressRegion 220 // - schema.org/addressCountry 221 // Warning: processing will no longer be regionalized! 222 bool enable_geocoding_separation = 100; 223 } 224 225 // Model Configs 226 message ModelConfig { 227 // Model name. Refer to external documentation for valid names. 228 // If unspecified, it defaults to the one mentioned in the documentation. 229 string model_name = 1; 230 231 // Model version tag. Refer to external documentation for valid tags. 232 // If unspecified, it defaults to the one mentioned in the documentation. 233 string version_tag = 2; 234 } 235 236 // Choice of clustering algorithm. Default is ConnectedComponentsConfig. 237 oneof clustering_config { 238 // Configs for connected components. 239 ConnectedComponentsConfig connected_components_config = 1; 240 241 // Configs for affinity clustering. 242 AffinityClusteringConfig affinity_clustering_config = 2; 243 } 244 245 // Extra options that affect entity clustering behavior. 246 Options options = 3; 247 248 // Model Configs 249 ModelConfig model_config = 4; 250} 251 252// Options for connected components. 253message ConnectedComponentsConfig { 254 // Threshold used for connected components. Default value is 0.85. 255 float weight_threshold = 1; 256} 257 258// Options for affinity clustering. 259message AffinityClusteringConfig { 260 // Number of iterations to perform. Default value is 1. 261 int64 compression_round_count = 1; 262} 263 264// Details of operations that perform deletes of any entities. 265message DeleteOperationMetadata { 266 // The common part of the operation metadata. 267 CommonOperationMetadata common_metadata = 1; 268} 269 270// Request message for CreateEntityReconciliationJob. 271message CreateEntityReconciliationJobRequest { 272 // Required. The resource name of the Location to create the 273 // EntityReconciliationJob in. Format: 274 // `projects/{project}/locations/{location}` 275 string parent = 1 [ 276 (google.api.field_behavior) = REQUIRED, 277 (google.api.resource_reference) = { 278 child_type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 279 } 280 ]; 281 282 // Required. The EntityReconciliationJob to create. 283 EntityReconciliationJob entity_reconciliation_job = 2 284 [(google.api.field_behavior) = REQUIRED]; 285} 286 287// Request message for GetEntityReconciliationJob. 288message GetEntityReconciliationJobRequest { 289 // Required. The name of the EntityReconciliationJob resource. 290 // Format: 291 // `projects/{project}/locations/{location}/entityReconciliationJobs/{entity_reconciliation_job}` 292 string name = 1 [ 293 (google.api.field_behavior) = REQUIRED, 294 (google.api.resource_reference) = { 295 type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 296 } 297 ]; 298} 299 300// Request message for 301// [EnterpriseKnowledgeGraphService.ListEntityReconciliationJobs][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.ListEntityReconciliationJobs]. 302message ListEntityReconciliationJobsRequest { 303 // Required. The name of the EntityReconciliationJob's parent resource. 304 // Format: `projects/{project}/locations/{location}` 305 string parent = 1 [ 306 (google.api.field_behavior) = REQUIRED, 307 (google.api.resource_reference) = { 308 child_type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 309 } 310 ]; 311 312 // An expression for filtering the results of the request. For field names 313 // both snake_case and camelCase are supported. 314 string filter = 2; 315 316 // The standard list page size. 317 int32 page_size = 3; 318 319 // The standard list page token. 320 string page_token = 4; 321} 322 323// Response message for 324// [EnterpriseKnowledgeGraphService.ListEntityReconciliationJobs][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.ListEntityReconciliationJobs]. 325message ListEntityReconciliationJobsResponse { 326 // A list of EntityReconciliationJobs that matches the specified filter in the 327 // request. 328 repeated EntityReconciliationJob entity_reconciliation_jobs = 1; 329 330 // The standard List next-page token. 331 string next_page_token = 2; 332} 333 334// Request message for CancelEntityReconciliationJob. 335message CancelEntityReconciliationJobRequest { 336 // Required. The name of the EntityReconciliationJob resource. 337 // Format: 338 // `projects/{project}/locations/{location}/entityReconciliationJobs/{entity_reconciliation_job}` 339 string name = 1 [ 340 (google.api.field_behavior) = REQUIRED, 341 (google.api.resource_reference) = { 342 type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 343 } 344 ]; 345} 346 347// Request message for DeleteEntityReconciliationJob. 348message DeleteEntityReconciliationJobRequest { 349 // Required. The name of the EntityReconciliationJob resource. 350 // Format: 351 // `projects/{project}/locations/{location}/entityReconciliationJobs/{entity_reconciliation_job}` 352 string name = 1 [ 353 (google.api.field_behavior) = REQUIRED, 354 (google.api.resource_reference) = { 355 type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 356 } 357 ]; 358} 359 360// Entity reconciliation job message. 361message EntityReconciliationJob { 362 option (google.api.resource) = { 363 type: "enterpriseknowledgegraph.googleapis.com/EntityReconciliationJob" 364 pattern: "projects/{project}/locations/{location}/entityReconciliationJobs/{entity_reconciliation_job}" 365 }; 366 367 // Output only. Resource name of the EntityReconciliationJob. 368 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 369 370 // Required. Information about the input BigQuery tables. 371 InputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; 372 373 // Required. The desired output location. 374 OutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED]; 375 376 // Output only. The detailed state of the job. 377 JobState state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 378 379 // Output only. Only populated when the job's state is JOB_STATE_FAILED or 380 // JOB_STATE_CANCELLED. 381 google.rpc.Status error = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 382 383 // Output only. Time when the EntityReconciliationJob was created. 384 google.protobuf.Timestamp create_time = 6 385 [(google.api.field_behavior) = OUTPUT_ONLY]; 386 387 // Output only. Time when the EntityReconciliationJob entered any of the 388 // following states: `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, 389 // `JOB_STATE_CANCELLED`. 390 google.protobuf.Timestamp end_time = 7 391 [(google.api.field_behavior) = OUTPUT_ONLY]; 392 393 // Output only. Time when the EntityReconciliationJob was most recently 394 // updated. 395 google.protobuf.Timestamp update_time = 8 396 [(google.api.field_behavior) = OUTPUT_ONLY]; 397 398 // Optional. Recon configs to adjust the clustering behavior. 399 ReconConfig recon_config = 9 [(google.api.field_behavior) = OPTIONAL]; 400} 401 402// Request message for 403// [EnterpriseKnowledgeGraphService.Lookup][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Lookup]. 404message LookupRequest { 405 // Required. The name of the Entity's parent resource. 406 // Format: 407 // `projects/{project}/locations/{location}` 408 string parent = 1 [ 409 (google.api.field_behavior) = REQUIRED, 410 (google.api.resource_reference) = { 411 child_type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity" 412 } 413 ]; 414 415 // Required. The list of entity ids to be used for lookup. 416 repeated string ids = 2 [(google.api.field_behavior) = REQUIRED]; 417 418 // The list of language codes (defined in ISO 693) to run the query with, 419 // e.g. 'en'. 420 repeated string languages = 3; 421} 422 423// Response message for 424// [EnterpriseKnowledgeGraphService.Lookup][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Lookup]. 425message LookupResponse { 426 // The local context applicable for the response. See more details at 427 // http://www.w3.org/TR/json-ld/#context-definitions. 428 google.protobuf.Value context = 1; 429 430 // The schema type of top-level JSON-LD object, e.g. ItemList. 431 google.protobuf.Value type = 2; 432 433 // The item list of search results. 434 google.protobuf.ListValue item_list_element = 3; 435} 436 437// Request message for 438// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search]. 439message SearchRequest { 440 // Required. The name of the Entity's parent resource. 441 // Format: 442 // `projects/{project}/locations/{location}` 443 string parent = 1 [ 444 (google.api.field_behavior) = REQUIRED, 445 (google.api.resource_reference) = { 446 child_type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity" 447 } 448 ]; 449 450 // Required. The literal query string for search. 451 string query = 2 [(google.api.field_behavior) = REQUIRED]; 452 453 // The list of language codes (defined in ISO 693) to run the query with, 454 // e.g. 'en'. 455 repeated string languages = 3; 456 457 // Restricts returned entities with these types, e.g. Person 458 // (as defined in http://schema.org/Person). If multiple types are specified, 459 // returned entities will contain one or more of these types. 460 repeated string types = 4; 461 462 // Limits the number of entities to be returned. 463 google.protobuf.Int32Value limit = 6; 464} 465 466// Response message for 467// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search]. 468message SearchResponse { 469 // The local context applicable for the response. See more details at 470 // http://www.w3.org/TR/json-ld/#context-definitions. 471 google.protobuf.Value context = 1; 472 473 // The schema type of top-level JSON-LD object, e.g. ItemList. 474 google.protobuf.Value type = 2; 475 476 // The item list of search results. 477 google.protobuf.ListValue item_list_element = 3; 478} 479 480// Request message for 481// [EnterpriseKnowledgeGraphService.LookupPublicKg][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.LookupPublicKg]. 482message LookupPublicKgRequest { 483 // Required. The name of the Entity's parent resource. 484 // Format: 485 // `projects/{project}/locations/{location}` 486 string parent = 1 [ 487 (google.api.field_behavior) = REQUIRED, 488 (google.api.resource_reference) = { 489 child_type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity" 490 } 491 ]; 492 493 // Required. The list of entity ids to be used for lookup. 494 repeated string ids = 2 [(google.api.field_behavior) = REQUIRED]; 495 496 // The list of language codes (defined in ISO 693) to run the query with, 497 // e.g. 'en'. 498 repeated string languages = 3; 499} 500 501// Response message for 502// [EnterpriseKnowledgeGraphService.LookupPublicKg][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.LookupPublicKg]. 503message LookupPublicKgResponse { 504 // The local context applicable for the response. See more details at 505 // http://www.w3.org/TR/json-ld/#context-definitions. 506 google.protobuf.Value context = 1; 507 508 // The schema type of top-level JSON-LD object, e.g. ItemList. 509 google.protobuf.Value type = 2; 510 511 // The item list of search results. 512 google.protobuf.ListValue item_list_element = 3; 513} 514 515// Request message for 516// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search]. 517message SearchPublicKgRequest { 518 // Required. The name of the Entity's parent resource. 519 // Format: 520 // `projects/{project}/locations/{location}` 521 string parent = 1 [ 522 (google.api.field_behavior) = REQUIRED, 523 (google.api.resource_reference) = { 524 child_type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity" 525 } 526 ]; 527 528 // Required. The literal query string for search. 529 string query = 2 [(google.api.field_behavior) = REQUIRED]; 530 531 // The list of language codes (defined in ISO 693) to run the query with, 532 // e.g. 'en'. 533 repeated string languages = 3; 534 535 // Restricts returned entities with these types, e.g. Person 536 // (as defined in http://schema.org/Person). If multiple types are specified, 537 // returned entities will contain one or more of these types. 538 repeated string types = 4; 539 540 // Limits the number of entities to be returned. 541 google.protobuf.Int32Value limit = 6; 542} 543 544// Response message for 545// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search]. 546message SearchPublicKgResponse { 547 // The local context applicable for the response. See more details at 548 // http://www.w3.org/TR/json-ld/#context-definitions. 549 google.protobuf.Value context = 1; 550 551 // The schema type of top-level JSON-LD object, e.g. ItemList. 552 google.protobuf.Value type = 2; 553 554 // The item list of search results. 555 google.protobuf.ListValue item_list_element = 3; 556} 557