com.tinkerpop.blueprints.Index Java Examples
The following examples show how to use
com.tinkerpop.blueprints.Index.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 6 votes |
@Override public void dropIndex(String indexName) { if (globals.getConfig().getIndexableGraphDisabled()) throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); for (Index<? extends Element> index : getIndices()) { if (index.getIndexName().equals(indexName)) { globals.getIndexMetadataWrapper().clearIndexNameEntry(indexName, index.getIndexClass()); try { globals.getConfig().getConnector().tableOperations().delete(globals.getConfig() .getNamedIndexTableName(indexName)); } catch (Exception e) { throw new AccumuloGraphException(e); } return; } } throw new AccumuloGraphException("Index does not exist: "+indexName); }
Example #2
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass, Parameter... indexParameters) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } for (Index<?> index : globals.getIndexMetadataWrapper().getIndices()) { if (index.getIndexName().equals(indexName)) { throw ExceptionFactory.indexAlreadyExists(indexName); } } return globals.getIndexMetadataWrapper().createIndex(indexName, indexClass); }
Example #3
Source File: IndexMetadataTableWrapper.java From AccumuloGraph with Apache License 2.0 | 6 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) public Iterable<Index<? extends Element>> getIndices() { List<Index<? extends Element>> indexes = new ArrayList<Index<? extends Element>>(); IndexedItemsListParser parser = new IndexedItemsListParser(); Scanner scan = null; try { scan = getScanner(); scan.fetchColumnFamily(new Text(IndexMetadataEntryType.__INDEX_NAME__.name())); for (IndexedItem item : parser.parse(scan)) { indexes.add(new AccumuloIndex(globals, item.getKey(), item.getElementClass())); } return indexes; } finally { if (scan != null) { scan.close(); } } }
Example #4
Source File: PartitionIndexIterable.java From org.openntf.domino with Apache License 2.0 | 6 votes |
public Iterator<Index<T>> iterator() { return new Iterator<Index<T>>() { private final Iterator<Index<T>> itty = iterable.iterator(); public void remove() { this.itty.remove(); } public boolean hasNext() { return this.itty.hasNext(); } public Index<T> next() { return new PartitionIndex<T>(this.itty.next(), graph); } }; }
Example #5
Source File: EventIndexIterable.java From org.openntf.domino with Apache License 2.0 | 6 votes |
public Iterator<Index<T>> iterator() { return new Iterator<Index<T>>() { private final Iterator<Index<T>> itty = iterable.iterator(); public void remove() { this.itty.remove(); } public Index<T> next() { return new EventIndex<T>(this.itty.next(), eventGraph); } public boolean hasNext() { return itty.hasNext(); } }; }
Example #6
Source File: ReadOnlyIndexIterable.java From org.openntf.domino with Apache License 2.0 | 6 votes |
public Iterator<Index<T>> iterator() { return new Iterator<Index<T>>() { private final Iterator<Index<T>> itty = iterable.iterator(); public void remove() { throw new UnsupportedOperationException(ReadOnlyTokens.MUTATE_ERROR_MESSAGE); } public Index<T> next() { return new ReadOnlyIndex<T>(this.itty.next()); } public boolean hasNext() { return this.itty.hasNext(); } }; }
Example #7
Source File: WrappedIndexIterable.java From org.openntf.domino with Apache License 2.0 | 6 votes |
public Iterator<Index<T>> iterator() { return new Iterator<Index<T>>() { private final Iterator<Index<T>> itty = iterable.iterator(); public void remove() { throw new UnsupportedOperationException(); } public boolean hasNext() { return this.itty.hasNext(); } public Index<T> next() { return new WrappedIndex<T>(this.itty.next()); } }; }
Example #8
Source File: ActiveVersionedIndexIterable.java From antiquity with GNU General Public License v3.0 | 6 votes |
@Override public Iterator<Index<T>> iterator() { return new Iterator<Index<T>>() { private final Iterator<Index<T>> itty = iterable.iterator(); @Override public void remove() { this.itty.remove(); } @Override public Index<T> next() { return new ActiveVersionedIndex<T, V>(this.itty.next(), graph); } @Override public boolean hasNext() { return itty.hasNext(); } }; }
Example #9
Source File: IdGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { verifyBaseGraphIsIndexableGraph(); return isVertexClass(indexClass) ? (Index<T>) new IdVertexIndex((Index<Vertex>) ((IndexableGraph) baseGraph).createIndex(indexName, indexClass, indexParameters), this) : (Index<T>) new IdEdgeIndex((Index<Edge>) ((IndexableGraph) baseGraph).createIndex(indexName, indexClass, indexParameters), this); }
Example #10
Source File: IdVertexIndex.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public IdVertexIndex(final Index<Vertex> baseIndex, final IdGraph idGraph) { if (null == baseIndex) { throw new IllegalArgumentException("null base index"); } this.idGraph = idGraph; this.baseIndex = baseIndex; }
Example #11
Source File: PartitionIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) { final Index<T> index = baseGraph.getIndex(indexName, indexClass); if (null == index) return null; else { return new PartitionIndex<T>(index, this); } }
Example #12
Source File: IdEdgeIndex.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public IdEdgeIndex(final Index<Edge> baseIndex, final IdGraph idGraph) { if (null == baseIndex) { throw new IllegalArgumentException("null base index"); } this.idGraph = idGraph; this.baseIndex = baseIndex; }
Example #13
Source File: EventIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) { final Index<T> index = this.baseGraph.getIndex(indexName, indexClass); if (null == index) return null; else return new EventIndex<T>(index, this); }
Example #14
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 5 votes |
@Override public <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } return globals.getIndexMetadataWrapper().getIndex(indexName, indexClass); }
Example #15
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 5 votes |
@Override public Iterable<Index<? extends Element>> getIndices() { if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } return globals.getIndexMetadataWrapper().getIndices(); }
Example #16
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 5 votes |
/** * Clear out this graph. This drops and recreates the backing tables. */ public void clear() { shutdown(); try { TableOperations tableOps = globals.getConfig() .getConnector().tableOperations(); for (Index<? extends Element> index : getIndices()) { tableOps.delete(((AccumuloIndex<? extends Element>) index).getTableName()); } for (String table : globals.getConfig().getTableNames()) { if (tableOps.exists(table)) { tableOps.delete(table); tableOps.create(table); SortedSet<Text> splits = globals.getConfig().getSplits(); if (splits != null) { tableOps.addSplits(table, splits); } } } } catch (Exception e) { throw new AccumuloGraphException(e); } }
Example #17
Source File: IndexableTransactionalVersionedGraphImpl.java From antiquity with GNU General Public License v3.0 | 5 votes |
@Override public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) { // final Index<T> index = getEventableGraph().getIndex(indexName, indexClass); // if (null == index) { // return null; // } else { // return new ActiveVersionedIndex<T, V>(index, this); // } throw new IllegalStateException("Currently not supported."); }
Example #18
Source File: IndexableTransactionalVersionedGraphImpl.java From antiquity with GNU General Public License v3.0 | 5 votes |
@Override public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { // return new ActiveVersionedIndex<T, V>(getEventableGraph().createIndex(indexName, indexClass, indexParameters), // this); throw new IllegalStateException("Currently not supported."); }
Example #19
Source File: IndexMetadataTableWrapper.java From AccumuloGraph with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass) { IndexedItemsListParser parser = new IndexedItemsListParser(); Scanner scan = null; try { scan = getScanner(); scan.fetchColumnFamily(new Text(IndexMetadataEntryType.__INDEX_NAME__.name())); for (IndexedItem item : parser.parse(scan)) { if (item.getKey().equals(indexName)) { if (item.getElementClass().equals(indexClass)) { return new AccumuloIndex<T>(globals, indexName, indexClass); } else { throw ExceptionFactory.indexDoesNotSupportClass(indexName, indexClass); } } } return null; } finally { if (scan != null) { scan.close(); } } }
Example #20
Source File: WrappedIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) { final Index<T> index = baseGraph.getIndex(indexName, indexClass); if (null == index) return null; else { return new WrappedIndex<T>(index); } }
Example #21
Source File: IndexMetadataTableWrapper.java From AccumuloGraph with Apache License 2.0 | 5 votes |
public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass) { for (Index<?> index : getIndices()) { if (index.getIndexName().equals(indexName)) { throw ExceptionFactory.indexAlreadyExists(indexName); } } writeIndexNameEntry(indexName, indexClass); return new AccumuloIndex<T>(globals, indexName, indexClass); }
Example #22
Source File: EventIndex.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public EventIndex(final Index<T> rawIndex, final EventGraph eventGraph) { this.rawIndex = rawIndex; this.eventGraph = eventGraph; }
Example #23
Source File: IndexElementsPipe.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public IndexElementsPipe(final Index<E> index, final String key, final Object value) { super.setStarts(index.get(key, value).iterator()); }
Example #24
Source File: IdGraph.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public Iterable<Index<? extends Element>> getIndices() { throw new UnsupportedOperationException("sorry, you currently can't get a list of indexes through IdGraph"); }
Example #25
Source File: EventIndexIterable.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public EventIndexIterable(final Iterable<Index<T>> iterable, final EventGraph eventGraph) { this.iterable = iterable; this.eventGraph = eventGraph; }
Example #26
Source File: EventIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { return new EventIndex<T>(this.getBaseGraph().createIndex(indexName, indexClass, indexParameters), this); }
Example #27
Source File: EventIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public Iterable<Index<? extends Element>> getIndices() { return new EventIndexIterable(this.baseGraph.getIndices(), this); }
Example #28
Source File: WrappedIndex.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public WrappedIndex(final Index<T> rawIndex) { this.rawIndex = rawIndex; }
Example #29
Source File: WrappedIndexIterable.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public WrappedIndexIterable(final Iterable<Index<T>> iterable) { this.iterable = iterable; }
Example #30
Source File: WrappedIndexableGraph.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { return new WrappedIndex<T>(baseGraph.createIndex(indexName, indexClass, indexParameters)); }