简体   繁体   English

如何在titan图DB中的顶点属性上执行通配符搜索?

[英]How can I perform a wildcard search on a vertex property in titan graph DB?

I am using blueprints api to query titan graph database. 我正在使用蓝图api来查询titan图数据库。 I am in a situation where I need to perform wild card search on a vertex property. 我处于需要在顶点属性上执行通配符搜索的情况。 Is there a way to query a vertex with its property with a wildcard? 有没有办法用带有通配符的属性查询顶点? something similar to "PropertyName like '%asdf%' " in relational database. 类似于关系数据库中的“PropertyName like'%asdf%'”。

You can read about how to do string-based searches here: 您可以在此处阅读有关如何进行基于字符串的搜索的信息:

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

In your case you would likely need to use a Text.REGEX based search as you want to evaluate both sides of the string. 在您的情况下,您可能需要使用基于Text.REGEX的搜索,因为您要评估字符串的两侧。 You would execute this with the Blueprints API using the Query API and would be something like: 您可以使用Query API使用Blueprints API执行此操作,并且类似于:

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

在Gremlin v2中我这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM