/** * {@inheritDoc} */ @Override public GraphHead map(Tuple1<GradoopId> idTuple) { return graphHeadFactory.initGraphHead(idTuple.f0); }
@Override public GraphHead map(Tuple1<GradoopId> idTuple) { return graphHeadFactory.initGraphHead(idTuple.f0); }
@Override protected G initFrom(G graphHead) { return graphHeadFactory.initGraphHead(graphHead.getId(), GradoopConstants.DEFAULT_GRAPH_LABEL); } }
@Override protected G initFrom(G graphHead) { return graphHeadFactory.initGraphHead(graphHead.getId(), GradoopConstants.DEFAULT_GRAPH_LABEL); } }
@Override public GraphHead map(Tuple2<GradoopId, GradoopId> idTuple) { GraphHead head = graphHeadFactory.initGraphHead(idTuple.f0); Properties properties = Properties.createWithCapacity(1); properties.set("lineage", idTuple.f1); head.setProperties(properties); return head; }
/** * {@inheritDoc} */ @Override public GraphHead map(Tuple2<GradoopId, GradoopId> idTuple) { GraphHead head = graphHeadFactory.initGraphHead(idTuple.f0); Properties properties = Properties.createWithCapacity(1); properties.set("lineage", idTuple.f1); head.setProperties(properties); return head; }
@Override public GraphHead readRow(EPGMGraphHead origin) { return factory.initGraphHead( /*edge id*/origin.getId(), /*label*/origin.getLabel(), /*properties*/origin.getProperties()); }
@Override public GraphHead readGraphHead(final Result res) { return graphHeadFactory.initGraphHead(readId(res), readLabel(res), readProperties(res)); }
@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]) ); } }
/** * Creates graph data from JSON string representation. * * @param s json string representation * @return SubgraphWithCount storing graph data * @throws Exception */ @Override public GraphHead map(String s) throws Exception { JSONObject jsonGraph = new JSONObject(s); GradoopId graphID = getID(jsonGraph); String label = getLabel(jsonGraph); Properties properties = Properties.createFromMap( getProperties(jsonGraph)); return graphHeadFactory.initGraphHead(graphID, label, properties); } }
/** * Creates graph data from JSON string representation. * * @param s json string representation * @return SubgraphWithCount storing graph data * @throws Exception */ @Override public GraphHead map(String s) throws Exception { JSONObject jsonGraph = new JSONObject(s); GradoopId graphID = getID(jsonGraph); String label = getLabel(jsonGraph); Properties properties = Properties.createFromMap( getProperties(jsonGraph)); return graphHeadFactory.initGraphHead(graphID, label, properties); } }
@Override public GraphTransaction map(GraphTransaction transaction) throws Exception { if (graphHeadTransFunc != null) { transaction.setGraphHead(graphHeadTransFunc.apply( transaction.getGraphHead(), graphHeadFactory.initGraphHead( transaction.getGraphHead().getId(), GradoopConstants.DEFAULT_GRAPH_LABEL))); } if (vertexTransFunc != null) { transaction.setVertices(transaction.getVertices().stream() .map(vertex -> vertexTransFunc.apply( vertex, vertexFactory.initVertex( vertex.getId(), GradoopConstants.DEFAULT_VERTEX_LABEL, vertex.getGraphIds()))) .collect(Collectors.toSet())); } if (edgeTransFunc != null) { transaction.setEdges(transaction.getEdges().stream() .map(edge -> edgeTransFunc.apply( edge, edgeFactory.initEdge( edge.getId(), GradoopConstants.DEFAULT_EDGE_LABEL, edge.getSourceId(), edge.getTargetId(), edge.getGraphIds()))) .collect(Collectors.toSet())); } return transaction; } }
@Override public GraphTransaction map(GraphTransaction transaction) throws Exception { if (graphHeadTransFunc != null) { transaction.setGraphHead(graphHeadTransFunc.apply( transaction.getGraphHead(), graphHeadFactory.initGraphHead( transaction.getGraphHead().getId(), GradoopConstants.DEFAULT_GRAPH_LABEL))); } if (vertexTransFunc != null) { transaction.setVertices(transaction.getVertices().stream() .map(vertex -> vertexTransFunc.apply( vertex, vertexFactory.initVertex( vertex.getId(), GradoopConstants.DEFAULT_VERTEX_LABEL, vertex.getGraphIds()))) .collect(Collectors.toSet())); } if (edgeTransFunc != null) { transaction.setEdges(transaction.getEdges().stream() .map(edge -> edgeTransFunc.apply( edge, edgeFactory.initEdge( edge.getId(), GradoopConstants.DEFAULT_EDGE_LABEL, edge.getSourceId(), edge.getTargetId(), edge.getGraphIds()))) .collect(Collectors.toSet())); } return transaction; } }