+
+ if(state.internalEntries != null) {
+ for(ConsistsOfProcessEntry ie : state.internalEntries) {
+ if(ie.parent != null) {
+ if(ie.name != null) {
+ procedure.execute(resolveInternal(graph, support, ie, internalMap));
+ } else {
+ // In this case there is a child that has no HasName => this should be treated as a blank
+ }
+ } else {
+ procedure.execute(resolveInternal(graph, support, ie, internalMap));
+ }
+ }
+ }
+
+ }
+
+ private Identity resolveInternal(ReadGraph graph, SerialisationSupport ss, ConsistsOfProcessEntry entry, TIntObjectMap<Identity> internalMap) throws DatabaseException {
+ int id = state.ids.get(ss.getTransientId(entry.resource));
+ Identity existing = internalMap.get(id);
+ if(existing != null) return existing;
+
+ if(entry.parent == null) {
+ Layer0 L0 = Layer0.getInstance(graph);
+ Resource possibleParent = graph.getPossibleObject(entry.resource, L0.PartOf);
+ if(possibleParent == null) throw new DatabaseException("Invalid root or internal parent path: " + entry.resource);
+ int externalId = state.ids.get(ss.getTransientId(possibleParent));
+ Identity result = new Identity(id,
+ new Internal(externalId, entry.name));
+ internalMap.put(id, result);
+ return result;
+ } else {
+ Identity parent = resolveInternal(graph, ss, entry.parent, internalMap);
+ Identity result = new Identity(id,
+ new Internal(parent.resource, entry.name));
+ internalMap.put(id, result);
+ return result;
+ }