commit 47eca7caa2c317768a975b20dcc35fa102417fb3
Author: Pavel Fidranský <fidransky@outlook.com>
Date:   Wed Dec 19 08:04:16 2018 +0100

    re #10: only "vertices" and "edges" arrays are required in input data

diff --git a/sources/src/main/webapp/imiger-raw-input-schema.json b/sources/src/main/webapp/imiger-raw-input-schema.json
index d71680f..0416fa8 100644
--- a/sources/src/main/webapp/imiger-raw-input-schema.json
+++ b/sources/src/main/webapp/imiger-raw-input-schema.json
@@ -22,7 +22,6 @@
 				},
 				"required": [ "dataType", "name" ]
 			},
-			"minItems": 1,
 			"uniqueItems": true
 		},
 		"edgeArchetypes": {
@@ -39,7 +38,6 @@
 				},
 				"required": [ "name" ]
 			},
-			"minItems": 1,
 			"uniqueItems": true
 		},
 		"vertexArchetypes": {
@@ -59,7 +57,6 @@
 				},
 				"required": [ "name" ]
 			},
-			"minItems": 1,
 			"uniqueItems": true
 		},
 		"vertices": {
@@ -239,5 +236,5 @@
 			"type": "string"
 		}
 	},
-	"required": [ "attributeTypes", "edgeArchetypes", "vertexArchetypes", "vertices", "edges", "possibleEnumValues", "groups", "sideBar", "highlightedVertex", "highlightedEdge" ]
+	"required": [ "vertices", "edges" ]
 }
diff --git a/sources/src/main/webapp/js/services/graphLoader.js b/sources/src/main/webapp/js/services/graphLoader.js
index b2c28e1..43d2553 100644
--- a/sources/src/main/webapp/js/services/graphLoader.js
+++ b/sources/src/main/webapp/js/services/graphLoader.js
@@ -20,11 +20,11 @@ class GraphLoader {
 		const canvasSize = ((data.vertices.length * 75) / Math.round(Math.sqrt(data.vertices.length))) + 1000;
 
 		// store archetypes
-		app.archetype.vertex = data.vertexArchetypes;
-		app.archetype.edge = data.edgeArchetypes;
+		app.archetype.vertex = Utils.isDefined(data.vertexArchetypes) ? data.vertexArchetypes : [];
+		app.archetype.edge = Utils.isDefined(data.edgeArchetypes) ? data.edgeArchetypes : [];
 
-		app.attributeTypeList = data.attributeTypes;
-		app.possibleEnumValues = data.possibleEnumValues;
+		app.attributeTypeList = Utils.isDefined(data.attributeTypes) ? data.attributeTypes : [];
+		app.possibleEnumValues = Utils.isDefined(data.possibleEnumValues) ? data.possibleEnumValues : {};
 
 		app.archetype.vertex.filter(vertexArchetype => {
 			return Utils.isDefined(vertexArchetype.icon);
@@ -49,8 +49,8 @@ class GraphLoader {
 			highlightedEdgeId = parseInt(data.highlightedEdge, 10);
 		}
 
-		let highlightedNode = undefined;
-		let highlightedEdge = undefined;
+		let highlightedNode;
+		let highlightedEdge;
 
 		// construct vertices
 		let vertexMap = new Map;
@@ -121,63 +121,67 @@ class GraphLoader {
 		});
 
 		// construct groups
-		data.groups.forEach(component => {
-			let group = new Group(component);
+		if (Utils.isDefined(data.groups)) {
+			data.groups.forEach(component => {
+				let group = new Group(component);
 
-			if (highlightedNodeType === 'group' && highlightedNodeId === group.id) {
-				highlightedNode = group;
-			}
+				if (highlightedNodeType === 'group' && highlightedNodeId === group.id) {
+					highlightedNode = group;
+				}
 
-			// position
-			if (component.position === null || Utils.isUndefined(component.position)) {
-				// set random
-				group.position = new Coordinates(
-					Math.floor(Math.random() * canvasSize),
-					Math.floor(Math.random() * canvasSize),
-				);
-			} else {
-				group.position = new Coordinates(component.position.x, component.position.y);
-			}
+				// position
+				if (component.position === null || Utils.isUndefined(component.position)) {
+					// set random
+					group.position = new Coordinates(
+						Math.floor(Math.random() * canvasSize),
+						Math.floor(Math.random() * canvasSize),
+					);
+				} else {
+					group.position = new Coordinates(component.position.x, component.position.y);
+				}
 
-			// vertices
-			app.vertexList.filter(vertex => {
-				return component.verticesId.indexOf(vertex.id) > -1;
-			}).forEach(vertex => {
-				group.addVertex(vertex);
-			});
+				// vertices
+				app.vertexList.filter(vertex => {
+					return component.verticesId.indexOf(vertex.id) > -1;
+				}).forEach(vertex => {
+					group.addVertex(vertex);
+				});
 
-			app.nodeList.push(group);
-			app.groupList.push(group);
+				app.nodeList.push(group);
+				app.groupList.push(group);
 
-			app.viewportComponent.addNode(group);
-		});
+				app.viewportComponent.addNode(group);
+			});
+		}
 
 		// exclude nodes
-		data.sideBar.forEach(excludedNode => {
-			if (typeof excludedNode.id !== 'string' && !(excludedNode.id instanceof String)) return;
+		if (Utils.isDefined(data.sideBar)) {
+			data.sideBar.forEach(excludedNode => {
+				if (typeof excludedNode.id !== 'string' && !(excludedNode.id instanceof String)) return;
 
-			let idArr = excludedNode.id.split('-');
-			if (idArr.length !== 2) return;
+				let idArr = excludedNode.id.split('-');
+				if (idArr.length !== 2) return;
 
-			idArr[1] = parseInt(idArr[1], 10);
+				idArr[1] = parseInt(idArr[1], 10);
 
-			let node = app.nodeList.find(node => {
-				let prefix = '';
-				if (node instanceof Vertex) {
-					prefix = 'vertex';
-				} else if (node instanceof Group) {
-					prefix = 'group';
-				}
+				let node = app.nodeList.find(node => {
+					let prefix = '';
+					if (node instanceof Vertex) {
+						prefix = 'vertex';
+					} else if (node instanceof Group) {
+						prefix = 'group';
+					}
 
-				return idArr[0] === prefix && node.id === idArr[1];
-			});
+					return idArr[0] === prefix && node.id === idArr[1];
+				});
 
-			if (Utils.isDefined(node)) {
-				node.exclude();
+				if (Utils.isDefined(node)) {
+					node.exclude();
 
-				app.sidebarComponent.excludedNodeListComponent.addNode(node);
-			}
-		});
+					app.sidebarComponent.excludedNodeListComponent.addNode(node);
+				}
+			});
+		}
 
 		// center viewport
 		app.viewportComponent.center();
