有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java OrientDB选择一个对象的名称,后跟2个以上的用户

我有两门课:

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();
}

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);
}

我正在尝试(没有成功)编写一个查询,仅当追随者超过2个时才显示对象“Vettura”

我怎么写呢

我写了这封信,但它给了我所有没有我想要的过滤器的东西:

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"));
}

提前感谢,感谢您的关注

斯特凡诺


共 (1) 个答案

  1. # 1 楼答案

    试试这个:

    select from Vettura where inE('follower').size() > 1;