orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mid traversals not using available index

misu200 opened this issue · comments

I am using OrientDB 3 RC1 (Gremlin+TInkerpop 3 community edition)

In the Tinkerpop 3 ref docs it says:
"Whether a mid-traversal V() uses an index or not, depends on a) whether suitable index exists and b) if the particular graph system provider implemented this functionality."

It seems OrientDB gremlin not implemented yet this functionality so for the following kind of query even if I have a UNIQUE_HASH_INDEX index on 'adresa' field from Adresa class..it will not be hit:

g.V().hasLabel("Firma").as("a").
V().hasLabel("Adresa").as("b").
where("a", eq("b")).by("adresa").
addE("Location").from("a").to("b")

Should I expect for this to work when OrientDB will be released for production use?
Or maybe should I try rewrite the query in some other way? ....or just use the OrientDB SQL?

Thanks,
Mihai

I ve made some progress rewriting the query to use sideEffect() :

g.V().hasLabel("Firma").sideEffect{ g.V().hasLabel("Adresa").has("adresa",it.get().property('adresa').value()).addE('Location').from(it.get()).next()
}

However after a few seconds OrientDB logs keep showing messages like :
"2018-02-04 00:39:11:369 WARNI {db=ter1050} This database instance has 1260 open command/query result sets, please make sure you close them with OResultSet.close()"

...and then the query suddenly stops before it finish to write all the edges.

It might be something wrong with my query because I am a Gremlin newbie.....or I hit another bug/limitation?

Hi @misu200

how are you executing this traversa?

g.V().hasLabel("Firma").as("a").
V().hasLabel("Adresa").as("b").
where("a", eq("b")).by("adresa").
addE("Location").from("a").to("b")

with the gremlin-console through the embedded gremlin-server?

Thanks

Hi @maggiolo00,

I ve tried it both ways:

  1. Run it in OrientDB Studio web interface
  2. Gremlin Console....something like this:
g = new OrientGraphFactory("plocal:databases/ter1050").getNoTx().traversal()
g.V().hasLabel("Firma").has("cui","33034700").as("a").V().hasLabel("Adresa").as("b").where("a",eq("b")).by("adresa").addE("Location").from("a").to("b").properties("tip","adresa_anaf")

It is hitting the index for first traversal filter ( has("cui","33034700") ) but for the mid-traversal is not hitting the index .

Thanks,

Hi @misu200

yes the index is used in first traversal index. I think mid-traversal is not supported yet.

Let me check for the logs that could be a bug

Thanks

Any idea when the midtraversal index could be in use? This is a pretty serious problem for myself