

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

# 내보내는 항목 필터링 예제
<a name="export-filtering-examples"></a>

다음은 내보내는 데이터를 필터링하는 방법을 보여주는 예제입니다.

## 속성 그래프 데이터 내보내기 필터링
<a name="export-property-graph-filtering-examples"></a>

### `scope`를 사용하여 엣지만 내보내는 예제
<a name="export-property-graph-filtering-scope-example"></a>

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "scope": "edges"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `nodeLabels` 및 `edgeLabels`를 사용하여 특정 레이블이 있는 노드와 엣지만 내보내는 예제
<a name="export-property-graph-filtering-labels-example"></a>

다음 예제의 `nodeLabels` 파라미터는 `Person` 레이블 또는 `Post` 레이블이 있는 노드만 내보내도록 지정합니다. `edgeLabels` 파라미터는 `likes` 레이블이 있는 엣지만 내보내도록 지정합니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name}})",
    "nodeLabels": ["Person", "Post"],
    "edgeLabels": ["likes"]
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `filter`를 사용하여 지정된 노드, 엣지 및 속성만 내보내는 예제
<a name="export-property-graph-filtering-filter-example"></a>

이 예제의 `filter` 객체는 `type`, `code`, `desc` 속성이 있는 `country` 노드를 내보내고, `dist` 속성이 있는 `route` 엣지도 내보냅니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "filter": {
      "nodes": [
        {
          "label": "country",
          "properties": [
            "type",
            "code",
            "desc"
          ]
        }
      ],
      "edges": [
        {
          "label": "route",
          "properties": [
            "dist"
          ]
        }
      ]
    }
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `gremlinFilter`를 사용하는 예제
<a name="export-property-graph-filtering-gremlinFilter-example"></a>

이 예제에서는 `gremlinFilter`를 사용하여 2021-10-10 이후에 생성된, 다시 말해 `created` 속성 값이 2021-10-10보다 큰 노드와 엣지만 내보냅니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "gremlinFilter" : "has(\"created\", gt(datetime(\"2021-10-10\")))"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `gremlinNodeFilter`를 사용하는 예제
<a name="export-property-graph-filtering-gremlinNodeFilter-example"></a>

이 예제에서는 `gremlinNodeFilter`를 사용하여 삭제된 노드(값이 `true`인 부울 `deleted` 속성을 가진 노드)만 내보냅니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "gremlinNodeFilter" : "has(\"deleted\", true)"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `gremlinEdgeFilter`를 사용하는 예제
<a name="export-property-graph-filtering-gremlinEdgeFilter-example"></a>

이 예제에서는 `gremlinEdgeFilter `를 사용하여 값이 5인 `strength` 숫자 속성을 가진 엣지만 내보냅니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "gremlinEdgeFilter" : "has(\"strength\", 5)"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `filter`, `gremlinNodeFilter`, `nodeLabels`, `edgeLabels`, `scope` 결합
<a name="export-property-graph-filtering-combo-example"></a>

이 예제의 `filter` 객체는 다음을 내보냅니다.
+ `type`, `code`, `desc` 속성이 있는 `country` 노드
+ `code`, `icao`, `runways` 속성이 있는 `airport` 노드
+ `dist` 속성이 있는 `route` 엣지

`gremlinNodeFilter` 파라미터는 값이 A로 시작하는 `code` 속성을 가진 노드만 내보내도록 노드를 필터링합니다.

`nodeLabels` 및 `edgeLabels` 파라미터는 출력을 추가로 제한하여 `airport` 노드와 `route` 엣지만 내보내도록 합니다.

마지막으로 이 `scope` 파라미터는 내보내기에서 엣지를 제거하므로, 출력에는 지정된 `airport` 노드만 남습니다.

```
{
  "command": "export-pg",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "filter": {
      "nodes": [
        {
          "label": "airport",
          "properties": [
            "code",
            "icao",
            "runways"
          ]
        },
        {
          "label": "country",
          "properties": [
            "type",
            "code",
            "desc"
          ]
        }
      ],
      "edges": [
        {
          "label": "route",
          "properties": [
            "dist"
          ]
        }
      ]
    },
    "gremlinNodeFilter": "has(\"code\", startingWith(\"A\"))",
    "nodeLabels": [
      "airport"
    ],
    "edgeLabels": [
      "route"
    ],
    "scope": "nodes"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

## RDF 데이터 내보내기 필터링
<a name="export-RDF-filtering-examples"></a>

### `rdfExportScope` 및 `sparql`을 사용하여 특정 엣지 내보내기
<a name="export-RDF-filtering-rdfExportScope-sparql-example"></a>

이 예제에서는 조건자가 <http://kelvinlawrence.net/air-routes/objectProperty/route>이고 객체가 리터럴이 아닌 트리플을 내보냅니다.

```
{
  "command": "export-rdf",
  "params": {
    "endpoint": "{{(your Neptune endpoint DNS name)}}",
    "rdfExportScope": "query",
    "sparql": "CONSTRUCT { ?s <http://kelvinlawrence.net/air-routes/objectProperty/route> ?o } WHERE { ?s ?p ?o . FILTER(!isLiteral(?o)) }"
  },
  "outputS3Path": "s3://{{(your Amazon S3 bucket)}}/neptune-export"
}
```

### `namedGraph`를 사용하여 명명된 단일 그래프 내보내기
<a name="export-RDF-filtering-rdfExportScope-sparql-namedGraph-example"></a>

이 예제에서는 명명된 그래프 <http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph>에 속하는 트리플을 내보냅니다.

```
{
  "command": "export-rdf",
  "params": {
    "endpoint": "(your Neptune endpoint DNS name)",
    "rdfExportScope": "graph",
    "namedGraph": "http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph"
  },
  "outputS3Path": "s3://(your Amazon S3 bucket)/neptune-export"
}
```