/** * Drop edge properties. * * @param current current edge * @param transformed copy of current except label and properties * @return current edge without properties */ private static Edge dropEdgeProperties(Edge current, Edge transformed) { transformed.setLabel(current.getLabel()); return transformed; }
@Override public GraphTransaction map(GraphTransaction graphTransaction) throws Exception { String label; for (Edge edge : graphTransaction.getEdges()) { label = edgeDictionary.get(Integer.parseInt(edge.getLabel())); if (label != null) { edge.setLabel(label); } else { edge.setLabel(edge.getLabel() + TLFConstants.EMPTY_LABEL); } } return graphTransaction; } }
/** * {@inheritDoc} */ @Override public GraphTransaction map(GraphTransaction graphTransaction) throws Exception { String label; for (Edge edge : graphTransaction.getEdges()) { label = edgeDictionary.get(Integer.parseInt(edge.getLabel())); if (label != null) { edge.setLabel(label); } else { edge.setLabel(edge.getLabel() + TLFConstants.EMPTY_LABEL); } } return graphTransaction; } }
/** * Removes the dictionary labels and sets the simple labels (integer). * * @param graphTransaction graph transaction with label format: * 'dictionarylabel' * @return graph transaction with label format: 'simpleLabel' (Integer) * @throws Exception */ @Override public GraphTransaction map(GraphTransaction graphTransaction) throws Exception { if (vertexDictionary != null) { for (Vertex vertex : graphTransaction.getVertices()) { vertex.setLabel(vertexDictionary.get(vertex.getLabel()).toString()); } } if (edgeDictionary != null) { for (Edge edge : graphTransaction.getEdges()) { edge.setLabel(edgeDictionary.get(edge.getLabel()).toString()); } } return graphTransaction; } }
/** * Removes the dictionary labels and sets the simple labels (integer). * * @param graphTransaction graph transaction with label format: * 'dictionarylabel' * @return graph transaction with label format: 'simpleLabel' (Integer) * @throws Exception */ @Override public GraphTransaction map(GraphTransaction graphTransaction) throws Exception { if (vertexDictionary != null) { for (Vertex vertex : graphTransaction.getVertices()) { vertex.setLabel(vertexDictionary.get(vertex.getLabel()).toString()); } } if (edgeDictionary != null) { for (Edge edge : graphTransaction.getEdges()) { edge.setLabel(edgeDictionary.get(edge.getLabel()).toString()); } } return graphTransaction; } }
/** * Initializes an EPGM edge using the specified parameters and adds its label * if the given edge was created for return pattern * * @param out flat map collector * @param graphHead graph head to assign edge to * @param edgeId edge identifier * @param sourceId source vertex identifier * @param targetId target vertex identifier * @param label label associated with edge */ private void initEdgeWithData(Collector<Element> out, GraphHead graphHead, GradoopId edgeId, GradoopId sourceId, GradoopId targetId, String label) { if (!processedIds.contains(edgeId)) { Edge e = edgeFactory.initEdge(edgeId, sourceId, targetId); e.addGraphId(graphHead.getId()); e.setLabel(label); out.collect(e); processedIds.add(edgeId); } } }
/** * Initializes an EPGM edge using the specified parameters and adds its label * if the given edge was created for return pattern * * @param out flat map collector * @param graphHead graph head to assign edge to * @param edgeId edge identifier * @param sourceId source vertex identifier * @param targetId target vertex identifier * @param label label associated with edge */ private void initEdgeWithData(Collector<Element> out, GraphHead graphHead, GradoopId edgeId, GradoopId sourceId, GradoopId targetId, String label) { if (!processedIds.contains(edgeId)) { Edge e = edgeFactory.initEdge(edgeId, sourceId, targetId); e.addGraphId(graphHead.getId()); e.setLabel(label); out.collect(e); processedIds.add(edgeId); } } }
@Override public Edge apply(Edge current, Edge transformed) { if (current.getLabel().equals(forEdgeLabel)) { GradoopId source = current.getSourceId(); GradoopId target = current.getTargetId(); current.setSourceId(target); current.setTargetId(source); current.setLabel(newLabel); } return current; } }
row.setLabel(value.toString()); break; case AccumuloTables.KEY.SOURCE:
@Override public void join(Edge edge, Vertex vertex, Collector<Edge> collector) throws Exception { if (vertex == null) { collector.collect(edge); } else if (edge != null) { REUSABLE_EDGE.setId(GradoopId.get()); REUSABLE_EDGE.setSourceId(isSourceNow ? vId : edge.getSourceId()); REUSABLE_EDGE.setTargetId(isSourceNow ? edge.getTargetId() : vId); REUSABLE_EDGE.setProperties(edge.getProperties()); REUSABLE_EDGE.setLabel(edge.getLabel()); REUSABLE_EDGE.setGraphIds(edge.getGraphIds()); collector.collect(REUSABLE_EDGE); } } }
@Override public void join(Edge edge, Vertex vertex, Collector<Edge> collector) throws Exception { if (vertex == null) { collector.collect(edge); } else if (edge != null) { REUSABLE_EDGE.setId(GradoopId.get()); REUSABLE_EDGE.setSourceId(isSourceNow ? vId : edge.getSourceId()); REUSABLE_EDGE.setTargetId(isSourceNow ? edge.getTargetId() : vId); REUSABLE_EDGE.setProperties(edge.getProperties()); REUSABLE_EDGE.setLabel(edge.getLabel()); REUSABLE_EDGE.setGraphIds(edge.getGraphIds()); collector.collect(REUSABLE_EDGE); } } }
transformed.setLabel("link"); return transformed; });
transformed.setLabel(current.getLabel()); return transformed; })
copy.setLabel(edge.getLabel()); return copy; })