Difference between revisions of "SimpleGraph-Excel"
Jump to navigation
Jump to search
(7 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
= Mental Model = | = Mental Model = | ||
+ | == Mapping rules == | ||
+ | # Each Vertex type (by label) is converted to an Excel sheet | ||
+ | # Each Edge type (by label) is converted to an Excel sheet | ||
+ | # Each vertex is converted to a row | ||
+ | # Each vertex property is converted to a cell | ||
+ | # Each edge is converted to a row | ||
+ | # Each edge property is converted to a cell | ||
+ | # The header row for Vertices has a column for each property key | ||
+ | # The header for for Edges has a column for each property key + an in and and out column | ||
+ | # The in and out header columns for edges have the label of the corresponding vertex in parentheses | ||
+ | == UML diagram == | ||
<uml> | <uml> | ||
Line 85: | Line 96: | ||
note on link: 4 | note on link: 4 | ||
</uml> | </uml> | ||
+ | [[File:modern.xlsx]] | ||
+ | |||
== AirRoutes == | == AirRoutes == | ||
+ | The UML diagram and excel table is not fully consistent with the graph. The graph can have contains edges between airport and country. | ||
+ | |||
<uml> | <uml> | ||
hide circle | hide circle | ||
Line 130: | Line 145: | ||
note on link: 6748 | note on link: 6748 | ||
</uml> | </uml> | ||
+ | [[File:air-routes.xlsx]] | ||
+ | <source lang='java'> | ||
+ | @Test | ||
+ | public void testCreateExcelAirRoutes() throws Exception { | ||
+ | ExcelSystem es = new ExcelSystem(); | ||
+ | Graph graph = TestTinkerPop3.getAirRoutes(); | ||
+ | GraphTraversalSource g = graph.traversal(); | ||
+ | // es.setDebug(true); | ||
+ | Workbook wb = es.createWorkBook(g); | ||
+ | assertEquals(6, wb.getNumberOfSheets()); | ||
+ | es.save(wb, testAirRouteFileName); | ||
+ | } | ||
+ | </source> | ||
== Railway == | == Railway == |
Latest revision as of 09:06, 30 October 2018
SimpleGraphModule
SimpleGraph Excel module
The SimpleGraph Excel module makes Microsoft Excel workbooks accessible via the Apache POI API see Apache POI XSSF/HSSF.
Sources
- System: ExcelSystem.java
- JUnit-Test: TestExcelSystem.java
Mental Model
Mapping rules
- Each Vertex type (by label) is converted to an Excel sheet
- Each Edge type (by label) is converted to an Excel sheet
- Each vertex is converted to a row
- Each vertex property is converted to a cell
- Each edge is converted to a row
- Each edge property is converted to a cell
- The header row for Vertices has a column for each property key
- The header for for Edges has a column for each property key + an in and and out column
- The in and out header columns for edges have the label of the corresponding vertex in parentheses
UML diagram
Examples
Modern
AirRoutes
The UML diagram and excel table is not fully consistent with the graph. The graph can have contains edges between airport and country.
@Test
public void testCreateExcelAirRoutes() throws Exception {
ExcelSystem es = new ExcelSystem();
Graph graph = TestTinkerPop3.getAirRoutes();
GraphTraversalSource g = graph.traversal();
// es.setDebug(true);
Workbook wb = es.createWorkBook(g);
assertEquals(6, wb.getNumberOfSheets());
es.save(wb, testAirRouteFileName);
}