use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class SQLMoveVertexCommandTest method reinitEdgeType.
private OrientEdgeType reinitEdgeType(String className) {
OrientEdgeType clazz = graph.getEdgeType(className);
if (clazz != null) {
graph.command(new OCommandSQL("delete edge " + className)).execute();
graph.dropVertexType(className);
}
clazz = graph.createEdgeType(className);
return clazz;
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class IndexTest method testIndexEdgeComposite.
public void testIndexEdgeComposite() {
OrientGraph graphNoTx = new OrientGraph((ODatabaseDocumentTx) database.getUnderlying());
OrientVertexType vertexType = null;
if (!graphNoTx.getRawGraph().existsCluster("CustomVertex")) {
vertexType = graphNoTx.createVertexType("CustomVertex");
} else {
vertexType = graphNoTx.getVertexType("CustomVertex");
}
if (!graphNoTx.getRawGraph().existsCluster("CustomEdge")) {
OrientEdgeType edgeType = graphNoTx.createEdgeType("CustomEdge");
edgeType.createProperty("out", OType.LINK, vertexType);
edgeType.createProperty("in", OType.LINK, vertexType);
edgeType.createIndex("CustomEdge.in", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "in" });
edgeType.createIndex("CustomEdge.out", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "out" });
edgeType.createIndex("CustomEdge.compositeInOut", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "out", "in" });
}
// graphNoTx.shutdown();
OrientGraph graph = new OrientGraph((ODatabaseDocumentTx) database.getUnderlying());
Vertex inVert = null;
for (int i = 0; i < 5; ++i) {
Vertex currentVert = graph.addVertex("class:CustomVertex");
if (inVert != null) {
graph.addEdge("class:CustomEdge", currentVert, inVert, "CustomEdge");
}
inVert = currentVert;
}
graph.commit();
Iterable<Vertex> verts = graph.getVertices();
StringBuilder vertIds = new StringBuilder();
for (Vertex vert : verts) {
vertIds.append(vert.getId().toString()).append(" ");
}
System.out.println("Vertices: " + vertIds);
System.out.println();
checkIndexKeys(graph, "CustomEdge.in");
checkIndexKeys(graph, "CustomEdge.out");
checkIndexKeys(graph, "CustomEdge.compositeInOut");
}
Aggregations