+ public static Resource getOrCreateVisualisationsFolder(WriteGraph graph, Resource model) throws DatabaseException {
+ Resource rf = getVisualisationFolder(graph, model);
+ if (rf == null) {
+ Layer0 L0 = Layer0.getInstance(graph);
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ rf = graph.newResource();
+ graph.claim(rf, L0.InstanceOf, null, DN.VisualisationsFolder);
+ graph.claimLiteral(rf, L0.HasName, L0.NameOf, L0.String, UUID.randomUUID().toString(), Bindings.STRING);
+ graph.claim(model, L0.ConsistsOf, L0.PartOf, rf);
+ }
+ return rf;
+ }
+
+ public static Resource getVisualisationFolder(ReadGraph graph, Resource model) throws DatabaseException {
+ List<Resource> visualisationsFolders = QueryIndexUtils.searchByType(graph, model, DistrictNetworkResource.getInstance(graph).VisualisationsFolder);
+ if (visualisationsFolders.size() > 0)
+ return visualisationsFolders.get(0);
+ return null;
+ }
+