Search in sources :

Example 76 with TitanVertex

use of com.thinkaurelius.titan.core.TitanVertex in project titan by thinkaurelius.

the class CassandraScanJobIT method testPartitionedVertexScan.

@Test
public void testPartitionedVertexScan() throws Exception {
    tearDown();
    clearGraph(getConfiguration());
    WriteConfiguration partConf = getConfiguration();
    open(partConf);
    mgmt.makeVertexLabel("part").partition().make();
    finishSchema();
    TitanVertex supernode = graph.addVertex("part");
    for (int i = 0; i < 128; i++) {
        TitanVertex v = graph.addVertex("part");
        v.addEdge("default", supernode);
        if (0 < i && 0 == i % 4)
            graph.tx().commit();
    }
    graph.tx().commit();
    org.apache.hadoop.conf.Configuration c = new org.apache.hadoop.conf.Configuration();
    c.set(ConfigElement.getPath(TitanHadoopConfiguration.GRAPH_CONFIG_KEYS, true) + "." + "storage.cassandra.keyspace", getClass().getSimpleName());
    c.set(ConfigElement.getPath(TitanHadoopConfiguration.GRAPH_CONFIG_KEYS, true) + "." + "storage.backend", "cassandrathrift");
    c.set("cassandra.input.partitioner.class", "org.apache.cassandra.dht.Murmur3Partitioner");
    Job job = getVertexJobWithDefaultMapper(c);
    // Should throw an exception since filter-partitioned-vertices wasn't enabled
    assertFalse(job.waitForCompletion(true));
}
Also used : TitanVertex(com.thinkaurelius.titan.core.TitanVertex) GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration) TitanHadoopConfiguration(com.thinkaurelius.titan.hadoop.config.TitanHadoopConfiguration) ScanJob(com.thinkaurelius.titan.diskstorage.keycolumnvalue.scan.ScanJob) Job(org.apache.hadoop.mapreduce.Job) Test(org.junit.Test) TitanGraphBaseTest(com.thinkaurelius.titan.graphdb.TitanGraphBaseTest)

Example 77 with TitanVertex

use of com.thinkaurelius.titan.core.TitanVertex in project incubator-atlas by apache.

the class Titan0Vertex method getPropertyValues.

@Override
public <T> Collection<T> getPropertyValues(String key, Class<T> clazz) {
    TitanVertex tv = getAsTitanVertex();
    Collection<T> result = new ArrayList<>();
    for (TitanProperty property : tv.getProperties(key)) {
        result.add((T) property.getValue());
    }
    return result;
}
Also used : TitanVertex(com.thinkaurelius.titan.core.TitanVertex) ArrayList(java.util.ArrayList) TitanProperty(com.thinkaurelius.titan.core.TitanProperty)

Aggregations

TitanVertex (com.thinkaurelius.titan.core.TitanVertex)77 Test (org.junit.Test)63 PropertyKey (com.thinkaurelius.titan.core.PropertyKey)46 EdgeLabel (com.thinkaurelius.titan.core.EdgeLabel)21 TitanEdge (com.thinkaurelius.titan.core.TitanEdge)17 Edge (org.apache.tinkerpop.gremlin.structure.Edge)17 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)14 VertexLabel (com.thinkaurelius.titan.core.VertexLabel)12 TitanGraphIndex (com.thinkaurelius.titan.core.schema.TitanGraphIndex)12 TitanVertexProperty (com.thinkaurelius.titan.core.TitanVertexProperty)10 BaseVertexLabel (com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)10 TitanTransaction (com.thinkaurelius.titan.core.TitanTransaction)8 VertexProperty (org.apache.tinkerpop.gremlin.structure.VertexProperty)7 ElementCategory (com.thinkaurelius.titan.graphdb.internal.ElementCategory)4 Category (org.junit.experimental.categories.Category)4 SchemaViolationException (com.thinkaurelius.titan.core.SchemaViolationException)3 VertexList (com.thinkaurelius.titan.core.VertexList)3 RelationTypeIndex (com.thinkaurelius.titan.core.schema.RelationTypeIndex)3 TitanGraphBaseTest (com.thinkaurelius.titan.graphdb.TitanGraphBaseTest)3