Skip to content

Entity resolution js #7438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .doc_gen/metadata/entityresolution_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ entityresolution_Hello:
- description:
snippet_tags:
- entityres.java2_hello.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- javascript.v3.entity-resolution.hello
services:
entityresolution: {listMatchingWorkflows}
entityresolution_DeleteSchemaMapping:
Expand All @@ -24,6 +32,14 @@ entityresolution_DeleteSchemaMapping:
- description:
snippet_tags:
- entityres.java2_delete_mappings.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.delete.schema-mapping
services:
entityresolution: {DeleteSchemaMapping}
entityresolution_TagEntityResource:
Expand All @@ -36,6 +52,14 @@ entityresolution_TagEntityResource:
- description:
snippet_tags:
- entityres.java2_tag_resource.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.tag.entity-resource
services:
entityresolution: {TagEntityResource}
entityresolution_CreateMatchingWorkflow:
Expand All @@ -48,6 +72,14 @@ entityresolution_CreateMatchingWorkflow:
- description:
snippet_tags:
- entityres.java2_create_matching_workflow.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.create-matching-workflow
services:
entityresolution: {CreateMatchingWorkflow}
entityresolution_CheckWorkflowStatus:
Expand All @@ -60,6 +92,14 @@ entityresolution_CheckWorkflowStatus:
- description:
snippet_tags:
- entityres.java2_check_matching_workflow.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.check-workflow-status
services:
entityresolution: {CheckWorkflowStatus}
entityresolution_StartMatchingJob:
Expand All @@ -72,6 +112,14 @@ entityresolution_StartMatchingJob:
- description:
snippet_tags:
- entityres.java2_start_job.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.start.matching-job
services:
entityresolution: {StartMatchingJob}
entityresolution_GetMatchingJob:
Expand All @@ -84,6 +132,14 @@ entityresolution_GetMatchingJob:
- description:
snippet_tags:
- entityres.java2_get_job.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.get.matching-job
services:
entityresolution: {GetMatchingJob}
entityresolution_DeleteMatchingWorkflow:
Expand All @@ -96,6 +152,14 @@ entityresolution_DeleteMatchingWorkflow:
- description:
snippet_tags:
- entityres.java2_delete_matching_workflow.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.delete-matching-workflow
services:
entityresolution: {DeleteMatchingWorkflow}
entityresolution_ListSchemaMappings:
Expand All @@ -108,6 +172,14 @@ entityresolution_ListSchemaMappings:
- description:
snippet_tags:
- entityres.java2_list_mappings.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.list.schema-mapping
services:
entityresolution: {ListSchemaMappings}
entityresolution_GetSchemaMapping:
Expand All @@ -120,6 +192,14 @@ entityresolution_GetSchemaMapping:
- description:
snippet_tags:
- entityres.java2_get_schema_mapping.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.get.schema-mapping
services:
entityresolution: {GetSchemaMapping}
entityresolution_CreateSchemaMapping:
Expand All @@ -132,6 +212,14 @@ entityresolution_CreateSchemaMapping:
- description:
snippet_tags:
- entityres.java2_create_schema.main
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/entityresolution
excerpts:
- description:
snippet_tags:
- entity-resolution.JavaScriptv3.create-schema-mapping
services:
entityresolution: {CreateSchemaMapping}
entityresolution_Scenario:
Expand All @@ -158,5 +246,14 @@ entityresolution_Scenario:
- description: A wrapper class for &ERlong; SDK methods.
snippet_tags:
- entityres.java2_actions.main
JavaScript:
versions:
- sdk_version: 2
github: javav2/example_code/entityresolution
sdkguide:
excerpts:
- description: Run an interactive scenario demonstrating &ERlong; features.
snippet_tags:
- entity-resolution.JavaScriptv3.scenario.basics
services:
entityresolution: {}
123 changes: 123 additions & 0 deletions javascriptv3/example_code/entityresolution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# AWS Entity Resolution code examples for the SDK for JavaScript (v3)

