【问题标题】:How can I perform a wildcard search on a vertex property in titan graph DB?如何对泰坦图数据库中的顶点属性执行通配符搜索?
【发布时间】:2014-01-17 11:58:54
【问题描述】:

我正在使用 blueprints api 来查询 Titan 图形数据库。我处于需要对顶点属性执行通配符搜索的情况。有没有办法使用通配符查询具有属性的顶点?类似于关系数据库中的“PropertyName like '%asdf%'”。

【问题讨论】:

    标签: database graph elasticsearch titan


    【解决方案1】:

    您可以在此处了解如何进行基于字符串的搜索:

    https://github.com/thinkaurelius/titan/wiki/Full-Text-and-String-Search#string-search

    在您的情况下,您可能需要使用基于 Text.REGEX 的搜索,因为您想要评估字符串的两侧。您可以使用 Query API 使用 Blueprints API 执行此操作,如下所示:

    graph.query().has("name",Text.REGEX,".*asdf.*").vertices()
    

    【讨论】:

    • 什么是'.query()'和'.vertices()'?它们不在 Gremlin 文档中。
    • 这不是“Gremlin”——它是来自 Blueprints 的原始图形查询:tinkerpop.com/docs/javadocs/blueprints/2.6.0/com/tinkerpop/…
    • 5 年来有什么变化吗?或者这仅限于泰坦?我做错了什么,或者它不能与 tinkerpop3 + neo4j v3 一起工作............ gremlin_python.driver.protocol.GremlinServerError: 597: No such property: Text for class: Script16
    • TinkerPop 仍然不支持全文搜索
    【解决方案2】:

    在 Gremlin v2 中,我这样做:

    g.v.has('name',REGEX,'.*asdf.*').map
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-12
      • 1970-01-01
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多