我正在尝试在titan中创建关系,并试图在创建时给出一个包含属性的数组。
while (startNode.hasNext())
{
Vertex tempVertex = startNode.next();
while (endNode.hasNext())
{
tempVertex.addEdge(storage.getId(), endNode.next(), keyValue);
}
}
但它在边缘创建上抛出了以下错误。
int i = 0;
for (Map.Entry<String, Object> entry : storage.getProperties().entrySet())
{
keyValue[i] = entry.getKey();
keyValue[i + 1] = entry.getValue();
i += 2;
}
通常情况下,地图应该在每个偶数索引处都有字符串。
java.lang.IllegalArgumentException: The provided key/value array must have a String or T on even array indices
at org.apache.tinkerpop.gremlin.structure.Element$Exceptions.providedKeyValuesMustHaveALegalKeyOnEvenIndices(Element.java:129)
at org.apache.tinkerpop.gremlin.structure.util.ElementHelper.legalPropertyKeyValueArray(ElementHelper.java:117)
at com.thinkaurelius.titan.graphdb.util.ElementHelper.attachProperties(ElementHelper.java:46)
at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.addEdge(AbstractVertex.java:151)
at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.addEdge(AbstractVertex.java:23)
at main.java.com.bag.server.database.TitanDatabaseAccess.applyCreate(TitanDatabaseAccess.java:469)
at main.java.com.bag.operations.CreateOperation.apply(CreateOperation.java:36)
at main.java.com.bag.server.TestServer.executeCommit(TestServer.java:190)
at main.java.com.bag.server.TestServer.appExecuteBatch(TestServer.java:138)
at bftsmart.tom.server.defaultservices.DefaultRecoverable.executeBatch(DefaultRecoverable.java:87)
at bftsmart.tom.server.defaultservices.DefaultRecoverable.executeBatch(DefaultRecoverable.java:68)
at bftsmart.tom.ServiceReplica.receiveMessages(ServiceReplica.java:432)
at bftsmart.tom.core.DeliveryThread.deliverMessages(DeliveryThread.java:293)
at bftsmart.tom.core.DeliveryThread.run(DeliveryThread.java:225)