-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
47 changed files
with
6,175 additions
and
1,069 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2024 IndyKite | ||
// | ||
// 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. | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
ingestpb "github.com/indykite/indykite-sdk-go/gen/indykite/ingest/v1beta3" | ||
) | ||
|
||
// batch delete node property represents the command for deleting up to 250 nodes | ||
var batchDeleteNodePropertiesCmd = &cobra.Command{ | ||
Use: "batch_delete_node_properties", | ||
Short: "Delete bunch of records using the IndyKite Ingest API", | ||
Long: `Delete bunch of records using the IndyKite Ingest API.`, | ||
Args: cobra.ExactArgs(0), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
nodeMatch1 := &ingestpb.NodeMatch{ | ||
ExternalId: "0000", | ||
Type: "Employee", | ||
} | ||
|
||
nodeMatch2 := &ingestpb.NodeMatch{ | ||
ExternalId: "0001", | ||
Type: "Truck", | ||
} | ||
|
||
nodeProperties := []*ingestpb.DeleteData_NodePropertyMatch{ | ||
{ | ||
Match: nodeMatch1, | ||
PropertyType: "PropertyType1", | ||
}, | ||
{ | ||
Match: nodeMatch2, | ||
PropertyType: "PropertyType2", | ||
}, | ||
} | ||
resp, err := client.BatchDeleteNodeProperties(context.Background(), nodeProperties) | ||
if err != nil { | ||
log.Fatalf("failed to invoke operation on IndyKite Client %v", err) | ||
} | ||
fmt.Println(jsonp.Format(resp)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(batchDeleteNodePropertiesCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) 2024 IndyKite | ||
// | ||
// 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. | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
ingestpb "github.com/indykite/indykite-sdk-go/gen/indykite/ingest/v1beta3" | ||
) | ||
|
||
// batch delete node represents the command for deleting up to 250 nodes | ||
var batchDeleteNodesCmd = &cobra.Command{ | ||
Use: "batch_delete_nodes", | ||
Short: "Delete bunch of records using the IndyKite Ingest API", | ||
Long: `Delete bunch of records using the IndyKite Ingest API.`, | ||
Args: cobra.ExactArgs(0), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
nodeMatch1 := &ingestpb.NodeMatch{ | ||
ExternalId: "0000", | ||
Type: "Employee", | ||
} | ||
|
||
nodeMatch2 := &ingestpb.NodeMatch{ | ||
ExternalId: "0001", | ||
Type: "Truck", | ||
} | ||
|
||
nodes := []*ingestpb.NodeMatch{ | ||
nodeMatch1, nodeMatch2, | ||
} | ||
resp, err := client.BatchDeleteNodes(context.Background(), nodes) | ||
if err != nil { | ||
log.Fatalf("failed to invoke operation on IndyKite Client %v", err) | ||
} | ||
fmt.Println(jsonp.Format(resp)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(batchDeleteNodesCmd) | ||
} |
78 changes: 78 additions & 0 deletions
78
examples/ingest/cmd/batch_delete_relationship_properties.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (c) 2024 IndyKite | ||
// | ||
// 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. | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
ingestpb "github.com/indykite/indykite-sdk-go/gen/indykite/ingest/v1beta3" | ||
) | ||
|
||
// batch delete relationships represents the command for ingesting up to 250 relationships | ||
var batchDeleteRelationshipPropertiesCmd = &cobra.Command{ | ||
Use: "batch_delete_relationship_properties", | ||
Short: "Delete bunch of records using the IndyKite Ingest API", | ||
Long: `Delete bunch of records using the IndyKite Ingest API.`, | ||
Args: cobra.ExactArgs(0), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
nodeMatch1 := &ingestpb.NodeMatch{ | ||
ExternalId: "0000", | ||
Type: "Employee", | ||
} | ||
|
||
nodeMatch2 := &ingestpb.NodeMatch{ | ||
ExternalId: "0001", | ||
Type: "Truck", | ||
} | ||
|
||
nodeMatch3 := &ingestpb.NodeMatch{ | ||
ExternalId: "0002", | ||
Type: "Employee", | ||
} | ||
|
||
nodeMatch4 := &ingestpb.NodeMatch{ | ||
ExternalId: "0003", | ||
Type: "Truck", | ||
} | ||
relationshipProperties := []*ingestpb.DeleteData_RelationshipPropertyMatch{ | ||
{ | ||
Source: nodeMatch1, | ||
Target: nodeMatch2, | ||
Type: "SERVICES", | ||
PropertyType: "PropertyType1", | ||
}, | ||
{ | ||
Source: nodeMatch3, | ||
Target: nodeMatch4, | ||
Type: "SERVICES", | ||
PropertyType: "PropertyType2", | ||
}, | ||
} | ||
resp, err := client.BatchDeleteRelationshipProperties(context.Background(), relationshipProperties) | ||
if err != nil { | ||
log.Fatalf("failed to invoke operation on IndyKite Client %v", err) | ||
} | ||
fmt.Println(jsonp.Format(resp)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(batchDeleteRelationshipPropertiesCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Copyright (c) 2024 IndyKite | ||
// | ||
// 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. | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
"google.golang.org/protobuf/types/known/timestamppb" | ||
|
||
ingestpb "github.com/indykite/indykite-sdk-go/gen/indykite/ingest/v1beta3" | ||
knowledgeobjects "github.com/indykite/indykite-sdk-go/gen/indykite/knowledge/objects/v1beta1" | ||
objects "github.com/indykite/indykite-sdk-go/gen/indykite/objects/v1beta2" | ||
) | ||
|
||
// batch delete relationships represents the command for ingesting up to 250 relationships | ||
var batchDeleteRelationshipsCmd = &cobra.Command{ | ||
Use: "batch_delete_relationships", | ||
Short: "Delete bunch of records using the IndyKite Ingest API", | ||
Long: `Delete bunch of records using the IndyKite Ingest API.`, | ||
Args: cobra.ExactArgs(0), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
relationship1 := &ingestpb.Relationship{ | ||
Source: &ingestpb.NodeMatch{ | ||
ExternalId: "0000", | ||
Type: "Employee", | ||
}, | ||
Target: &ingestpb.NodeMatch{ | ||
ExternalId: "0001", | ||
Type: "Truck", | ||
}, | ||
Type: "SERVICES", | ||
Properties: []*knowledgeobjects.Property{ | ||
{ | ||
Type: "linked", | ||
Value: &objects.Value{ | ||
Type: &objects.Value_StringValue{ | ||
StringValue: "12345", | ||
}, | ||
}, | ||
Metadata: &knowledgeobjects.Metadata{ | ||
AssuranceLevel: 1, | ||
VerificationTime: timestamppb.Now(), | ||
Source: "Myself", | ||
CustomMetadata: map[string]*objects.Value{ | ||
"customdata": { | ||
Type: &objects.Value_StringValue{StringValue: "SomeCustomData"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
relationship2 := &ingestpb.Relationship{ | ||
Source: &ingestpb.NodeMatch{ | ||
ExternalId: "0002", | ||
Type: "Employee", | ||
}, | ||
Target: &ingestpb.NodeMatch{ | ||
ExternalId: "0003", | ||
Type: "Truck", | ||
}, | ||
Type: "SERVICES", | ||
Properties: []*knowledgeobjects.Property{ | ||
{ | ||
Type: "linked", | ||
Value: &objects.Value{ | ||
Type: &objects.Value_StringValue{ | ||
StringValue: "678910", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
relationships := []*ingestpb.Relationship{ | ||
relationship1, relationship2, | ||
} | ||
resp, err := client.BatchDeleteRelationships(context.Background(), relationships) | ||
if err != nil { | ||
log.Fatalf("failed to invoke operation on IndyKite Client %v", err) | ||
} | ||
fmt.Println(jsonp.Format(resp)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(batchDeleteRelationshipsCmd) | ||
} |
Oops, something went wrong.