【问题标题】:Migrating from Titan to DataStax Enterprise Graph从 Titan 迁移到 DataStax Enterprise Graph
【发布时间】:2017-04-09 17:44:57
【问题描述】:

我正在从 Titan 迁移到 Datastax。我有一个包含大约 5000 万个节点的图表,由人员、地址、电话等组成

我想计算一个 Person 节点连接数(有多少人拥有相同的电话、地址等)。

在 Titan 中,我编写了一个遍历所有人员节点的 Hadoop 作业,并且我可以编写一个 gremlin 脚本来查看该特定节点有多少人拥有相同的电话

所以作为输入属性我有:

titan.hadoop.input.format=com.thinkaurelius.titan.hadoop.formats.hbase.TitanHBaseInputFormat
titan.hadoop.input.conf.storage.backend=hbase

对于查询过滤器,我只查询人员节点

titan.hadoop.graph.input.vertex-query-filter=v.query().has('type',Compare.EQUAL,'person')

并运行我使用的脚本

titan.hadoop.output.conf.script-file=scripts/calculate.groovy

这将为每个节点计算该人拥有的共享电话连接数。

object.phone_shared= object.as('x').out('person_phones').in('person_phones').except('x').count()

有没有办法在 Datastax 中编写这种脚本来检查人员节点。我看到 Datastax 使用 Spark 分析来计算节点,例如,

https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/graphAnalytics/northwindDemoGraphSnapshot.html

但我没有找到更多关于如何使用分析运行自定义脚本的文档

谢谢

【问题讨论】:

    标签: datastax titan datastax-enterprise-graph


    【解决方案1】:

    答案恰好在您链接的页面上。看起来它可能比你习惯使用 Titan 更容易一些。关键是在第 8 步,您将 Traversal 配置为使用预配置的 OLAP/Analytics TraversalSource,名为 a(用于 Analytics)。

    1. 别名为 Northwind 分析 OLAP 遍历源的遍历 一种。一次性分析查询的 OLAP 遍历源的别名 g:

    gremlin> :remote config alias g northwind.a

    这基本上是说.. “当我在 TraversalSource g 上执行遍历时,我希望它在服务器上别名为 northwind.a”。

    执行此操作后,g 的所有遍历都将使用 northwind.a 执行,从而使用 Spark 分析引擎。

    【讨论】:

    • 感谢您的回答。我通过 OLAP 遍历得到了那个部分。我需要两件事。一种是计算共享连接,另一种是将其导出到文件中。您能否提供一个简单的示例,说明如何使用分析计算共享连接。谢谢
    • 我制作了这个脚本:gV().hasLabel('person').has('id',8438957).match( __.as("a").out('has_address ').in('has_address').count().as('address_count'), __.as("a").out('has_phone').in('has_phone').count().as( 'phone_count'), __.as("a").out('has_vin').in('has_vin').count().as('vin_count'), __.as("a").out( 'has_dl').in('has_dl').count().as('dl_count'), __.as("a").values("id").as("person_id"), ).select( "person_id","address_count", "phone_count", "dl_count", "vin_count") 但是这个在 alaytics 中不起作用
    • 您收到的错误是什么?这在 OLTP 模式下是否有效?
    • @jlacefie 这是我对此查询的错误 gV().hasLabel('person').match( __.as("a").out('has_address').in ('has_address').count().as('address_count')) .select("person_id","address_count") 本地遍历可能不会越过 GraphComputer 上的本地星图:[VertexStep(OUT, [has_address],vertex), VertexStep(IN,[has_address],vertex), CountGlobalStep]
    • @CristiC 你明白了吗?我遇到了同样的问题,想知道您是否找到了解决方案。谢谢!
    猜你喜欢
    • 2021-01-10
    • 1970-01-01
    • 2023-03-30
    • 2018-08-04
    • 2019-05-18
    • 2016-01-19
    • 1970-01-01
    • 2018-01-20
    • 1970-01-01
    相关资源
    最近更新 更多