示例#1
0
  public Representation getAutoIndexedRelationships(String key, String value) {

    List<Representation> representations = new ArrayList<Representation>();
    ReadableRelationshipIndex index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex();

    Transaction tx = graphDb.beginTx();
    try {
      for (Relationship rel : index.get(key, value)) {
        representations.add(new RelationshipRepresentation(rel));
      }
      tx.success();
      return new ListRepresentation(RepresentationType.RELATIONSHIP, representations);
    } finally {
      tx.finish();
    }
  }
示例#2
0
  public ListRepresentation getAutoIndexedRelationshipsByQuery(String query) {
    ReadableRelationshipIndex index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex();
    List<Representation> representations = new ArrayList<Representation>();

    if (query != null) {
      Transaction tx = graphDb.beginTx();
      try {
        for (Relationship rel : index.query(query)) {
          representations.add(new RelationshipRepresentation(rel));
        }
        tx.success();
      } finally {
        tx.finish();
      }
    }
    return new ListRepresentation(RepresentationType.RELATIONSHIP, representations);
  }