本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
过滤导出内容的示例
以下示例说明了过滤导出数据的方法。
筛选属性图数据的导出
使用的示例scope
只导出边
{ "command": "export-pg", "params": { "endpoint": "
(your Neptune endpoint DNS name)
", "scope": "edges" }, "outputS3Path": "s3://(your Amazon S3 bucket)
/neptune-export" }
使用的示例nodeLabels
和edgeLabels
仅导出具有特定标签的节点和边
这些区域有: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
本示例中的对象导出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
此示例使用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
仅导出已删除的节点(带有布尔值的节点)deleted
价值为的财产true
):
{ "command": "export-pg", "params": { "endpoint": "
(your Neptune endpoint DNS name)
", "gremlinNodeFilter" : "has(\"deleted\", true)" }, "outputS3Path": "s3://(your Amazon S3 bucket)
/neptune-export" }
使用的示例gremlinEdgeFilter
此示例使用gremlinEdgeFilter
只导出带有strength
值为 5 的数字属性:
{ "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
本示例中的对象导出:
country
带有他们的节点type
、code
和desc
属性airport
带有他们的节点code
、icao
和runways
属性route
他们的边缘dist
属性
这些区域有:gremlinNodeFilter
参数过滤节点,以便只有具有code
其值以 A 开头的属性将被导出。
这些区域有: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 数据的导出
使用rdfExportScope
和sparql
以导出特定边
此示例导出了谓词为 < 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" }