private PropertyContainer getGraphProperties() { return ((GraphDatabaseAPI) this.rawGraph).getDependencyResolver().resolveDependency(NodeManager.class).getGraphProperties(); }
public long getTotalNumberOfNodes( GraphDatabaseService graphDb ) { if ( graphDb instanceof EmbeddedGraphDatabase ) { EmbeddedGraphDatabase embedded = ( EmbeddedGraphDatabase ) graphDb; return embedded.getConfig().getGraphDbModule().getNodeManager() .getNumberOfIdsInUse( Node.class ); } else { return -1; } } }
private static <T extends PropertyContainer> void populateKeyIndices(final GraphDatabaseService rawGraphDB, final AutoIndexer<T> rawAutoIndexer, final Iterable<T> rawElements, final Class elementClass) { if (!rawAutoIndexer.isEnabled()) return; final Set<String> properties = rawAutoIndexer.getAutoIndexedProperties(); Transaction tx = rawGraphDB.beginTx(); final PropertyContainer kernel = ((InternalAbstractGraphDatabase) rawGraphDB).getNodeManager().getGraphProperties(); kernel.setProperty(elementClass.getSimpleName() + INDEXED_KEYS_POSTFIX, properties.toArray(new String[properties.size()])); int count = 0; for (final PropertyContainer pc : rawElements) { for (final String property : properties) { if (!pc.hasProperty(property)) continue; pc.setProperty(property, pc.getProperty(property)); count++; if (count >= 10000) { count = 0; tx.success(); tx.finish(); tx = rawGraphDB.beginTx(); } } } tx.success(); tx.finish(); }
private static <T extends PropertyContainer> void populateKeyIndices(final GraphDatabaseService rawGraphDB, final AutoIndexer<T> rawAutoIndexer, final Iterable<T> rawElements, final Class elementClass) { if (!rawAutoIndexer.isEnabled()) return; final Set<String> properties = rawAutoIndexer.getAutoIndexedProperties(); Transaction tx = rawGraphDB.beginTx(); final PropertyContainer kernel = ((GraphDatabaseAPI) rawGraphDB).getDependencyResolver().resolveDependency(NodeManager.class).getGraphProperties(); kernel.setProperty(elementClass.getSimpleName() + INDEXED_KEYS_POSTFIX, properties.toArray(new String[properties.size()])); int count = 0; for (final PropertyContainer pc : rawElements) { for (final String property : properties) { if (!pc.hasProperty(property)) continue; pc.setProperty(property, pc.getProperty(property)); count++; if (count >= 10000) { count = 0; tx.success(); tx.finish(); tx = rawGraphDB.beginTx(); } } } tx.success(); tx.finish(); }