@Override protected void transformVertex(final IVertex vertex) { final NodeType nodeType = new NodeType(); nodeType.setId(vertex.getId().toString()); final List<Object> dataOrPort = nodeType.getDataOrPort(); for (final String propertyKey : vertex.getPropertyKeys()) { final DataType dataType = new DataType(); for (final Object childGraphType : childGraphmlType.getGraphOrData()) { if (childGraphType instanceof GraphType) { nodeType.setGraph((GraphType) childGraphType);
public static GraphmlType convert(GraphML graphML) throws InvalidGraphException { GraphmlType graphmlType = new GraphmlType(); addProperties(graphmlType, KeyForType.GRAPHML, graphML, dataType -> graphmlType.getGraphOrData().add(dataType)); for (GraphMLGraph eachGraph : graphML.getGraphs()) { GraphType graphType = new GraphType(); graphType.setId(eachGraph.getId()); addProperties(graphmlType, KeyForType.GRAPH, eachGraph, dataType -> graphType.getDataOrNodeOrEdge().add(dataType)); for (GraphMLNode eachNode : eachGraph.getNodes()) { NodeType nodeType = new NodeType(); nodeType.setId(eachNode.getId()); graphType.getDataOrNodeOrEdge().add(nodeType); addProperties(graphmlType, KeyForType.NODE, eachNode, dataType -> nodeType.getDataOrPort().add(dataType)); } for (GraphMLEdge eachEdge : eachGraph.getEdges()) { EdgeType edgeType = new EdgeType(); edgeType.setId(eachEdge.getId()); edgeType.setSource(eachEdge.getSource().getId()); edgeType.setTarget(eachEdge.getTarget().getId()); graphType.getDataOrNodeOrEdge().add(edgeType); addProperties(graphmlType, KeyForType.EDGE, eachEdge, dataType -> edgeType.getData().add(dataType)); } graphmlType.getGraphOrData().add(graphType); } return graphmlType; }
/** * Create an instance of {@link NodeType } * */ public NodeType createNodeType() { return new NodeType(); }
for (NodeType eachNode : nodes) { GraphMLNode convertedNode = new GraphMLNode(); nodeIdToGraphMapping.put(eachNode.getId(), convertedGraph); addProperties(convertedNode, eachNode.getId(), keyIdToTypeMapping, filter(eachNode.getDataOrPort(), DataType.class)); List<PortType> ports = filter(eachNode.getDataOrPort(), PortType.class); if (!ports.isEmpty()) { LOG.warn("Ports are defined for node with id {} but ports are not supported. Ignoring {} defined ports", eachNode.getId(), ports.size());
/** * Create an instance of {@link NodeType } * */ public NodeType createNodeType() { return new NodeType(); }