orientdborientdb-2.1orientdb2.2

Orientdb getVertices() returing Vertex for any label present in database


I am using Orientdb 2.2.10.

What I want to achieve?

I want to get a vertex of a particular vertexType - e.g vertexType = 'Person'.

My graphdb is indexed with unique key('uid').

What I am doing to achieve it?

what is problem with this method? :-

e.g:-

Is this a bug or I am doing something wrong?

Thanks..!


Solution

  • I replicated your structure.

    enter code here

    I have tried with this code

    String [] keys=new String[]{"uid"};
    String [] values=new String[]{"ram"};
    Iterable<Vertex> it= g.getVertices("Person", keys, values);
    for(Vertex v:it){
        System.out.println(v.getId());
        System.out.println(v.getProperty("uid"));
    }
    

    and I obtained

    #21:0 ram

    while with

    String [] keys=new String[]{"uid"};
    String [] values=new String[]{"ram"};
    Iterable<Vertex> it= g.getVertices("Relational", keys, values);
    for(Vertex v:it){
        System.out.println(v.getId());
        System.out.println(v.getProperty("uid"));
    }
    

    I got nothing.

    Hope it helps.