|
12 | 12 | import edu.kit.datamanager.ro_crate.entities.data.RootDataEntity;
|
13 | 13 | import edu.kit.datamanager.ro_crate.special.JsonUtilFunctions;
|
14 | 14 | import static edu.kit.datamanager.ro_crate.special.UriUtil.decode;
|
| 15 | +import static edu.kit.datamanager.ro_crate.special.UriUtil.isUrl; |
| 16 | + |
15 | 17 | import edu.kit.datamanager.ro_crate.validation.JsonSchemaValidation;
|
16 | 18 | import edu.kit.datamanager.ro_crate.validation.Validator;
|
17 | 19 |
|
@@ -92,17 +94,18 @@ public RoCrate readCrate(String location) {
|
92 | 94 | // if the id is in the root hasPart list, we know this entity is a data entity
|
93 | 95 | RootDataEntity root = crate.getRootDataEntity();
|
94 | 96 | if (root != null && root.hasInHasPart(node.get(PROP_ID).asText())) {
|
| 97 | + // data entity |
| 98 | + DataEntity.DataEntityBuilder dataEntity = new DataEntity.DataEntityBuilder() |
| 99 | + .setAll(node.deepCopy()); |
| 100 | + |
| 101 | + // Handle data entities with corresponding file |
95 | 102 | File loc = checkFolderHasFile(node.get(PROP_ID).asText(), files);
|
96 | 103 | if (loc != null) {
|
97 | 104 | usedFiles.add(loc.getPath());
|
98 |
| - |
99 |
| - // data entity |
100 |
| - DataEntity dataEntity = new DataEntity.DataEntityBuilder() |
101 |
| - .setAll(node.deepCopy()) |
102 |
| - .addContent(loc.toPath(), loc.getName()) |
103 |
| - .build(); |
104 |
| - crate.addDataEntity(dataEntity, false); |
| 105 | + dataEntity.addContent(loc.toPath(), loc.getName()); |
105 | 106 | }
|
| 107 | + |
| 108 | + crate.addDataEntity(dataEntity.build(), false); |
106 | 109 | } else {
|
107 | 110 | // contextual entity
|
108 | 111 | crate.addContextualEntity(
|
|
0 commit comments