public long countEdges(final String iClassName) { if (useLightweightEdges) throw new UnsupportedOperationException( "Graph set to use Lightweight Edges, count against edges is not supported"); return getRawGraph().countClass(iClassName); }
@Override public void declareIntent(final OIntent iIntent) { makeActive(); getRawGraph().declareIntent(iIntent); }
/** * Executes commands against the graph. Commands are executed outside * transaction. * * @param iCommand * Command request between SQL, GREMLIN and SCRIPT commands */ public OCommandRequest command(final OCommandRequest iCommand) { return new OrientGraphCommand(this, getRawGraph().command(iCommand)); }
/** * Returns the Graph URL. */ public String toString() { return StringFactory.graphString(this, getRawGraph().getURL()); }
/** * Counts the vertices in graph of a particular class. * * @return Long as number of total vertices */ public long countVertices(final String iClassName) { makeActive(); return getRawGraph().countClass(iClassName); }
/** * Counts the edges in graph of a particular class. Edge counting works only if useLightweightEdges is false. * * @return Long as number of total edges */ public long countEdges(final String iClassName) { makeActive(); if (isUseLightweightEdges()) throw new UnsupportedOperationException("Graph set to use Lightweight Edges, count against edges is not supported"); return getRawGraph().countClass(iClassName); }
public OrientClassVertexIterator(OrientBaseGraph graph, Iterator<Vertex> iterator, String klass) { this.iterator = iterator; this.graph = graph; this.klass = graph.getRawGraph().getMetadata().getSchema().getClass(klass); }
public Iterator<T> iterator() { final ODatabaseDocumentInternal rawGraph = this.graph.getRawGraph(); return new OrientElementIterator<T>(this.graph, new ORecordIteratorClass<ORecord>(rawGraph, elementClass, polymorphic)); }
protected OrientIndex(final OrientBaseGraph orientGraph, final OIndex<?> rawIndex) { this.graph = orientGraph; this.underlying = rawIndex instanceof OIndexTxAwareMultiValue ? rawIndex : new OIndexTxAwareMultiValue( orientGraph.getRawGraph(), (OIndex<Collection<OIdentifiable>>) rawIndex); load(rawIndex.getConfiguration()); }
public static GRAPH_CONSISTENCY_MODE getConsistencyMode(final OrientBaseGraph graph) { final String consistencyMode = graph.getRawGraph().getStorage().getConfiguration().getProperty("graphConsistencyMode"); if (consistencyMode == null) return GRAPH_CONSISTENCY_MODE.TX; return GRAPH_CONSISTENCY_MODE.valueOf(consistencyMode); }
@Override public OrientVertexType call(final OrientBaseGraph g) { return new OrientVertexType(g, getRawGraph().getMetadata().getSchema().createClass(iClassName, iSuperClass)); } }, "create vertex type '", iClassName, "' as subclass of '", iSuperClass.getName(), "'");
@Override public OrientEdgeType call(final OrientBaseGraph g) { return new OrientEdgeType(g, getRawGraph().getMetadata().getSchema().createClass(iClassName, clusters, iSuperClass)); } }, "create edge type '", iClassName, "' as subclass of '", iSuperClass.getName(), "' (clusters=" + clusters + ")");
@Override public OrientEdgeType call(final OrientBaseGraph g) { return new OrientEdgeType(g, getRawGraph().getMetadata().getSchema().createClass(iClassName, iSuperClass)); } }, "create edge type '", iClassName, "' as subclass of '", iSuperClass.getName(), "'");
public Iterator<T> iterator() { final ODatabaseDocumentTx rawGraph = this.graph.getRawGraph(); return new OrientElementIterator<T>(this.graph, new ORecordIteratorClass<ORecordInternal<?>>(rawGraph, (ODatabaseRecordAbstract) rawGraph.getUnderlying(), elementClass, polymorphic)); }
public OClass createVertexType(final String iClassName, final String iSuperClassName) { commitAnyActiveTx("create vertex type '" + iClassName + "' as subclass of '" + iSuperClassName + "'"); return getRawGraph().getMetadata().getSchema() .createClass(iClassName, getVertexType(iSuperClassName)); }
public <T extends Element> void dropKeyIndex(final String key, final Class<T> elementClass) { commitAnyActiveTx("drop key index"); final String className = getClassName(elementClass); getRawGraph().getMetadata().getIndexManager() .dropIndex(className + "." + key); }
/** * Returns the V persistent class as OrientVertexType instance. */ public OrientVertexType getVertexBaseType() { makeActive(); return new OrientVertexType(this, getRawGraph().getMetadata().getSchema().getClass(OrientVertexType.CLASS_NAME)); }
protected OrientIndex(final OrientBaseGraph orientGraph, final OIndex<?> rawIndex) { this.graph = orientGraph; this.underlying = rawIndex instanceof OIndexTxAwareMultiValue ? rawIndex : new OIndexTxAwareMultiValue( orientGraph.getRawGraph(), (OIndex<Collection<OIdentifiable>>) rawIndex); final ODocument metadata = rawIndex.getMetadata(); if (metadata == null) { load(rawIndex.getConfiguration()); } else load(metadata); }
public OClass createVertexType(final String iClassName) { commitAnyActiveTx("create vertex type '" + iClassName + "'"); return getRawGraph().getMetadata().getSchema() .createClass(iClassName, getVertexBaseType()); }
protected double getCustomHeuristicCost(final String functionName, final String[] vertextAxisNames, final OrientVertex start, final OrientVertex goal, final OrientVertex current, final OrientVertex parent, final long depth, double dFactor) { double heuristic = 0.0; OrientGraph ff; OFunction func = OrientGraph.getActiveGraph().getRawGraph().getMetadata().getFunctionLibrary().getFunction(functionName); Object fValue = func.executeInContext(context, vertextAxisNames, start, goal, current, parent, depth, dFactor); if (fValue != null && fValue instanceof Number) { heuristic = doubleOrDefault(fValue, heuristic); } return heuristic; }