

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Neptune 도구 및 유틸리티
<a name="tools"></a>

Amazon Neptune은 그래프로 작업을 단순화하고 자동화할 수 있는 다양한 도구와 유틸리티를 제공합니다. 다음은 그러한 예입니다.

**Amazon Neptune 도구**
+ **[GraphQL용 Amazon Neptune 유틸리티](tools-graphql.md)** - GraphQL용 Amazon Neptune 유틸리티는 Neptune 속성 그래프 데이터베이스에서 [GraphQL](https://graphql.org/) API를 생성하고 유지 관리하는 데 도움이 되는 오픈 소스 Node.js 명령줄 도구입니다. 여러 개수의 입력 파라미터를 갖고 여러 개수의 중첩 필드를 반환하는 GraphQL 쿼리용 GraphQL 해석기를 만들면 코드가 필요 없습니다.
+  **[Nodestream](tools-Nodestream.md)** - Nodestream은 의미론적 모델링 데이터를 그래프로 처리하기 위한 프레임워크입니다. 유연하고 확장 가능하도록 설계되어 데이터를 수집하고 그래프로 모델링하는 방법을 정의할 수 있습니다. 파이프라인 기반 접근 방식을 사용하여 데이터를 수집하고 처리하는 방법을 정의하고 스키마가 변경될 때 그래프를 업데이트하는 방법을 정의하는 방법을 제공합니다.
+  **[Amazon Neptune MCP 쿼리 서버](https://github.com/aws-samples/amazon-neptune-generative-ai-samples/blob/main/neptune-mcp-servers/neptune-query/README.md)**   - 그래프 쿼리(openCypher 및 Gremlin)를 실행하고 그래프 스키마를 가져오는 기능을 제공하여 Neptune 데이터베이스와 Neptune 분석을 모두 지원하는 Amazon Neptune용   모델 컨텍스트 프로토콜(MCP) 서버입니다.
+  **[Amazon Neptune MCP 메모리 서버](https://github.com/aws-samples/amazon-neptune-generative-ai-samples/blob/main/neptune-mcp-servers/neptune-memory/README.md)**   - 에이전트에게 메모리를 제공하는 Amazon Neptune용   모델 컨텍스트 프로토콜(MCP) 서버로, Amazon Neptune에 대한 지식 그래프에 저장됩니다.

# GraphQL용 Amazon Neptune 유틸리티
<a name="tools-graphql"></a>

[GraphQL](https://graphql.org/)용 Amazon Neptune 유틸리티는 Neptune 속성 그래프 데이터베이스에서 GraphQL API를 생성하고 유지 관리하는 데 도움이 되는 오픈 소스 Node.js 명령줄 도구입니다(RDF 데이터에서는 아직 작동하지 않음). 여러 개수의 입력 파라미터를 갖고 여러 개수의 중첩 필드를 반환하는 GraphQL 쿼리용 GraphQL 해석기를 만들면 코드가 필요 없습니다.

[ttps://github.com/aws/amazon-neptune-for-graphql](https://github.com/aws/amazon-neptune-for-graphql)에 오픈 소스 프로젝트로 릴리스되어 있습니다.

다음과 같이 NPM을 사용하여 유틸리티를 설치할 수 있습니다(자세한 내용은 [설치 및 설정](tools-graphql-setup.md) 참조).

```
npm i @aws/neptune-for-graphql -g
```

이 유틸리티는 노드, 엣지, 속성, 엣지 카디널리티 등 기존 Neptune 속성 그래프의 그래프 스키마를 검색할 수 있습니다. 그런 다음 GraphQL 유형을 데이터베이스의 노드 및 엣지에 매핑하는 데 필요한 지시문을 사용하여 GraphQL 스키마를 생성하고 해석기 코드를 자동 생성합니다. 해석기 코드는 GraphQL 쿼리에서 요청한 데이터만 반환하여 지연 시간을 최소화하도록 설계되었습니다.

기존 GraphQL 스키마와 빈 Neptune 데이터베이스로 시작하여 유틸리티가 GraphQL 스키마를 데이터베이스에 로드할 데이터의 노드 및 엣지에 매핑하는 데 필요한 지시문을 유추하도록 할 수도 있습니다. 또는 이미 생성하거나 수정한 GraphQL 스키마와 지시문으로 시작할 수 있습니다.

유틸리티는 AWS AppSync API, IAM 역할, 데이터 소스, 스키마 및 해석기, Neptune을 쿼리하는 AWS Lambda 함수를 포함하여 파이프라인에 필요한 모든 AWS 리소스를 생성할 수 있습니다.

**참고**  
여기의 명령줄 예제는 Linux 콘솔을 가정한 내용입니다. Windows를 사용하는 경우 줄 끝에 있는 백슬래시('\$1')를 캐럿('^')으로 교체합니다.

**Topics**
+ [GraphQL용 Amazon Neptune 유틸리티 설치 및 설정](tools-graphql-setup.md)
+ [기존 Neptune 데이터베이스의 데이터 스캔](tools-graphql-scan-existing.md)
+ [지시문 없이 GraphQL 스키마에서 시작](tools-graphql-start-from-schema.md)
+ [GraphQL 스키마용 지시문으로 작업](tools-graphql-schema-with-directives.md)
+ [GraphQL 유틸리티의 명령줄 인수](tools-graphql-cmd-line-args.md)

# GraphQL용 Amazon Neptune 유틸리티 설치 및 설정
<a name="tools-graphql-setup"></a>

기존 Neptune 데이터베이스에서 유틸리티를 사용하려면 데이터베이스 엔드포인트에 연결할 수 있어야 합니다. 기본적으로 Neptune 데이터베이스는 해당 데이터베이스가 위치한 VPC 내에서만 액세스할 수 있습니다.

유틸리티는 Node.js 명령줄 도구이므로 유틸리티를 실행하려면 Node.js(버전 18 이상)가 설치되어 있어야 합니다. Neptune 데이터베이스와 동일한 VPC의 EC2 인스턴스에서 Node.js를 설치하려면 [다음 지침](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html)을 따릅니다. 유틸리티를 실행할 수 있는 최소 인스턴스 크기는 t2.micro입니다. 인스턴스를 생성하는 동안 **일반 보안 그룹** 풀다운 메뉴에서 Neptune 데이터베이스 VPC를 선택합니다.

EC2 인스턴스 또는 로컬 컴퓨터에 유틸리티 자체를 설치하려면 다음의 NPM을 사용합니다.

```
npm i @aws/neptune-for-graphql -g
```

그런 다음 유틸리티의 help 명령을 실행하여 다음과 같이 제대로 설치되었는지 확인할 수 있습니다.

```
neptune-for-graphql --help
```

 AWS 리소스를 관리하기 위해 [를 설치할 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) 수도 있습니다.

# 기존 Neptune 데이터베이스의 데이터 스캔
<a name="tools-graphql-scan-existing"></a>

GraphQL에 익숙하든 그렇지 않든, 아래 명령은 GraphQL API를 만드는 가장 빠른 방법입니다. 여기서는 [설치 섹션](tools-graphql-setup.md)에 설명된 대로 GraphQL용 Neptune 유틸리티를 설치하고 구성하여 Neptune 데이터베이스의 엔드포인트에 연결했다고 가정합니다.

```
neptune-for-graphql \
  --input-graphdb-schema-neptune-endpoint (your neptune database endpoint):(port number) \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (your new GraphQL API name) \
  --output-resolver-query-https
```

이 유틸리티는 데이터베이스를 분석하여 데이터베이스에 있는 노드, 엣지 및 속성의 스키마를 검색합니다. 이 스키마를 기반으로 관련 쿼리 및 변형이 있는 GraphQL 스키마를 유추합니다. 그런 다음 AppSync GraphQL API와 이를 사용하는 데 필요한 AWS 리소스를 생성합니다. 이러한 리소스에는 한 쌍의 IAM 역할과 GraphQL 해석기 코드가 있는 Lambda 함수가 포함됩니다.

유틸리티가 완료되면 AppSync 콘솔의 명령에서 지정한 이름 아래에서 새 GraphQL API를 찾을 수 있습니다. 테스트하려면 메뉴의 AppSync **쿼리** 옵션을 사용합니다.

데이터베이스에 더 많은 데이터를 추가한 후 동일한 명령을 다시 실행하면 AppSync API 및 Lambda 코드가 그에 따라 업데이트됩니다.

명령과 관련된 모든 리소스를 릴리스하려면 다음 내용을 실행합니다.

```
neptune-for-graphql \
  --remove-aws-pipeline-name (your new GraphQL API name from above)
```

# 지시문 없이 GraphQL 스키마에서 시작
<a name="tools-graphql-start-from-schema"></a>

빈 Neptune 데이터베이스에서 시작하고 지시문 없이 GraphQL 스키마를 사용하여 데이터를 만들고 쿼리할 수 있습니다. 아래 명령은 이를 위한 AWS 리소스를 자동으로 생성합니다.

```
neptune-for-graphql \
  --input-schema-file (your GraphQL schema file)
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (name for your new GraphQL API) \
  --create-update-aws-pipeline-neptune-endpoint (your Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

GraphQL 스키마 파일에는 아래 Todo 예제와 같이 GraphQL 스키마 유형이 포함되어야 합니다. 이 유틸리티는 스키마를 분석하고 유형에 따라 확장 버전을 생성합니다. 그래프 데이터베이스에 저장된 노드에 쿼리와 변형을 추가하고, 스키마에 중첩된 유형이 있는 경우 데이터베이스에 엣지로 저장된 유형 간의 관계를 추가합니다.

유틸리티는 AppSync GraphQL API와 필요한 모든 AWS 리소스를 생성합니다. 여기에는 한 쌍의 IAM 역할과 GraphQL 해석기 코드가 있는 Lambda 함수가 포함됩니다. 명령이 완료되면 AppSync 콘솔에서 지정한 이름의 새 GraphQL API를 찾을 수 있습니다. 테스트하려면 AppSync 메뉴의 **쿼리** 옵션을 사용합니다.

다음 예제에서는 이러한 작동 방식을 설명합니다.

## Todo 예제의 경우 지시문 없이 GraphQL 스키마에서 시작
<a name="tools-graphql-todo-example"></a>

이 예제에서는 지시문 없이 Todo GraphQL 스키마에서 시작합니다. 이 스키마는 *샘플* 디렉터리에서 확인할 수 있습니다. 여기에는 다음 두 가지 유형이 포함됩니다.

```
type Todo {
  name: String
  description: String
  priority: Int
  status: String
  comments: [Comment]
}

type Comment {
  content: String
}
```

이 명령은 Todo 스키마와 빈 Neptune 데이터베이스의 엔드포인트를 처리하여 AWS AppSync에서 GraphQL API를 생성합니다.

```
neptune-for-graphql /
  --input-schema-file ./samples/todo.schema.graphql \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name TodoExample \
  --create-update-aws-pipeline-neptune-endpoint (empty Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

유틸리티는 `TodoExample.source.graphql`이라는 출력 폴더에 새 파일을 생성하고 AppSync에 GraphQL API를 생성합니다. 이 유틸리티는 다음 내용을 추론합니다.
+ Todo 유형에는 새 CommentEdge 유형에 대한 `@relationship`이 추가되었습니다. 이렇게 하면 해석기가 CommentEdge라는 그래프 데이터베이스 엣지를 사용하여 Todo를 설명에 연결하도록 지시합니다.
+ 쿼리와 변형을 돕기 위해 TodoInput이라는 새로운 입력이 추가되었습니다.
+ 각 유형(Todo, Comment)에 대해 두 개의 쿼리(Todo, Comment)가 추가되었습니다. 하나는 입력에 나열된 유형 필드 중 하나 또는 `id`를 사용하여 단일 유형을 검색하는 것이고, 다른 하나는 해당 유형의 입력을 사용하여 필터링된 여러 값을 검색하는 것입니다.
+ 각 유형에는 생성, 업데이트, 삭제라는 세 가지 변형이 추가되었습니다. 삭제할 유형은 해당 유형의 `id` 또는 입력을 사용하여 지정됩니다. 이러한 변형은 Neptune 데이터베이스에 저장된 데이터에 영향을 미칩니다.
+ 연결과 삭제라는 두 가지 연결 변형이 추가되었습니다. Neptune에서 사용하는 시작 및 끝 버텍스의 노드 ID를 입력으로 사용하며 연결은 데이터베이스의 엣지입니다.

해석기는 쿼리와 변형을 이름으로 인식하지만 [아래](tools.md)와 같이 사용자 지정할 수도 있습니다.

`TodoExample.source.graphql` 파일 내용은 다음과 같습니다.

```
type Todo {
  _id: ID! @id
  name: String
  description: String
  priority: Int
  status: String
  comments(filter: CommentInput, options: Options): [Comment] @relationship(type: "CommentEdge", direction: OUT)
  bestComment: Comment @relationship(type: "CommentEdge", direction: OUT)
  commentEdge: CommentEdge
}

type Comment {
  _id: ID! @id
  content: String
}

input Options {
  limit: Int
}

input TodoInput {
  _id: ID @id
  name: String
  description: String
  priority: Int
  status: String
}

type CommentEdge {
  _id: ID! @id
}

input CommentInput {
  _id: ID @id
  content: String
}

input Options {
  limit: Int
}

type Query {
  getNodeTodo(filter: TodoInput, options: Options): Todo
  getNodeTodos(filter: TodoInput): [Todo]
  getNodeComment(filter: CommentInput, options: Options): Comment
  getNodeComments(filter: CommentInput): [Comment]
}

type Mutation {
  createNodeTodo(input: TodoInput!): Todo
  updateNodeTodo(input: TodoInput!): Todo
  deleteNodeTodo(_id: ID!): Boolean
  connectNodeTodoToNodeCommentEdgeCommentEdge(from_id: ID!, to_id: ID!): CommentEdge
  deleteEdgeCommentEdgeFromTodoToComment(from_id: ID!, to_id: ID!): Boolean
  createNodeComment(input: CommentInput!): Comment
  updateNodeComment(input: CommentInput!): Comment
  deleteNodeComment(_id: ID!): Boolean
}

schema {
  query: Query
  mutation: Mutation
}
```

이제 데이터를 만들고 쿼리할 수 있습니다. 다음은 새 GraphQL API를 테스트하는 데 사용된 AppSync **쿼리** 콘솔의 스냅샷입니다. 이 경우 `TodoExampleAPI` 이름이 지정되었습니다. 탐색기의 창 가운데에는 쿼리를 선택할 수 있는 쿼리 및 변형 목록, 입력 파라미터 및 반환 필드가 표시됩니다. 이 스크린샷은 `createNodeTodo` 변형을 사용하여 Todo 노드 유형을 생성하는 모습을 보여 줍니다.

![\[Todo 노드를 생성하는 AppSync 쿼리 콘솔을 보여 주는 스크린샷\]](http://docs.aws.amazon.com/ko_kr/neptune/latest/userguide/images/todoCreate.png)


이 스크린샷은 `getNodeTodos` 쿼리를 사용하여 모든 Todo 노드를 쿼리하는 모습을 보여 줍니다.

![\[Todo 노드를 쿼리하는 AppSync 쿼리 콘솔을 보여 주는 스크린샷\]](http://docs.aws.amazon.com/ko_kr/neptune/latest/userguide/images/todoGetTodos.png)


`createNodeComment`를 사용하여 설명을 생성한 후 `connectNodeTodoToNodeCommentEdgeCommentEdge` 변형을 사용하고 ID를 지정하여 설명과 연결할 수 있습니다. 다음은 Todo와 연결된 설명을 검색하는 중첩 쿼리입니다.

![\[AppSync 쿼리 콘솔에서 Todo와 연결된 설명을 검색하는 중첩된 쿼리를 보여 주는 스크린샷\]](http://docs.aws.amazon.com/ko_kr/neptune/latest/userguide/images/todoNestedQuery.png)


[지시문으로 작업](tools-graphql-schema-with-directives.md)에 설명된 대로 `TodoExample.source.graphql` 파일을 변경하려면 편집된 스키마를 입력으로 사용하고 유틸리티를 다시 실행하면 됩니다. 그러면 유틸리티에서 GraphQL API가 그에 따라 수정됩니다.

# GraphQL 스키마용 지시문으로 작업
<a name="tools-graphql-schema-with-directives"></a>

다음과 같은 명령을 사용하여 이미 지시문이 있는 GraphQL 스키마에서 시작할 수 있습니다.

```
neptune-for-graphql \
  --input-schema-file (your GraphQL schema file with directives) \
  --create-update-aws-pipeline \
  --create-update-aws-pipeline-name (name for your new GraphQL API) \
  --create-update-aws-pipeline-neptune-endpoint  (empty Neptune database endpoint):(port number) \
  --output-resolver-query-https
```

유틸리티에서 생성한 지시문을 수정하거나 GraphQL 스키마에 자체 지시문을 추가할 수 있습니다. 지시문으로 작업하는 몇 가지 방법은 다음과 같습니다.

## 변형이 생성되지 않도록 유틸리티 실행
<a name="tools-graphql-no-mutations"></a>

GraphQL API에서 유틸리티가 변형을 생성하지 않도록 하려면 `neptune-for-graphql` 명령의 `--output-schema-no-mutations` 옵션을 사용합니다.

## `@alias` 지시문
<a name="tools-graphql-alias-directive"></a>

이 `@alias` 지시문은 GraphQL 스키마 유형 또는 필드에 적용할 수 있습니다. 그래프 데이터베이스와 GraphQL 스키마 간에 서로 다른 이름을 매핑합니다. 구문은 다음과 같습니다.

```
@alias(property: (property name))
```

아래 `airport` 예시는 `Airport` GraphQL 유형에 매핑된 그래프 데이터베이스 노드 레이블이고, `desc`는 `description` 필드에 매핑된 그래프 노드 속성입니다([항공 경로 예제](tools-graphql.md) 참조).

```
type Airport @alias(property: "airport") {
  city: String
  description: String @alias(property: "desc")
}
```

표준 GraphQL 형식을 지정하려면 파스칼 표기법 유형 이름과 카멜 표기법 필드 이름을 사용합니다.

## `@relationship` 지시문
<a name="tools-graphql-relationship-directive"></a>

이 `@relationship` 지시문은 중첩된 GraphQL 유형을 그래프 데이터베이스 엣지에 매핑합니다. 구문은 다음과 같습니다.

```
@relationship(edgeType: (edge name), direction: (IN or OUT))
```

다음은 명령 예제입니다.

```
type Airport @alias(property: "airport") {
  ...
  continentContainsIn: Continent @relationship(edgeType: "contains", direction: IN)
  countryContainsIn: Country @relationship(edgeType: "contains", direction: IN)
  airportRoutesOut(filter: AirportInput, options: Options): [Airport] @relationship(edgeType: "route", direction: OUT)
  airportRoutesIn(filter: AirportInput, options: Options): [Airport] @relationship(edgeType: "route", direction: IN)
}
```

[Todo 예제](tools-graphql-start-from-schema.md#tools-graphql-todo-example)와 [항공 노선 예제](tools-graphql.md) 모두에서 `@relationship` 지시문을 확인할 수 있습니다.

## `@graphQuery` 및 `@cypher` 지시문
<a name="tools-graphql-graphquery-cypher-directives"></a>

openCypher 쿼리를 정의하여 필드 값을 해결하거나 쿼리를 추가하거나 변형을 추가할 수 있습니다. 예를 들어 이렇게 하면 `Airport` 유형에 새 `outboundRoutesCount` 필드가 추가되어 아웃바운드 경로를 계산할 수 있습니다.

```
type Airport @alias(property: "airport") {
  ...
  outboundRoutesCount: Int @graphQuery(statement: "MATCH (this)-[r:route]->(a) RETURN count(r)")
}
```

다음은 새 쿼리 및 변형의 예시입니다.

```
type Query {
  getAirportConnection(fromCode: String!, toCode: String!): Airport \
    @cypher(statement: \
      "MATCH (:airport{code: '$fromCode'})-[:route]->(this:airport)-[:route]->(:airport{code:'$toCode'})")
}

type Mutation {
  createAirport(input: AirportInput!): Airport @graphQuery(statement: "CREATE (this:airport {$input}) RETURN this")
  addRoute(fromAirportCode:String, toAirportCode:String, dist:Int): Route \
    @graphQuery(statement: \
     "MATCH (from:airport{code:'$fromAirportCode'}), (to:airport{code:'$toAirportCode'}) \
      CREATE (from)-[this:route{dist:$dist}]->(to) \
      RETURN this")
}
```

참고로 `RETURN`을 생략하면 해석기는 `this` 키워드를 반환 범위로 간주합니다.

Gremlin 쿼리를 사용하여 다음과 같이 쿼리 또는 변형을 추가할 수도 있습니다.

```
type Query {
  getAirportWithGremlin(code:String): Airport \
    @graphQuery(statement: "g.V().has('airport', 'code', '$code').elementMap()")  # single node
  getAirportsWithGremlin: [Airport] \
    @graphQuery(statement: "g.V().hasLabel('airport').elementMap().fold()")       # list of nodes
  getCountriesCount: Int \
    @graphQuery(statement: "g.V().hasLabel('country').count()")                   # scalar
}
```

현재 Gremlin 쿼리는 스칼라 값을 반환하거나 단일 노드의 `elementMap()` 또는 노드 목록의 `elementMap().fold()`를 반환하는 쿼리로 제한됩니다.

## `@id` 지시문
<a name="tools-graphql-id-directive"></a>

`@id` 지시문은 `id` 그래프 데이터베이스 엔터티에 매핑된 필드를 식별합니다. Amazon Neptune과 같은 그래프 데이터베이스에는 대량 가져오기 중에 할당되거나 자동 생성되는 노드 및 엣지의 고유한 `id`가 항상 포함되어 있습니다. 예제:

```
type Airport {
  _id: ID! @id
  city: String
  code: String
}
```

## 예약 유형, 쿼리 및 변형 이름
<a name="tools-graphql-reserved-names"></a>

이 유틸리티는 쿼리와 변형을 자동으로 생성하여 작동하는 GraphQL API를 생성합니다. 이러한 이름의 패턴은 해석기에서 인식되며 예약됩니다. 유형 `Airport` 및 연결 유형 `Route`의 예는 다음과 같습니다.

`Options` 유형이 예약되어 있습니다.

```
input Options {
  limit: Int
}
```

`filter` 및 `options` 함수 파라미터가 예약되어 있습니다.

```
type Query {
  getNodeAirports(filter: AirportInput, options: Options): [Airport]
}
```

쿼리 이름의 getNode 접두사는 예약되고 `createNode`, `updateNode`, `deleteNode`, `connectNode`, `deleteNode`, `updateEdge`, `deleteEdge`와 같은 변형 이름의 접두사가 예약됩니다.

```
type Query {
  getNodeAirport(id: ID, filter: AirportInput): Airport
  getNodeAirports(filter: AirportInput): [Airport]
}

type Mutation {
  createNodeAirport(input: AirportInput!): Airport
  updateNodeAirport(id: ID!, input: AirportInput!): Airport
  deleteNodeAirport(id: ID!): Boolean
  connectNodeAirportToNodeAirportEdgeRout(from: ID!, to: ID!, edge: RouteInput!): Route
  updateEdgeRouteFromAirportToAirport(from: ID!, to: ID!, edge: RouteInput!): Route
  deleteEdgeRouteFromAirportToAirport(from: ID!, to: ID!): Boolean
}
```

## GraphQL 스키마에 변경 사항 적용
<a name="tools-graphql-apply-schema-changes"></a>

GraphQL 소스 스키마를 수정하고 유틸리티를 다시 실행하여 Neptune 데이터베이스에서 최신 스키마를 가져올 수 있습니다. 유틸리티는 데이터베이스에서 새 스키마를 발견할 때마다 새 GraphQL 스키마를 생성합니다.

GraphQL 소스 스키마를 수동으로 편집하고 Neptune 데이터베이스 엔드포인트 대신 소스 스키마를 입력으로 사용하여 유틸리티를 다시 실행할 수도 있습니다.

마지막으로 다음 JSON 형식을 사용하여 파일에 변경 내용을 넣을 수 있습니다.

```
[
  {
    "type": "(GraphQL type name)",
    "field": "(GraphQL field name)",
    "action": "(remove or add)",
    "value": "(value)"
  }
]
```

예제:

```
[
  {
    "type": "Airport",
    "field": "outboundRoutesCountAdd",
    "action": "add",
    "value":"outboundRoutesCountAdd: Int @graphQuery(statement: \"MATCH (this)-[r:route]->(a) RETURN count(r)\")"
  },
  {
    "type": "Mutation",
    "field": "deleteNodeVersion",
    "action": "remove",
    "value": ""
  },
  {
    "type": "Mutation",
    "field": "createNodeVersion",
    "action": "remove",
    "value": ""
  }
]
```

그런 다음 명령의 `--input-schema-changes-file` 파라미터를 사용하여 이 파일에서 유틸리티를 실행하면 유틸리티가 변경 내용을 한 번에 적용합니다.

# GraphQL 유틸리티의 명령줄 인수
<a name="tools-graphql-cmd-line-args"></a>
+ **`--help, -h`** - GraphQL 유틸리티의 도움말 텍스트를 콘솔에 반환합니다.

   
+ **`--input-schema (schema text)`** - 입력으로 사용할 GraphQL 스키마(지시문 포함 또는 제외)입니다.

   
+ **`--input-schema-file (file URL)`** - 입력으로 사용할 GraphQL 스키마가 포함된 파일의 URL입니다.

   
+ **`--input-schema-changes-file (file URL)`** - GraphQL 스키마에 적용하려는 변경 사항이 포함된 파일의 URL입니다. Neptune 데이터베이스에 대해 유틸리티를 여러 번 실행하고 GraphQL 소스 스키마를 수동으로 변경하는 경우(예: 사용자 지정 쿼리 추가) 수동 변경 내용이 손실됩니다. 이를 방지하려면 변경 내용을 변경 파일에 넣고 이 인수를 사용하여 전달합니다.

  변경 파일은 다음 JSON 형식을 사용합니다.

  ```
  [
    {
      "type": "(GraphQL type name)",
      "field": "(GraphQL field name)",
      "action": "(remove or add)",
      "value": "(value)"
    }
  ]
  ```

  자세한 내용은 [Todo 예제](tools-graphql-start-from-schema.md#tools-graphql-todo-example)를 참조하세요.

   
+ **`--input-graphdb-schema (schema text)`** - Neptune 데이터베이스에 대해 유틸리티를 실행하는 대신 graphdb 스키마를 텍스트 형식으로 표현하여 입력으로 사용할 수 있습니다. graphdb 스키마의 JSON 형식은 다음과 같습니다.

  ```
  {
    "nodeStructures": [
      { "label":"nodelabel1",
        "properties": [
          { "name":"name1", "type":"type1" }
        ]
      },
      { "label":"nodelabel2",
        "properties": [
            { "name":"name2", "type":"type1" }
        ]
      }
    ],
    "edgeStructures": [
      {
        "label":"label1",
        "directions": [
          { "from":"nodelabel1", "to":"nodelabel2", "relationship":"ONE-ONE|ONE-MANY|MANY-MANY"  }
        ],
        "properties": [
          { "name":"name1", "type":"type1" }
        ]
      }
    ]
  }
  ```

   
+ **`--input-graphdb-schema-file (file URL)`** - Neptune 데이터베이스에 대해 유틸리티를 실행하는 대신 graphdb 스키마를 파일에 저장하여 입력으로 사용할 수 있습니다. graphdb 스키마 파일의 JSON 형식 예제는 위의 `--input-graphdb-schema`에서 참조하세요.

   
+ **`--input-graphdb-schema-neptune-endpoint (endpoint URL)`** - 유틸리티가 graphdb 스키마를 추출해야 하는 Neptune 데이터베이스 엔드포인트입니다.

   
+ **`--output-schema-file (file name)`** - GraphQL 스키마의 출력 파일 이름입니다. `--create-update-aws-pipeline-name`을 사용하여 파이프라인 이름을 설정하지 않은 경우 기본값은 `output.schema.graphql`입니다. 이 경우 기본 파일 이름은 `(pipline name).schema.graphql`입니다.

   
+ **`--output-source-schema-file (file name)`** - 지시문 포함 GraphQL 스키마의 출력 파일 이름입니다. `--create-update-aws-pipeline-name`을 사용하여 파이프라인 이름을 설정하지 않은 경우 기본값은 `output.source.schema.graphql`입니다. 이 경우 기본 이름은 `(pipeline name).source.schema.graphql`입니다.

   
+ **`--output-schema-no-mutations`** - 이 인수가 있는 경우 유틸리티는 GraphQL API에서 변형을 생성하지 않고 쿼리만 생성합니다.

   
+ **`--output-neptune-schema-file (file name)`** - 유틸리티가 검색하는 Neptune graphdb 스키마의 출력 파일 이름입니다. `--create-update-aws-pipeline-name`을 사용하여 파이프라인 이름을 설정하지 않은 경우 기본값은 `output.graphdb.json`입니다. 이 경우 기본 파일 이름은 `(pipeline name).graphdb.json`입니다.

   
+ **`--output-js-resolver-file (file name)`** - 해석기 코드 사본의 출력 파일 이름입니다. `--create-update-aws-pipeline-name`을 사용하여 파이프라인 이름을 설정하지 않은 경우 기본값은 `output.resolver.graphql.js`입니다. 이 경우 파일 이름은 `(pipeline name).resolver.graphql.js`입니다.

  이 파일은 해석기를 실행하는 Lambda 함수에 업로드된 코드 패키지에 압축되어 있습니다.

   
+ **`--output-resolver-query-sdk`** - 이 인수는 유틸리티의 Lambda 함수가 Neptune [엔진 버전 1.2.1.0.R5](engine-releases-1.2.1.0.R5.md)(기본값)부터 사용할 수 있는 Neptune 데이터 SDK를 사용하여 Neptune을 쿼리하도록 지정합니다. 하지만 유틸리티가 이전 버전의 Neptune 엔진을 감지하면 `--output-resolver-query-https` 인수를 사용하여 호출할 수 있는 HTTPS Lambda 옵션을 대신 사용하는 것이 좋습니다.

   
+ **`--output-resolver-query-https`** - 이 인수는 유틸리티의 Lambda 함수가 Neptune HTTPS API를 사용하여 Neptune을 쿼리하도록 지정합니다.

  

   
+ **`--create-update-aws-pipeline`**   -이 인수는 AppSync GraphQL API 및 해석기를 실행하는 Lambda를 포함하여 사용할 GraphQL API에 대한 AWS 리소스 생성을 트리거합니다.

   
+ **`--create-update-aws-pipeline-name (pipeline name)`** - 이 인수는 AppSync용 `pipeline-name` API 또는 Lambda 함수의 `pipeline-name` 함수와 같은 파이프라인의 이름을 설정합니다. 이름이 지정되지 않은 경우 `--create-update-aws-pipeline`은 `Neptune ` 데이터베이스 이름을 사용합니다.
+ **`--create-update-aws-pipeline-region (AWS region)`**   -이 인수는 GraphQL API의 파이프라인이 생성되는 AWS 리전을 설정합니다. 지정하지 않을 경우 기본 리전은 `us-east-1` 또는 데이터베이스 엔드포인트에서 추출한 Neptune 데이터베이스가 위치한 리전 중에 선택됩니다.
+ **`--create-update-aws-pipeline-neptune-endpoint (endpoint URL)`** - 이 인수는 Lambda 함수가 데이터베이스를 쿼리하는 데 사용하는 Neptune 데이터베이스 엔드포인트를 설정합니다. 설정하지 않을 경우 `--input-graphdb-schema-neptune-endpoint`에서 설정된 엔드포인트가 사용됩니다.
+ **`--remove-aws-pipeline-name (pipeline name)`** - 이 인수는 `--create-update-aws-pipeline`을 사용하여 만든 파이프라인을 제거합니다. 제거할 리소스는 `(pipeline name).resources.json`이라는 파일에 나열되어 있습니다.
+ **`--output-aws-pipeline-cdk`** - 이 인수는 AppSync GraphQL API 및 해석기를 실행하는 Lambda 함수 등 GraphQL API에서 AWS 리소스를 생성하는 데 사용할 수 있는 CDK 파일 생성을 트리거합니다.
+ **`--output-aws-pipeline-cdk-neptume-endpoint (endpoint URL)`** - 이 인수는 Lambda 함수가 Neptune 데이터베이스를 쿼리하는 데 사용하는 Neptune 데이터베이스 엔드포인트를 설정합니다. 설정하지 않을 경우 `--input-graphdb-schema-neptune-endpoint`에서 설정된 엔드포인트가 사용됩니다.
+ **`--output-aws-pipeline-cdk-name (pipeline name)`** - 이 인수는 AppSync API의 파이프라인 이름과 사용할 Lambda 파이프라인 이름 함수를 설정합니다. 지정하지 않으면 `--create-update-aws-pipeline`은 Neptune 데이터베이스 이름을 사용합니다.
+ **`--output-aws-pipeline-cdk-region (AWS region)`**   -   GraphQL API의 파이프라인이 생성되는 AWS 리전을 설정합니다. 지정하지 않을 경우 기본 리전은 `us-east-1` 또는 데이터베이스 엔드포인트에서 추출한 Neptune 데이터베이스가 위치한 리전 중에 선택됩니다.
+ **`--output-aws-pipeline-cdk-file (file name)`** - 이는 CDK 파일 이름을 설정합니다. 설정하지 않은 경우 기본값은 `(pipeline name)-cdk.js`입니다.

# Nodestream
<a name="tools-Nodestream"></a>

 [Nodestream](https://nodestream-proj.github.io/docs/docs/intro/)은 의미론적 모델링 데이터를 그래프로 처리하기 위한 프레임워크입니다. 유연하고 확장 가능하도록 설계되어 데이터를 수집하고 그래프로 모델링하는 방법을 정의할 수 있습니다. 파이프라인 기반 접근 방식을 사용하여 데이터를 수집하고 처리하는 방법을 정의하고 스키마가 변경될 때 그래프를 업데이트하는 방법을 정의하는 방법을 제공합니다. 이 모든 작업은 yaml 형식의 간단하고 사람이 읽을 수 있는 구성 파일을 사용하여 수행됩니다. 이를 위해 Nodestream은 파이프라인, 추출기, 변환기, 필터, 인터프리터, 해석 및 마이그레이션을 비롯한 다양한 핵심 개념을 사용합니다.

 [Nodestream 0.12](https://nodestream-proj.github.io/docs/blog/2024/04/05/nodestream-0-12/)부터 Amazon Neptune은 [Neptune 데이터베이스와 Neptune Analytics](https://nodestream-proj.github.io/docs/docs/databases/neptune/) 모두에서 지원됩니다.

 Neptune에서 Nodestream을 구성하고 사용하는 방법에 대한 자세한 내용은 Nodestream 문서: [Amazon Neptune용 Nodestream 지원](https://nodestream-proj.github.io/docs/docs/databases/neptune/)을 참조하세요.

 Nodestream에서 Neptune은 현재 표준 ETL 파이프라인과 TTL(Time To Live) 파이프라인을 지원합니다. ETL 파이프라인을 통해 Neptune은 기존보다 훨씬 광범위한 데이터 소스와 형식에서 대량의 데이터를 Neptune으로 수집할 수 있게 되었습니다. 여기에는 다음이 포함됩니다.
+  [소프트웨어 재료표](https://nodestream-proj.github.io/docs/docs/official-plugins/sbom/) 
+  [CSV, JSON, JSONL, Parquet, txt 및 yaml을 포함한 파일](https://nodestream-proj.github.io/docs/docs/reference/extractors/) 
+  [Kafka](https://nodestream-proj.github.io/docs/docs/reference/extractors/#streamextractor) 
+  [Athena](https://nodestream-proj.github.io/docs/docs/reference/extractors/#athenaextractor): 
+  [REST API](https://nodestream-proj.github.io/docs/docs/reference/extractors/#simpleapiextractor) 

 Nodestream은 자격 증명이 올바르게 구성된 한 Amazon Neptune에 연결할 때 IAM 인증을 완전히 지원합니다. 자격 증명을 올바르게 구성하는 방법에 대한 자세한 내용은 [boto3 자격 증명 가이드](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials)를 참조하세요.

 또한 [Nodestream의 TTL 메커니즘은](https://nodestream-proj.github.io/docs/docs/tutorials-intermediate/removing-data/) 이전에 Neptune에서 사용할 수 없었던 새로운 기능을 활성화합니다. Nodestream은 수집된 그래프 요소에 타임스탬프를 주석 처리함으로써, 설정된 수명 주기를 초과한 데이터를 자동으로 만료 및 제거하는 파이프라인을 생성할 수 있습니다.