Exemplo n.º 1
0
  private Index<Vertex> getOrCreateValuesIndex(final IndexableGraph graph) {
    for (Index<? extends Element> index : graph.getIndices()) {
      if (index.getIndexName().equals(VALUES)) {
        return (Index<Vertex>) index;
      }
    }

    Set<String> keys = new HashSet<String>();
    keys.add(VALUE);
    return graph.createAutomaticIndex(VALUES, Vertex.class, keys);
  }
 public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) {
   final Index<T> index = rawGraph.getIndex(indexName, indexClass);
   if (null == index) return null;
   else {
     if (index.getIndexType().equals(Index.Type.MANUAL)) {
       return new PartitionIndex<T>(index, this);
     } else {
       return new PartitionAutomaticIndex<T>((AutomaticIndex<T>) index, this);
     }
   }
 }
Exemplo n.º 3
0
 public Vertex getReferenceVertex() {
   // System.out.println("value = " + value);
   CloseableSequence<Vertex> i = values.get(VALUE, NAMESPACES_VERTEX_ID);
   try {
     return i.hasNext() ? i.next() : null;
   } finally {
     i.close();
   }
 }
Exemplo n.º 4
0
    public Vertex findVertex(final Value value) {
      CloseableSequence<Vertex> i = values.get(VALUE, value.stringValue());
      try {
        while (i.hasNext()) {
          Vertex v = i.next();

          if (matches(v, value)) {
            return v;
          }
        }

        return null;
      } finally {
        i.close();
      }
    }