I'm trying to load a tinkerpop db saved using TinkerGraph.FileType.GRAPHML type.
This is my code:
public Graph getDatabase(String path) {
org.apache.commons.configuration.Configuration conf = new BaseConfiguration();
conf.setProperty("blueprints.tg.directory", path);
conf.setProperty("blueprints.tg.file-type", "GRAPHML");
conf.setProperty("blueprints.graph", "com.tinkerpop.blueprints.impls.tg.TinkerGraph");
return GraphFactory.open(conf);
}
This code give me a java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [com.tinkerpop.blueprints.impls.tg.TinkerGraph].
The cause is a number format exception
Caused by: java.lang.NumberFormatException: For input string: "2306416072"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:495)
at java.lang.Integer.valueOf(Integer.java:582)
at com.tinkerpop.blueprints.util.io.graphml.GraphMLReader.typeCastValue(GraphMLReader.java:313)
at com.tinkerpop.blueprints.util.io.graphml.GraphMLReader.inputGraph(GraphMLReader.java:252)
at com.tinkerpop.blueprints.util.io.graphml.GraphMLReader.inputGraph(GraphMLReader.java:116)
at com.tinkerpop.blueprints.impls.tg.TinkerStorageFactory$GraphMLTinkerStorage.loadGraphData(TinkerStorageFactory.java:187)
at com.tinkerpop.blueprints.impls.tg.TinkerStorageFactory$AbstractSeparateTinkerStorage.load(TinkerStorageFactory.java:94)
at com.tinkerpop.blueprints.impls.tg.TinkerGraph.init(TinkerGraph.java:134)
... 51 more
I searched "2306416072" in the xml file (database). It's a property id <-data key="user_id"->2306416072<-/data->
don't know why i'm getting a number format exception. I navigate in the class GraphMLReader and this is the method
private static Object typeCastValue(String key, String value, Map<String, String> keyTypes) {
String type = keyTypes.get(key);
if (null == type || type.equals(GraphMLTokens.STRING))
return value;
else if (type.equals(GraphMLTokens.FLOAT))
return Float.valueOf(value);
else if (type.equals(GraphMLTokens.INT))
return Integer.valueOf(value);
else if (type.equals(GraphMLTokens.DOUBLE))
return Double.valueOf(value);
else if (type.equals(GraphMLTokens.BOOLEAN))
return Boolean.valueOf(value);
else if (type.equals(GraphMLTokens.LONG))
return Long.valueOf(value);
else
return value;
}