+
+ public static Resource create(WriteGraph graph, Resource resource, Resource relation, String defaultName) throws DatabaseException {
+
+ graph.markUndoPoint();
+
+ Layer0 l0 = Layer0.getInstance(graph);
+
+ String name = NameUtils.findFreshName(graph, defaultName, resource, relation);
+ DocumentResource doc = DocumentResource.getInstance(graph);
+
+ Resource fileResource = graph.newResource();
+ graph.claim(fileResource, l0.InstanceOf, doc.FileDocument);
+ graph.claimLiteral(fileResource, l0.HasName, name);
+ graph.claim(resource, relation, fileResource);
+ try {
+ GraphFileUtil.writeDataToGraph(graph, new byte[0], fileResource);
+ } catch (IOException e) {
+ throw new DatabaseException(e);
+ }
+
+ return fileResource;
+
+ }
+