Ich habe Probleme mit PartitionStrategy und titanDb und DynamoDb als Backend zu arbeiten. Ich benutze dynamoDb als lokales Backend mit dynamodb-titan-storage-backend plugin. Im Folgenden ist ein einfacher Test Fall, dass ich in Java geschrieben habe:PartitionStrategy mit titanDb und DynamoDb als Backend, das keine Ecke zum Graphen hinzufügt
import com.thinkaurelius.titan.core.TitanEdge;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanGraphQuery;
import com.thinkaurelius.titan.core.TitanTransaction;
import com.thinkaurelius.titan.core.TitanVertex;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Iterator;
public class TitanTest {
TitanGraph titanGraph;
@Before
public void setUp() {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("storage.backend", "com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager");
conf.setProperty("storage.dynamodb.client.endpoint", "http://localhost:4567");
titanGraph = TitanFactory.open(conf);
}
@Test
public void testAddVertexToTitanGraph(){
titanGraph.addVertex("name", "Bob", "age", "4.6x10^9");
titanGraph.traversal().V().forEachRemaining(it -> {
System.out.println("Found " + it.value("name"));
});
}
@Test
public void addVertexViaPartitionStrategy() {
PartitionStrategy partitionStrategy = PartitionStrategy.build().partitionKey("_partition").writePartition("a").addReadPartition("a").create();
GraphTraversalSource graphTraversalSource = GraphTraversalSource.build().with(partitionStrategy).create(titanGraph);
GraphTraversal<Vertex, Vertex> marko = graphTraversalSource.addV("name", "marko", "age", 29);
graphTraversalSource.V().forEachRemaining(it -> {
System.out.println("name:" + it.value("name").toString());
});
}
}
aber ich scheine nicht alles raus gedruckt, wenn ich den addVertexViaPartitionStrategy Testfall ausgeführt werden. Ich habe das Beispiel hier folgt: http://tinkerpop.apache.org/docs/3.0.1-incubating/#_partitionstrategy
Ich bin in der Lage auf die Datenbank zu lesen und zu schreiben, siehe Test testAddVertexToTitanGraph, nur nicht in der Lage einen Scheitelpunkt zu erstellen, wenn Partition stratergy verwenden.