Skip to content

Commit

Permalink
feat: publish Google Cloud's Cloud Knowledge Graph (CKG) API
Browse files Browse the repository at this point in the history
CKG lookup and search APIs enable customers to search, link and federate their own knowledge with Google’s.

PiperOrigin-RevId: 487280461
  • Loading branch information
Google APIs authored and Copybara-Service committed Nov 9, 2022
1 parent 6e1a5a0 commit f19c628
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 1 deletion.
2 changes: 2 additions & 0 deletions google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel
Expand Up @@ -57,7 +57,9 @@ proto_library(
"//google/api:resource_proto",
"//google/rpc:status_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)

Expand Down
200 changes: 199 additions & 1 deletion google/cloud/enterpriseknowledgegraph/v1/service.proto
Expand Up @@ -23,16 +23,18 @@ import "google/api/resource.proto";
import "google/cloud/enterpriseknowledgegraph/v1/job_state.proto";
import "google/cloud/enterpriseknowledgegraph/v1/operation_metadata.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Cloud.EnterpriseKnowledgeGraph.V1";
option go_package = "google.golang.org/genproto/googleapis/cloud/enterpriseknowledgegraph/v1;enterpriseknowledgegraph";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.cloud.enterpriseknowledgegraph.v1";
option php_namespace = "Google\\Cloud\\EnterpriseKnowledgeGraph\\V1";
option ruby_package = "Google::Cloud::EnterpriseKnowledgeGraph::V1";
option csharp_namespace = "Google.Cloud.EnterpriseKnowledgeGraph.V1";
option (google.api.resource_definition) = {
type: "bigquery.googleapis.com/Dataset"
pattern: "projects/{project}/datasets/{dataset}"
Expand All @@ -41,6 +43,14 @@ option (google.api.resource_definition) = {
type: "bigquery.googleapis.com/Table"
pattern: "projects/{project}/datasets/{dataset}/tables/{table}"
};
option (google.api.resource_definition) = {
type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity"
pattern: "projects/{project}/locations/{location}/cloudKnowledgeGraphEntities/{cloud_knowledge_graph_entity}"
};
option (google.api.resource_definition) = {
type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity"
pattern: "projects/{project}/locations/{location}/publicKnowledgeGraphEntities/{public_knowledge_graph_entity}"
};

// APIs for enterprise knowledge graph product.
service EnterpriseKnowledgeGraphService {
Expand Down Expand Up @@ -98,6 +108,38 @@ service EnterpriseKnowledgeGraphService {
};
option (google.api.method_signature) = "name";
}

// Finds the Cloud KG entities with CKG ID(s).
rpc Lookup(LookupRequest) returns (LookupResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/cloudKnowledgeGraphEntities:Lookup"
};
option (google.api.method_signature) = "parent,ids";
}

// Searches the Cloud KG entities with entity name.
rpc Search(SearchRequest) returns (SearchResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/cloudKnowledgeGraphEntities:Search"
};
option (google.api.method_signature) = "parent,query";
}

// Finds the public KG entities with public KG ID(s).
rpc LookupPublicKg(LookupPublicKgRequest) returns (LookupPublicKgResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/publicKnowledgeGraphEntities:Lookup"
};
option (google.api.method_signature) = "parent,ids";
}

// Searches the public KG entities with entity name.
rpc SearchPublicKg(SearchPublicKgRequest) returns (SearchPublicKgResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/publicKnowledgeGraphEntities:Search"
};
option (google.api.method_signature) = "parent,query";
}
}

// The desired input location and metadata.
Expand Down Expand Up @@ -356,3 +398,159 @@ message EntityReconciliationJob {
// Optional. Recon configs to adjust the clustering behavior.
ReconConfig recon_config = 9 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [EnterpriseKnowledgeGraphService.Lookup][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Lookup].
message LookupRequest {
// Required. The name of the Entity's parent resource.
// Format:
// `projects/{project}/locations/{location}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity"
}
];

