/** * Reads the source vertex identifier from the json object. * * @param jsonEdge json string representation * @return source vertex identifier * @throws JSONException */ private GradoopId getSourceId(JSONObject jsonEdge) throws JSONException { return GradoopId.fromString(jsonEdge.getString(JSONConstants.EDGE_SOURCE)); }
/** * Reads the target vertex identifier from the json object. * * @param jsonEdge json string representation * @return target vertex identifier * @throws JSONException */ private GradoopId getTargetId(JSONObject jsonEdge) throws JSONException { return GradoopId.fromString(jsonEdge.getString(JSONConstants.EDGE_TARGET)); } }
/** * Reads the source vertex identifier from the json object. * * @param jsonEdge json string representation * @return source vertex identifier * @throws JSONException */ private GradoopId getSourceId(JSONObject jsonEdge) throws JSONException { return GradoopId.fromString(jsonEdge.getString(JSONConstants.EDGE_SOURCE)); }
/** * Reads the entity identifier from the json object. * * @param object json object * @return entity identifier * @throws JSONException */ protected GradoopId getID(JSONObject object) throws JSONException { return GradoopId.fromString(object.getString(JSONConstants.IDENTIFIER)); }
/** * Reads the target vertex identifier from the json object. * * @param jsonEdge json string representation * @return target vertex identifier * @throws JSONException */ private GradoopId getTargetId(JSONObject jsonEdge) throws JSONException { return GradoopId.fromString(jsonEdge.getString(JSONConstants.EDGE_TARGET)); } }
@Override public Edge map(String csvLine) { String[] tokens = split(csvLine, 5); return edgeFactory.initEdge(GradoopId.fromString(tokens[0]), tokens[3], GradoopId.fromString(tokens[1]), GradoopId.fromString(tokens[2]), parseProperties(MetaDataSource.EDGE_TYPE, tokens[3], tokens[4])); } }
@Override public Edge map(String csvLine) { String[] tokens = split(csvLine, 5); return edgeFactory.initEdge(GradoopId.fromString(tokens[0]), tokens[3], GradoopId.fromString(tokens[1]), GradoopId.fromString(tokens[2]), parseProperties(MetaDataSource.EDGE_TYPE, tokens[3], tokens[4])); } }
/** * Reads the entity identifier from the json object. * * @param object json object * @return entity identifier * @throws JSONException */ protected GradoopId getID(JSONObject object) throws JSONException { return GradoopId.fromString(object.getString(JSONConstants.IDENTIFIER)); }
@Override public Edge map(String csvLine) throws Exception { String[] tokens = split(csvLine, 6); String label = StringEscaper.unescape(tokens[4]); return edgeFactory.initEdge(GradoopId.fromString(tokens[0]), label, GradoopId.fromString(tokens[2]), GradoopId.fromString(tokens[3]), parseProperties(MetaDataSource.EDGE_TYPE, label, tokens[5]), parseGradoopIds(tokens[1])); } }
@Override public Edge map(String csvLine) throws Exception { String[] tokens = split(csvLine, 6); String label = StringEscaper.unescape(tokens[4]); return edgeFactory.initEdge(GradoopId.fromString(tokens[0]), label, GradoopId.fromString(tokens[2]), GradoopId.fromString(tokens[3]), parseProperties(MetaDataSource.EDGE_TYPE, label, tokens[5]), parseGradoopIds(tokens[1])); } }
@Nonnull @Override public Vertex fromRow(@Nonnull Map.Entry<Key, Value> pair) throws IOException { //map from serialize content Vertex content = KryoUtils.loads(pair.getValue().get(), Vertex.class); content.setId(GradoopId.fromString(pair.getKey().getRow().toString())); //read from content return content; }
@Nonnull @Override public Edge fromRow(@Nonnull Map.Entry<Key, Value> pair) throws IOException { //map from serialize content Edge content = KryoUtils.loads(pair.getValue().get(), Edge.class); content.setId(GradoopId.fromString(pair.getKey().getRow().toString())); //read from content return content; }
@Nonnull @Override public EPGMGraphHead fromRow(@Nonnull Map.Entry<Key, Value> pair) throws IOException { //map from serialize content GraphHead content = KryoUtils.loads(pair.getValue().get(), GraphHead.class); content.setId(GradoopId.fromString(pair.getKey().getRow().toString())); //read from content return content; }
@Override public Vertex map(String csvLine) { String[] tokens = split(csvLine, 3); return vertexFactory.initVertex( GradoopId.fromString(tokens[0]), tokens[1], parseProperties(MetaDataSource.VERTEX_TYPE, tokens[1], tokens[2])); } }
@Override public Vertex map(String csvLine) { String[] tokens = split(csvLine, 3); return vertexFactory.initVertex( GradoopId.fromString(tokens[0]), tokens[1], parseProperties(MetaDataSource.VERTEX_TYPE, tokens[1], tokens[2])); } }
@Override public GraphHead map(String csvLine) throws Exception { String[] tokens = split(csvLine, 3); String label = StringEscaper.unescape(tokens[1]); return graphHeadFactory.initGraphHead( GradoopId.fromString(tokens[0]), label, parseProperties(MetaDataSource.GRAPH_TYPE, label, tokens[2]) ); } }
@Override public GraphHead map(String csvLine) throws Exception { String[] tokens = split(csvLine, 3); String label = StringEscaper.unescape(tokens[1]); return graphHeadFactory.initGraphHead( GradoopId.fromString(tokens[0]), label, parseProperties(MetaDataSource.GRAPH_TYPE, label, tokens[2]) ); } }
@Override public Vertex map(String csvLine) throws Exception { String[] tokens = split(csvLine, 4); String label = StringEscaper.unescape(tokens[2]); return vertexFactory.initVertex( GradoopId.fromString(tokens[0]), label, parseProperties(MetaDataSource.VERTEX_TYPE, label, tokens[3]), parseGradoopIds(tokens[1]) ); } }
@Override public Vertex map(String csvLine) throws Exception { String[] tokens = split(csvLine, 4); String label = StringEscaper.unescape(tokens[2]); return vertexFactory.initVertex( GradoopId.fromString(tokens[0]), label, parseProperties(MetaDataSource.VERTEX_TYPE, label, tokens[3]), parseGradoopIds(tokens[1]) ); } }
@Test public void testFromString() { GradoopId originalId = GradoopId.get(); GradoopId fromStringId = GradoopId.fromString(originalId.toString()); assertEquals("reconstruction from string failed", originalId, fromStringId); }