Gremlin queries on indexes

726 views
Skip to first unread message

Razvan Tanase

unread,
May 2, 2012, 3:15:09 AM5/2/12
to OrientDB
Hi,

I'm facing some weird behavior with Orient Db version 1.0 Rc9. I
ingested some data in the graph database using the Tinkerpop API. I've
also created some manual indexes during the ingestion, indexes that I
can see they exist in the console if I run "indexes" command.

When I try to run some queries using any of the indexes, from the
Gremlin console, I get a null value, making me believe that the index
is not found.

For example, g.idx('Dictionary') returns null

I tried to connect to the graph, in the gremlin console, either as
remote or local connection, still the same issue.

Am I missing something ?

Thanks,
Razvan

Salvatore Piccione

unread,
May 2, 2012, 4:32:32 AM5/2/12
to orient-...@googlegroups.com
Hello,

did you define the indexes through Blueprints API (see https://github.com/tinkerpop/blueprints/wiki/Graph-Indices)? Native OrientDB indices cannot be accessed by Gremlin...

HTH,

Salvatore

2012/5/2 Razvan Tanase <razvan...@gmail.com>

Razvan Tanase

unread,
May 2, 2012, 11:37:48 AM5/2/12
to OrientDB, Razvan Tanase
Hi Salvatore,

Yes, I did define the indices through Blueprints API, specifically
with createManualIndex() function.

Thanks,
Razvan

On May 2, 1:32 am, Salvatore Piccione <salvo.pi...@gmail.com> wrote:
> Hello,
>
> did you define the indexes through Blueprints API (seehttps://github.com/tinkerpop/blueprints/wiki/Graph-Indices)?Native
> OrientDB indices cannot be accessed by Gremlin...
>
> HTH,
>
> Salvatore
>
> 2012/5/2 Razvan Tanase <razvan.geo...@gmail.com>

Salvatore Piccione

unread,
May 3, 2012, 3:57:50 AM5/3/12
to orient-...@googlegroups.com
Indeed it works for me (OrientDB server 1.0 rc9 runs on a 64bit JDK 1.0.6_21 deployed on a Win Server 2008 R2 64bit).

This is how I declare the manual index

IndexableGraph graph = new OrientGraph("remote:myOrientDBHost:2425/manual-idx-test");
Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
bidx.put((String) firstIndexKey.getProperty("name"), firstIndexedItem.getId(), firstIndexKey);
bidx.put((String) secondIndexKey.getProperty("name"), secondIndexKey.getId(), secondIndexKey);
graph.shutdown();

Then, this is what I get from Gremlin:
gremlin> g = new OrientGraph('remote:localhost:2425/manual-idx-test')
==>orientgraph[remote:localhost:2425/manual-idx-test]
gremlin> g.idx('justAtest-idxb')
==>MANUAL[justAtest-idxb:OrientVertex]

HTH,

Salvatore

2012/5/2 Razvan Tanase <razvan...@gmail.com>

Razvan Tanase

unread,
May 4, 2012, 1:28:32 AM5/4/12
to OrientDB
Hi Salvatore,

I'm still getting the same error. I redeployed the OrientDB database,
rerun the ingestion script and still the same issue.
Compared to your code, I'm using the local engine for connecting to
OrientDb
< graphDb = new OrientGraph("local:C:/graphdatabases/orient/databases/
movies", "admin", "admin") >

this is the way I create the manual index
< movieIdIndex = graphDb.createManualIndex("movieIdIndex",
Vertex.class); > (the same way as you do)

Gremlin & Console screenshot:
http://tinypic.com/r/2rbyuqf/6

Thanks,
Razvan

On May 3, 12:57 am, Salvatore Piccione <salvo.pi...@gmail.com> wrote:
> Indeed it works for me (OrientDB server 1.0 rc9 runs on a 64bit JDK
> 1.0.6_21 deployed on a Win Server 2008 R2 64bit).
>
> This is how I declare the manual index
>
> IndexableGraph graph = new OrientGraph("remote:myOrientDBHost:2425
> /manual-idx-test");
> Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
> bidx.put((String) firstIndexKey.getProperty("name"),
> firstIndexedItem.getId(), firstIndexKey);
> bidx.put((String) secondIndexKey.getProperty("name"),
> secondIndexKey.getId(), secondIndexKey);
> graph.shutdown();
>
> Then, this is what I get from Gremlin:
> gremlin> g = new OrientGraph('remote:localhost:2425/manual-idx-test')
> ==>orientgraph[remote:localhost:2425/manual-idx-test]
> gremlin> g.idx('justAtest-idxb')
> ==>MANUAL[justAtest-idxb:OrientVertex]
>
> HTH,
>
> Salvatore
>
> 2012/5/2 Razvan Tanase <razvan.geo...@gmail.com>
>
>
>
>
>
>
>
> > Hi Salvatore,
>
> > Yes, I did define the indices through Blueprints API, specifically
> > with createManualIndex() function.
>
> > Thanks,
> > Razvan
>
> > On May 2, 1:32 am, Salvatore Piccione <salvo.pi...@gmail.com> wrote:
> > > Hello,
>
> > > did you define the indexes through Blueprints API (seehttps://
> > github.com/tinkerpop/blueprints/wiki/Graph-Indices)?Native<http://github.com/tinkerpop/blueprints/wiki/Graph-Indices%29?Native>

Salvatore Piccione

unread,
May 4, 2012, 4:06:02 AM5/4/12
to orient-...@googlegroups.com
Hello,

I created the index by locally connecting to the OrientGraph:
IndexableGraph graph = new OrientGraph("local:D:\\orientdb-graphed-1.0rc9\\databases\\manual-idx-test");

Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
bidx.put((String) firstIndexKey.getProperty("name"), firstIndexedItem.getId(), firstIndexKey);
bidx.put((String) secondIndexKey.getProperty("name"), secondIndexKey.getId(), secondIndexKey);
graph.shutdown();

Case 1A: the Gremlin console connects locally to the OrientGraph, db and index defined using a local connection (SUCCESS)
gremlin> g = new OrientGraph('local:D:\\orientdb-graphed-1.0rc9\\databases\\manual-idx-test')
==>orientgraph[local:D:/orientdb-graphed-1.0rc9/databases/manual-idx-test]

gremlin> g.idx('justAtest-idxb')
==>MANUAL[justAtest-idxb:OrientVertex]

Case 1B: the Gremlin console connects remotely to the OrientGraph, db and index defined using a local connection (FAILURE)
gremlin> g = new OrientGraph('remote:localhost/manual-idx-test')
==>orientgraph[remote:localhost/manual-idx-test]
gremlin> g.idx('justAtest-idxb')
==>null

So I was able to reproduce your test case, Razvan!

Double check: creating the index by connecting remotely to the OrientGraph.

IndexableGraph graph = new OrientGraph("remote:localhost/manual-idx-test-remote");

Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
bidx.put((String) firstIndexKey.getProperty("name"), firstIndexedItem.getId(), firstIndexKey);
bidx.put((String) secondIndexKey.getProperty("name"), secondIndexKey.getId(), secondIndexKey);
graph.shutdown();

Case 2A: the Gremlin console locally connects to the OrientGraph, db and index defined using a remote connection (FAILURE)
gremlin> g = new OrientGraph('local:.\\databases\\manual-idx-test-remote')
==>orientgraph[local:./databases/manual-idx-test-remote]
gremlin> g.idx('justAtest-idxb')
==>null

Case 2B: the Gremlin console remotely connects to the OrientGraph, db and index defined using a remote connection (SUCCESS)
gremlin> g = new OrientGraph('remote:localhost/manual-idx-test-remote')
==>orientgraph[remote:localhost/manual-idx-test-remote]

gremlin> g.idx('justAtest-idxb')
==>MANUAL[justAtest-idxb:OrientVertex]

It seems that, using Blueprints API, indices can be accessed only through the same connection mode that was used for the index definition... Do you agree Razvan? Do you define and try to access the index using the same connection mode?

Regards,

Salvatore


2012/5/4 Razvan Tanase <razvan...@gmail.com>

Razvan Tanase

unread,
May 4, 2012, 12:41:26 PM5/4/12
to OrientDB
Hi Salvatore,

You are right, if I try to connect to from gremlin using the local
connection(the same that I used for ingestion) it works. If I try to
switch the ingestion to use the remote engine, I get the following
exception : "Error on opening database: the engine 'remote' was not
found. URL was: remote:localhost/movies. Registered engines are:
[local, memory] ". That's why I used the local engine for ingestion.

Also, from the web interface of OrientDb, I believe the connection to
the DB is always made using the remote engine, because it is not able
to find my defined indexes.

I'll try to find some documentation on how to register the remote
engine for using it during ingestion.

Thanks a lot for investigating this issue,
Razvan

On May 4, 1:06 am, Salvatore Piccione <salvo.pi...@gmail.com> wrote:
> Hello,
>
> I created the index by locally connecting to the OrientGraph:
> IndexableGraph graph = new OrientGraph("*
> local:D:\\orientdb-graphed-1.0rc9\\databases\\manual-idx-test*");
> Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
> bidx.put((String) firstIndexKey.getProperty("name"),
> firstIndexedItem.getId(), firstIndexKey);
> bidx.put((String) secondIndexKey.getProperty("name"),
> secondIndexKey.getId(), secondIndexKey);
> graph.shutdown();
>
> *Case 1A: the Gremlin console connects locally to the OrientGraph, db and
> index defined using a local connection (SUCCESS)*
> gremlin> g = new
> OrientGraph('local:D:\\orientdb-graphed-1.0rc9\\databases\\manual-idx-test' )
> ==>orientgraph[local:D:/orientdb-graphed-1.0rc9/databases/manual-idx-test]
> gremlin> g.idx('justAtest-idxb')
> ==>MANUAL[justAtest-idxb:OrientVertex]
>
> *Case 1B: the Gremlin console connects remotely to the OrientGraph**, db
> and index defined using a local connection** (FAILURE)*
> gremlin> g = new OrientGraph('remote:localhost/manual-idx-test')
> ==>orientgraph[remote:localhost/manual-idx-test]
> gremlin> g.idx('justAtest-idxb')
> ==>null
>
> So I was able to reproduce your test case, Razvan!
>
> Double check: creating the index by connecting remotely to the OrientGraph.
>
> IndexableGraph graph = new OrientGraph("*remote:localhost****/manual-**
> idx-test-remote*");
> Index<Vertex> bidx = graph.createManualIndex("simpleIdx", Vertex.class);
> bidx.put((String) firstIndexKey.getProperty("name"),
> firstIndexedItem.getId(), firstIndexKey);
> bidx.put((String) secondIndexKey.getProperty("name"),
> secondIndexKey.getId(), secondIndexKey);
> graph.shutdown();
>
> *Case 2A: the Gremlin console **locally **connects to the OrientGraph,** db*
> * **and **index defined using a remote connection (FAILURE)*
> gremlin> g = new OrientGraph('local:.\\databases\\manual-idx-test-remote')
> ==>orientgraph[local:./databases/manual-idx-test-remote]
> gremlin> g.idx('justAtest-idxb')
> ==>null
>
> *Case 2B: the Gremlin console **remotely **connects to the OrientGraph, **db
> ** **and **index defined using a remote connection (SUCCESS)*
> gremlin> g = new OrientGraph('remote:localhost/manual-idx-test-remote')
> ==>orientgraph[remote:localhost/manual-idx-test-remote]
> gremlin> g.idx('justAtest-idxb')
> ==>MANUAL[justAtest-idxb:OrientVertex]
>
> It seems that, using Blueprints API, indices can be accessed only through
> the same connection mode that was used for the index definition... Do you
> agree Razvan? Do you define and try to access the index using the same
> connection mode?
>
> Regards,
>
> Salvatore
>
> 2012/5/4 Razvan Tanase <razvan.geo...@gmail.com>
Reply all
Reply to author
Forward
0 new messages