// Required. The list of entity ids to be used for lookup.
repeated string ids = 2 [(google.api.field_behavior) = REQUIRED];

// The list of language codes (defined in ISO 693) to run the query with,
// e.g. 'en'.
repeated string languages = 3;
}

// Response message for
// [EnterpriseKnowledgeGraphService.Lookup][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Lookup].
message LookupResponse {
// The local context applicable for the response. See more details at
// http://www.w3.org/TR/json-ld/#context-definitions.
google.protobuf.Value context = 1;

// The schema type of top-level JSON-LD object, e.g. ItemList.
google.protobuf.Value type = 2;

// The item list of search results.
google.protobuf.ListValue item_list_element = 3;
}

// Request message for
// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search].
message SearchRequest {
// Required. The name of the Entity's parent resource.
// Format:
// `projects/{project}/locations/{location}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "enterpriseknowledgegraph.googleapis.com/CloudKnowledgeGraphEntity"
}
];

// Required. The literal query string for search.
string query = 2 [(google.api.field_behavior) = REQUIRED];

// The list of language codes (defined in ISO 693) to run the query with,
// e.g. 'en'.
repeated string languages = 3;

// Restricts returned entities with these types, e.g. Person
// (as defined in http://schema.org/Person). If multiple types are specified,
// returned entities will contain one or more of these types.
repeated string types = 4;

// Limits the number of entities to be returned.
google.protobuf.Int32Value limit = 6;
}

// Response message for
// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search].
message SearchResponse {
// The local context applicable for the response. See more details at
// http://www.w3.org/TR/json-ld/#context-definitions.
google.protobuf.Value context = 1;

// The schema type of top-level JSON-LD object, e.g. ItemList.
google.protobuf.Value type = 2;

// The item list of search results.
google.protobuf.ListValue item_list_element = 3;
}

// Request message for
// [EnterpriseKnowledgeGraphService.LookupPublicKg][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.LookupPublicKg].
message LookupPublicKgRequest {
// Required. The name of the Entity's parent resource.
// Format:
// `projects/{project}/locations/{location}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity"
}
];

// Required. The list of entity ids to be used for lookup.
repeated string ids = 2 [(google.api.field_behavior) = REQUIRED];

// The list of language codes (defined in ISO 693) to run the query with,
// e.g. 'en'.
repeated string languages = 3;
}

// Response message for
// [EnterpriseKnowledgeGraphService.LookupPublicKg][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.LookupPublicKg].
message LookupPublicKgResponse {
// The local context applicable for the response. See more details at
// http://www.w3.org/TR/json-ld/#context-definitions.
google.protobuf.Value context = 1;

// The schema type of top-level JSON-LD object, e.g. ItemList.
google.protobuf.Value type = 2;

// The item list of search results.
google.protobuf.ListValue item_list_element = 3;
}

// Request message for
// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search].
message SearchPublicKgRequest {
// Required. The name of the Entity's parent resource.
// Format:
// `projects/{project}/locations/{location}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "enterpriseknowledgegraph.googleapis.com/PublicKnowledgeGraphEntity"
}
];

// Required. The literal query string for search.
string query = 2 [(google.api.field_behavior) = REQUIRED];

// The list of language codes (defined in ISO 693) to run the query with,
// e.g. 'en'.
repeated string languages = 3;

// Restricts returned entities with these types, e.g. Person
// (as defined in http://schema.org/Person). If multiple types are specified,
// returned entities will contain one or more of these types.
repeated string types = 4;

// Limits the number of entities to be returned.
google.protobuf.Int32Value limit = 6;
}

// Response message for
// [EnterpriseKnowledgeGraphService.Search][google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphService.Search].
message SearchPublicKgResponse {
// The local context applicable for the response. See more details at
// http://www.w3.org/TR/json-ld/#context-definitions.
google.protobuf.Value context = 1;

// The schema type of top-level JSON-LD object, e.g. ItemList.
google.protobuf.Value type = 2;

// The item list of search results.
google.protobuf.ListValue item_list_element = 3;
}

0 comments on commit f19c628

Please sign in to comment.