

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# エクスポートされるものをフィルタリングの例
<a name="export-filtering-examples"></a>

エクスポートされるデータをフィルタリングする方法の例を次に示します。

## property-graph データのエクスポートのフィルタリング
<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` オブジェクトは`country` ノードとそれらの `type`、`code`、`desc` プロパティ、および `route` エッジとその `dist` プロパティをエクスポートします。

```
{
  "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 より後に作成されたノードとエッジ (つまり、2021-10-10より大きい値を持つ `created` プロパティ) のみをエクスポートします。

```
{
  "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` オブジェクトは次をエクスポートします。
+ `country` ノードとそれらの `type`、`code`、`desc` プロパティ
+ `airport` ノードとそれらの `icao`、`code`、`runways` プロパティ
+ `route` エッジとその `dist` プロパティ

`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"
}
```