Search in sources :

Example 11 with OrientVertexType

use of com.tinkerpop.blueprints.impls.orient.OrientVertexType 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();
    }
}
Also used : OrientEdgeType(com.tinkerpop.blueprints.impls.orient.OrientEdgeType) OrientGraph(com.tinkerpop.blueprints.impls.orient.OrientGraph) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) Test(org.junit.Test)

Example 12 with OrientVertexType

use of com.tinkerpop.blueprints.impls.orient.OrientVertexType 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();
}
Also used : OrientEdgeType(com.tinkerpop.blueprints.impls.orient.OrientEdgeType) OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph)

Example 13 with OrientVertexType

use of com.tinkerpop.blueprints.impls.orient.OrientVertexType in project orientdb by orientechnologies.

the class LuceneTransactionEmbeddedQueryTest method createSchema.

protected void createSchema(ODatabaseDocumentTx db) {
    final OrientVertexType c1 = new OrientGraphNoTx(db).createVertexType("C1");
    c1.createProperty("p1", OType.EMBEDDEDLIST, OType.STRING);
    c1.createIndex("C1.p1", "FULLTEXT", null, null, "LUCENE", new String[] { "p1" });
}
Also used : OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)

Example 14 with OrientVertexType

use of com.tinkerpop.blueprints.impls.orient.OrientVertexType in project orientdb by orientechnologies.

the class LuceneTransactionQueryTest method init.

@Before
public void init() {
    final OrientVertexType c1 = new OrientGraphNoTx(db).createVertexType("C1");
    c1.createProperty("p1", OType.STRING);
    c1.createIndex("C1.p1", "FULLTEXT", null, null, "LUCENE", new String[] { "p1" });
}
Also used : OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) Before(org.junit.Before)

Example 15 with OrientVertexType

use of com.tinkerpop.blueprints.impls.orient.OrientVertexType in project orientdb by orientechnologies.

the class LuceneInheritanceQueryTest method createSchema.

protected void createSchema(ODatabaseDocumentTx db) {
    final OrientVertexType c1 = new OrientGraphNoTx(db).createVertexType("C1");
    c1.createProperty("name", OType.STRING);
    c1.createIndex("C1.name", "FULLTEXT", null, null, "LUCENE", new String[] { "name" });
    final OrientVertexType c2 = new OrientGraphNoTx(db).createVertexType("C2");
    c2.setSuperClass(c1);
}
Also used : OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)

Aggregations

OrientVertexType (com.tinkerpop.blueprints.impls.orient.OrientVertexType)31 OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)17 OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)13 OrientGraph (com.tinkerpop.blueprints.impls.orient.OrientGraph)12 Test (org.junit.Test)9 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)8 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)5 OrientEdgeType (com.tinkerpop.blueprints.impls.orient.OrientEdgeType)5 Vertex (com.tinkerpop.blueprints.Vertex)4 OrientGraphFactory (com.tinkerpop.blueprints.impls.orient.OrientGraphFactory)4 Before (org.junit.Before)4 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)3 OrientBaseGraph (com.tinkerpop.blueprints.impls.orient.OrientBaseGraph)3 OValidationException (com.orientechnologies.orient.core.exception.OValidationException)2 ORecordId (com.orientechnologies.orient.core.id.ORecordId)2 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)2 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)2 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)1 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)1 ORID (com.orientechnologies.orient.core.id.ORID)1