0

How can I represent the OrientDB SQL query

traverse out(vertex_item) from #12:3 while $depth <= 4

in a native Java query? I.e. I'm looking for a query utilizing the Native Fluent API, with its OTraverse objects.

4

1 回答 1

1

不幸的是,在 OrientDB 1.4 中引入的最新更改尚未更新 OTraverse 类。所以你必须表达整个字段名称:

for (OIdentifiable id : new OTraverse().field("out_vertex_item")target(new ORecordId("#12:3")
                         .predicate(new OCommandPredicate() {
  public Object evaluate(ORecord<?> iRecord, ODocument iCurrentResult, OCommandContext iContext) {
    return ((Integer) iContext.getVariable("depth")) <= 4;
  }
})) {
  // DO SOMETHING WITH "id" VARIABLE
  ODocument record = id.getRecord();
}
于 2013-09-09T15:11:03.893 回答