使用 and/or 的多个过滤器的 TinkerPop 问题
TinkerPop problem with multiple filters using and/or
我过滤了多个属性并获取了一个节点,所以如果有多个 filter
加入了 and
和 or
。 2 工作正常,但从 3 号开始它似乎崩溃了。
下面是错误的简化演示。
和filter
gremlin> g.V().filter(has("name", "marko"))
==>v[1]
gremlin> g.V().filter(has("name", "marko")).and().filter(has("name", "marko"))
==>v[1]
gremlin> g.V().filter(has("name", "marko")).and().filter(has("name", "marko")).and().filter(has("name", "marko"))
java.util.ConcurrentModificationException
Type ':help' or ':h' for help.
Display stack trace? [yN]
没有filter
gremlin> g.V().has("name", "marko")
==>v[1]
gremlin> g.V().has("name", "marko").and().has("name", "marko")
==>v[1]
gremlin> g.V().has("name", "marko").and().has("name", "marko").and().has("name", "marko")
java.util.ConcurrentModificationException
Type ':help' or ':h' for help.
Display stack trace? [yN]
dummy-name
是不存在的东西。仍然因不同的错误而崩溃
gremlin> g.V().hasLabel("dummy-name").filter(has("name", "a").or().has("name", "b").or().has("name", "c"))
java.lang.ArrayIndexOutOfBoundsException
Type ':help' or ':h' for help.
Display stack trace? [yN]y
java.lang.ArrayIndexOutOfBoundsException
当连接到 NEO4J 并使用 filter
它抛出我
test_gremlin.py", line 49, in execut_final_query
results = future_results.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
f.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
self._protocol.data_received(data, self._results)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 106, in data_received
"{0}: {1}".format(status_code, data["status"]["message"]))
gremlin_python.driver.protocol.GremlinServerError: 597: None
我写错查询了吗?或者这是一个错误?
版本:Gremlin 3.3.1
我不知道为什么多个 and()
条件不能立即起作用,尽管我认为它们应该起作用,所以我为此在 JIRA 中创建了一个问题:TINKERPOP-2029
但这确实有效:
gremlin> g.V().and(filter(has("name", "marko")), filter(has("name", "marko")), filter(has("name", "marko")))
==>v[1]
或更简单地说:
gremlin> g.V().and(has("name", "marko"), has("name", "marko"), has("name", "marko"))
==>v[1]
在你对你写的问题的评论中,你真的想做 a
和 b
或 c
和 d
- 这似乎可以用这种方法:
gremlin> g.V().or(and(has('name','marko'),has('age',29)),and(has('name','josh'),has('age',32)))
==>v[1]
==>v[4]
或者在这种情况下更简单为:
gremlin> g.V().or(has('name','marko').has('age',29),has('name','josh').has('age',32))
==>v[1]
==>v[4]
我过滤了多个属性并获取了一个节点,所以如果有多个 filter
加入了 and
和 or
。 2 工作正常,但从 3 号开始它似乎崩溃了。
下面是错误的简化演示。
和filter
gremlin> g.V().filter(has("name", "marko"))
==>v[1]
gremlin> g.V().filter(has("name", "marko")).and().filter(has("name", "marko"))
==>v[1]
gremlin> g.V().filter(has("name", "marko")).and().filter(has("name", "marko")).and().filter(has("name", "marko"))
java.util.ConcurrentModificationException
Type ':help' or ':h' for help.
Display stack trace? [yN]
没有filter
gremlin> g.V().has("name", "marko")
==>v[1]
gremlin> g.V().has("name", "marko").and().has("name", "marko")
==>v[1]
gremlin> g.V().has("name", "marko").and().has("name", "marko").and().has("name", "marko")
java.util.ConcurrentModificationException
Type ':help' or ':h' for help.
Display stack trace? [yN]
dummy-name
是不存在的东西。仍然因不同的错误而崩溃
gremlin> g.V().hasLabel("dummy-name").filter(has("name", "a").or().has("name", "b").or().has("name", "c"))
java.lang.ArrayIndexOutOfBoundsException
Type ':help' or ':h' for help.
Display stack trace? [yN]y
java.lang.ArrayIndexOutOfBoundsException
当连接到 NEO4J 并使用 filter
它抛出我
test_gremlin.py", line 49, in execut_final_query
results = future_results.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
f.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
self._protocol.data_received(data, self._results)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 106, in data_received
"{0}: {1}".format(status_code, data["status"]["message"]))
gremlin_python.driver.protocol.GremlinServerError: 597: None
我写错查询了吗?或者这是一个错误?
版本:Gremlin 3.3.1
我不知道为什么多个 and()
条件不能立即起作用,尽管我认为它们应该起作用,所以我为此在 JIRA 中创建了一个问题:TINKERPOP-2029
但这确实有效:
gremlin> g.V().and(filter(has("name", "marko")), filter(has("name", "marko")), filter(has("name", "marko")))
==>v[1]
或更简单地说:
gremlin> g.V().and(has("name", "marko"), has("name", "marko"), has("name", "marko"))
==>v[1]
在你对你写的问题的评论中,你真的想做 a
和 b
或 c
和 d
- 这似乎可以用这种方法:
gremlin> g.V().or(and(has('name','marko'),has('age',29)),and(has('name','josh'),has('age',32)))
==>v[1]
==>v[4]
或者在这种情况下更简单为:
gremlin> g.V().or(has('name','marko').has('age',29),has('name','josh').has('age',32))
==>v[1]
==>v[4]