use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class AbstractServerClusterSQLGraphTest method onAfterDatabaseCreation.
@Override
protected void onAfterDatabaseCreation(final OrientBaseGraph graph) {
System.out.println("Creating graph schema...");
// CREATE BASIC SCHEMA
OrientVertexType personClass = graph.createVertexType("Person");
personClass.createProperty("id", OType.STRING);
personClass.createProperty("name", OType.STRING);
personClass.createProperty("birthday", OType.DATE);
personClass.createProperty("children", OType.STRING);
OrientVertexType person = graph.getVertexType("Person");
idx = person.createIndex("Person.name", OClass.INDEX_TYPE.UNIQUE, "name");
OrientVertexType customer = graph.createVertexType("Customer", person);
customer.createProperty("totalSold", OType.DECIMAL);
OrientVertexType provider = graph.createVertexType("Provider", person);
provider.createProperty("totalPurchased", OType.DECIMAL);
OrientEdgeType knows = graph.createEdgeType("Knows");
factory = new OrientGraphFactory(graph.getRawGraph().getURL(), "admin", "admin", false);
factory.setStandardElementConstraints(false);
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class GraphValidationTest method testValidationOnVertices.
@Test
public void testValidationOnVertices() {
OrientGraphNoTx g1 = new OrientGraphNoTx(URL, "admin", "admin");
try {
final OrientVertexType validationTestType = g1.createVertexType("ValidationTest");
validationTestType.createEdgeProperty(Direction.OUT, "Connection").setMandatory(true);
validationTestType.createEdgeProperty(Direction.IN, "Connection").setMandatory(true);
final OrientEdgeType connectionType = g1.createEdgeType("Connection");
connectionType.createProperty("in", OType.LINK, validationTestType).setMandatory(true);
connectionType.createProperty("out", OType.LINK, validationTestType).setMandatory(true);
} finally {
g1.shutdown();
}
OrientGraph g2 = new OrientGraph(URL, "admin", "admin");
try {
OrientVertex vertex1 = g2.addTemporaryVertex("ValidationTest");
OrientVertex vertex2 = g2.addTemporaryVertex("ValidationTest");
OrientVertex vertex3 = g2.addTemporaryVertex("ValidationTest");
OrientVertex vertex4 = g2.addTemporaryVertex("ValidationTest");
vertex1.addEdge("Connection", vertex2);
vertex2.addEdge("Connection", vertex3);
vertex3.addEdge("Connection", vertex4);
vertex4.addEdge("Connection", vertex1);
g2.commit();
} finally {
g2.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method initGraph.
private void initGraph() {
OrientBaseGraph graph = getGraph();
graph.setAutoStartTx(false);
graph.commit();
final OrientVertexType vertexType = graph.createVertexType("TestVertex");
vertexType.createProperty("uuid", OType.STRING);
vertexType.createIndex("TestVertexUuidIndex", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "uuid");
final OrientEdgeType edgeType = graph.createEdgeType("TestEdge");
edgeType.createProperty("uuid", OType.STRING);
edgeType.createIndex("TestEdgeUuidIndex", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "uuid");
graph.shutdown();
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class IndexAgainstEdges method indexes.
@Test
public void indexes() {
OrientGraph g = new OrientGraph(URL, "admin", "admin");
try {
if (g.getVertexType("Profile") == null)
g.createVertexType("Profile");
if (g.getEdgeType("Friend") == null) {
final OrientEdgeType f = g.createEdgeType("Friend");
f.createProperty("in", OType.LINK);
f.createProperty("out", OType.LINK);
f.createIndex("Friend.in_out", OClass.INDEX_TYPE.UNIQUE, "in", "out");
}
OrientVertex luca = g.addVertex("class:Profile", "name", "Luca");
OrientVertex jay = g.addVertex("class:Profile", "name", "Jay");
OrientEdge friend = (OrientEdge) luca.addEdge("Friend", jay);
assertFalse(friend.isLightweight());
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdgeType in project orientdb by orientechnologies.
the class OEdgeTransformerTest method setUp.
@Override
public void setUp() {
super.setUp();
final OrientVertexType v1 = graph.createVertexType("V1");
final OrientVertexType v2 = graph.createVertexType("V2");
final OrientEdgeType edgeType = graph.createEdgeType("Friend");
edgeType.createProperty("in", OType.LINK, v2);
edgeType.createProperty("out", OType.LINK, v1);
// ASSURE NOT DUPLICATES
edgeType.createIndex("out_in", OClass.INDEX_TYPE.UNIQUE, "in", "out");
graph.addVertex("class:V2").setProperty("name", "Luca");
graph.commit();
}
Aggregations