e = noTx.createEdgeType(label); if ((includeIn || includeInOut) && e.getProperty("in") == null) { e.createProperty("in", OType.LINK); if ((includeOut || includeInOut) && e.getProperty("out") == null) { e.createProperty("out", OType.LINK); if (e.getProperty(key) == null) { e.createProperty(key, OType.STRING); if (includeInOut && e.getClassIndex(name) == null) { e.createIndex(name, OClass.INDEX_TYPE.NOTUNIQUE, new String[] { "in", "out" }); if (includeOut && e.getClassIndex(name) == null) { e.createIndex(name, OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX, new String[] { "out" }); if (includeIn && e.getClassIndex(name) == null) { e.createIndex(name, OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX, new String[] { "in" }); if (extraFields.length != 0 && e.getClassIndex(name) == null) { e.createIndex(name, OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, extraFields);
/** * Returns the persistent class for type iTypeName as OrientEdgeType instance. * * @param iTypeName Edge class name */ public OrientEdgeType getEdgeType(final String iTypeName) { makeActive(); final OClass cls = getRawGraph().getMetadata().getSchema().getClass(iTypeName); if (cls == null) return null; OrientEdgeType.checkType(cls); return new OrientEdgeType(this, cls); }
/** * (Internal) Returns the case sensitive edge class names. */ public static void getEdgeClassNames(final OrientBaseGraph graph, final String... iLabels) { if (iLabels != null && graph != null && graph.isUseClassForEdgeLabel()) { for (int i = 0; i < iLabels.length; ++i) { final OrientEdgeType edgeType = graph.getEdgeType(iLabels[i]); if (edgeType != null) // OVERWRITE CLASS NAME BECAUSE ATTRIBUTES ARE CASE SENSITIVE iLabels[i] = edgeType.getName(); } } }
+ superClazzOfEdge.getSimpleName() + "} was not yet added to orientdb."); e.setSuperClass(superType); if (e.getProperty(key) == null) { e.createProperty(key, OType.STRING);
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Object call(final OrientBaseGraph g) { OrientVertexType v = g.getVertexBaseType(); if(!v.existsProperty(NODE_ID)) { // TODO fix schema detection hack later v.createProperty(NODE_ID, OType.INTEGER); g.createKeyIndex(NODE_ID, Vertex.class, new Parameter("type", "UNIQUE_HASH_INDEX"), new Parameter( "keytype", "INTEGER")); v.createEdgeProperty(Direction.OUT, SIMILAR, OType.LINKBAG); v.createEdgeProperty(Direction.IN, SIMILAR, OType.LINKBAG); OrientEdgeType similar = g.createEdgeType(SIMILAR); similar.createProperty("out", OType.LINK, v); similar.createProperty("in", OType.LINK, v); g.createKeyIndex(COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"), new Parameter("keytype", "INTEGER")); g.createKeyIndex(NODE_COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"), new Parameter("keytype", "INTEGER")); } return null; } });
/** * Returns the E persistent class as OrientEdgeType instance. */ public OrientEdgeType getEdgeBaseType() { makeActive(); return new OrientEdgeType(this); }
/** * Creates a new Edge persistent class specifying the super class. * * @param iClassName Edge class name * @param iSuperClass OClass Edge to extend * * @return OrientEdgeType instance representing the persistent class */ public OrientEdgeType createEdgeType(final String iClassName, final OClass iSuperClass) { makeActive(); OrientEdgeType.checkType(iSuperClass); return executeOutsideTx(new OCallable<OrientEdgeType, OrientBaseGraph>() { @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(), "'"); }
@Override public List<Object> edgeLookup(String edgeLabel, String indexPostfix, Object key) { OrientBaseGraph orientBaseGraph = unwrapCurrentGraph(); List<Object> ids = new ArrayList<>(); // Load the edge type in order to access the indices of the edge OrientEdgeType edgeType = orientBaseGraph.getEdgeType(edgeLabel); if (edgeType != null) { // Fetch the required index OIndex<?> index = edgeType.getClassIndex("e." + edgeLabel.toLowerCase() + "_" + indexPostfix); if (index != null) { // Iterate over the sb-tree index entries OIndexCursor cursor = index.iterateEntriesMajor(new OCompositeKey(key), true, false); while (cursor.hasNext()) { Entry<Object, OIdentifiable> entry = cursor.nextEntry(); if (entry != null) { OCompositeKey entryKey = (OCompositeKey) entry.getKey(); // The index returns all entries. We thus need to filter it manually if (entryKey.getKeys().get(1).equals(key)) { Object inId = entryKey.getKeys().get(0); // Only add the inbound vertex id to the list of ids ids.add(inId); } } else { break; } } } } return ids; }
if (edgeType != null) { for (String clsName : iClassNames) { if (edgeType.isSubClassOf(clsName)) return new OPair<Direction, String>(Direction.OUT, connClass); if (edgeType != null) { for (String clsName : iClassNames) { if (edgeType.isSubClassOf(clsName)) return new OPair<Direction, String>(Direction.IN, connClass);
public OrientMassiveInsertion(final String url) { super(GraphDatabaseType.ORIENT_DB, null /* resultsPath */); OGlobalConfiguration.ENVIRONMENT_CONCURRENT.setValue(false); OrientGraphNoTx transactionlessGraph = new OrientGraphNoTx(url); for (int i = 0; i < NUMBER_OF_ORIENT_CLUSTERS; ++i) { transactionlessGraph.getVertexBaseType().addCluster("v_" + i); transactionlessGraph.getEdgeBaseType().addCluster("e_" + i); } transactionlessGraph.shutdown(); graph = new OGraphBatchInsertBasic(url); graph.setAverageEdgeNumberPerNode(AVERAGE_NUMBER_OF_EDGES_PER_NODE); graph.setEstimatedEntries(ESTIMATED_ENTRIES); graph.setIdPropertyName("nodeId"); graph.begin(); }
@Override @Deprecated public OrientEdgeType getSuperClass() { return new OrientEdgeType(graph, super.getSuperClass()); }
/** * Creates a new Edge persistent class specifying the super class. * * @param iClassName Edge class name * @param iSuperClass OClass Edge to extend * @param clusters The number of clusters to create for the new class. By default the MINIMUMCLUSTERS database setting is used. * In v2.2 and later, the number of clusters are proportioned to the amount of cores found on the machine * * @return OrientEdgeType instance representing the persistent class */ public OrientEdgeType createEdgeType(final String iClassName, final OClass iSuperClass, final int clusters) { makeActive(); OrientEdgeType.checkType(iSuperClass); return executeOutsideTx(new OCallable<OrientEdgeType, OrientBaseGraph>() { @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 + ")"); }
if (e.getProperty(key) == null) { FieldType type = fields.get(key); OType otype = toType(type); OType osubType = toSubType(type); if (osubType != null) { e.createProperty(key, otype, osubType); } else { e.createProperty(key, otype); if (fields.size() != 0 && e.getClassIndex(name) == null) { String[] fieldArray = fields.keySet().stream().toArray(String[]::new); OIndex<?> idx = e.createIndex(name, unique ? OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.toString() : OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX.toString(), null, new ODocument().fields("ignoreNullValues", true), fieldArray);
@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 + ")");
else label = edgeType.getName();
@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(), "'");
else label = edgeType.getName();
public OrientEdgeType getType() { final OrientBaseGraph graph = getGraph(); return isLightweight() ? null : new OrientEdgeType(graph, ((ODocument) rawElement.getRecord()).getSchemaClass()); }