Beispiel #1
0
 public void addRelationshipToIndex(
     String indexName, String key, String value, long relationshipId) {
   Index<Relationship> index = database.getRelationshipIndex(indexName);
   Transaction tx = database.graph.beginTx();
   try {
     index.add(database.graph.getRelationshipById(relationshipId), key, value);
     tx.success();
   } finally {
     tx.finish();
   }
 }
Beispiel #2
0
  public Collection<Long> getIndexedRelationships(String indexName, String key, Object value)
      throws DatabaseBlockedException {

    Index<Relationship> index = database.getRelationshipIndex(indexName);
    Transaction tx = database.graph.beginTx();
    try {
      Collection<Long> result = new ArrayList<Long>();
      for (Relationship relationship : index.get(key, value)) {
        result.add(relationship.getId());
      }
      tx.success();
      return result;
    } finally {
      tx.finish();
    }
  }