I have this two classes :
public interface Persona {
@Property("name")
public void setName(String name);
@Property("name")
public String getName();
@Property("surname")
public void setSurname(String surname);
@Property("surname")
public int getSurname();
@Property("age")
public void setAge(int age);
@Property("age")
public int getAge();
}
and
public interface Vettura {
@Property("name")
public void setName(String name);
@Property("name")
public String getName();
@Property("model")
public void setModel(String model);
@Property("model")
public int getModel();
@Adjacency(label = "follower", direction = Direction.IN)
public Iterable<Persona> getFollowers();
@Adjacency(label = "follower",direction = Direction.IN)
public void addFollower(Persona person);
}
i am trying (without success) to write a query that display the object "Vettura" only if the followers are more than 2.
how can i write it?
i wrote this one but it give to me all the objects without the filter i desire :
for (Vertex v : (Iterable<Vertex>) graph.command(
new OCommandSQL(" select name from Vettura where Vettura.in('follower').count > 1 IN Vettura.in('follower') ")).execute()) {
System.out.println("- Vettura: " + v.getVertices(Direction.BOTH, "name"));
}
thanks in advance and thanks for your attention.
Stefano
Try this one:
select from Vettura where inE('follower').size() > 1;