## Overview

Shows how to use the AWS SDK for JavaScript (v3) to work with AWS Entity Resolution.

<!--custom.overview.start-->
<!--custom.overview.end-->

_AWS Entity Resolution helps organizations extract, link, and organize information from multiple data sources._

## ⚠ Important

* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).

<!--custom.important.start-->
<!--custom.important.end-->

## Code examples

### Prerequisites

For prerequisites, see the [README](../../README.md#Prerequisites) in the `javascriptv3` folder.


<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->

### Get started

- [Hello AWS Entity Resolution](hello.js#L4) (`listMatchingWorkflows`)


### Single actions

Code excerpts that show you how to call individual service functions.

- [CreateMatchingWorkflow](actions/create-matching-workflow.js#L4)
- [CreateSchemaMapping](actions/create-schema-mapping.js#L4)
- [DeleteMatchingWorkflow](actions/delete-matching-workflow.js#L4)
- [DeleteSchemaMapping](actions/delete-schema-mapping.js#L4)
- [GetMatchingJob](actions/get-matching-job.js#L4)
- [GetSchemaMapping](actions/get-schema-mapping.js#L4)
- [ListSchemaMappings](actions/list-schema-mappings.js#L4)
- [StartMatchingJob](actions/start-matching-job.js#L4)
- [TagEntityResource](actions/tag-entity-resource.js#L4)


<!--custom.examples.start-->
<!--custom.examples.end-->

## Run the examples

### Instructions

**Note**: All code examples are written in ECMAscript 6 (ES6). For guidelines on converting to CommonJS, see
[JavaScript ES6/CommonJS syntax](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/sdk-examples-javascript-syntax.html).

**Run a single action**

```bash
node ./actions/<fileName>
```

**Run a scenario**

Most scenarios can be run with the following command:
```bash
node ./scenarios/<fileName>
```

**Run with options**

Some actions and scenarios can be run with options from the command line:
```bash
node ./scenarios/<fileName> --option1 --option2
```
[util.parseArgs](https://nodejs.org/api/util.html#utilparseargsconfig) is used to configure
these options. For the specific options available to each script, see the `parseArgs` usage
for that file.

<!--custom.instructions.start-->
<!--custom.instructions.end-->

#### Hello AWS Entity Resolution

This example shows you how to get started using AWS Entity Resolution.

```bash
node ./hello.js
```


### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../../README.md#Tests)
in the `javascriptv3` folder.



<!--custom.tests.start-->
<!--custom.tests.end-->

## Additional resources

- [AWS Entity Resolution User Guide](https://docs.aws.amazon.com/entityresolution/latest/userguide/what-is-service.html)
- [AWS Entity Resolution API Reference](https://docs.aws.amazon.com/entityresolution/latest/apireference/Welcome.html)
- [SDK for JavaScript (v3) AWS Entity Resolution reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/entityresolution/)

<!--custom.resources.start-->
<!--custom.resources.end-->

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// snippet-start:[entity-resolution.JavaScriptv3.check-workflow-status]

//The default inputs for this demo are read from the ../inputs.json.

import { fileURLToPath } from "node:url";

import {
GetMatchingJobCommand,
EntityResolutionClient,
} from "@aws-sdk/client-entityresolution";
import data from "../inputs.json" with { type: "json" };

const region = "eu-west-1";
const erClient = new EntityResolutionClient({ region: region });

export const main = async ({ workflowName, jobId }) => {
const getMatchingJobParams = {
workflowName: `${data.inputs.workflowName}`,
jobId: `${data.inputs.jobId}`,
};
try {
const command = new GetMatchingJobCommand(getMatchingJobParams);
const response = await erClient.send(command);
console.log(`Job status: ${response.status}`);
} catch (error) {
console.log("error ", error.message);
}
};

// snippet-end:[entity-resolution.JavaScriptv3.check-workflow-status]

// Invoke main function if this file was run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main();
}
Loading
Loading