내보내는 항목 필터링 예제 - Amazon Neptune

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

내보내는 항목 필터링 예제

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

속성 그래프 데이터 내보내기 필터링

scope를 사용하여 엣지만 내보내는 예제

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

nodeLabelsedgeLabels를 사용하여 특정 레이블이 있는 노드와 엣지만 내보내는 예제

다음 예제의 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를 사용하여 지정된 노드, 엣지 및 속성만 내보내는 예제

이 예제의 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를 사용하는 예제

이 예제에서는 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를 사용하는 예제

이 예제에서는 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 를 사용하는 예제

이 예제에서는 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 결합

이 예제의 filter 객체는 다음을 내보냅니다.

  • type, code, desc 속성이 있는 country 노드

  • code, icao, runways 속성이 있는 airport 노드

  • dist 속성이 있는 route 엣지

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

nodeLabelsedgeLabels 파라미터는 출력을 추가로 제한하여 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 데이터 내보내기 필터링

rdfExportScopesparql을 사용하여 특정 엣지 내보내기

이 예제에서는 조건자가 <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 데 사용

이 예제는 명명된 그래프에 속하는 트리플을 내보냅니다. < 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" }