+\r
+ public static Resource createFileReference(final Resource parent, final Path path) throws DatabaseException {\r
+ return Simantics.getSession().syncRequest(new WriteResultRequest<Resource>() {\r
+\r
+ @Override\r
+ public Resource perform(WriteGraph graph) throws DatabaseException {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ GraphFileResource GF = GraphFileResource.getInstance(graph);\r
+ Resource file = graph.newResource();\r
+ graph.claim(file, L0.PartOf, parent);\r
+ graph.claim(file, L0.InstanceOf, GF.File);\r
+ String name = path.getFileName().toString();\r
+ graph.claimLiteral(file, L0.HasName, name, Bindings.STRING);\r
+ graph.claimLiteral(file, GF.SystemPath, path.toAbsolutePath().toString(), Bindings.STRING);\r
+ return file;\r
+ }\r
+ });\r
+ }\r