Skip to content

Commit dd35d44

Browse files
committed
test: data (entity) graphs with loops
1 parent 7b0d5af commit dd35d44

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/test/java/edu/kit/datamanager/ro_crate/crate/ReadAndWriteTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ void testReadCrateWithHasPartHierarchy() {
5353
RoCrateReader reader = new RoCrateReader(new FolderReader());
5454
RoCrate crate = reader.readCrate(ReadAndWriteTest.class.getResource("/crates/hasPartHierarchy").getPath());
5555
assertEquals(1, crate.getAllContextualEntities().size());
56-
assertEquals(4, crate.getAllDataEntities().size());
56+
assertEquals(6, crate.getAllDataEntities().size());
5757
}
5858
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# hasPart/isPartOf Structure in this crate
2+
3+
This documents the hierarchy in this json file for the hasPart property.
4+
"isPartOf" occurences are handled the inverse way (as if it was a hasPart property the other way around).
5+
6+
- ./
7+
- sub-a.file
8+
- sub-b.file
9+
- sub-b-sub-a.file
10+
- looper.file --> sub-b.file
11+
- sub-b-sub-b.file (isPartOf)
12+
- looper-isPartOf.file --> sub-b.file

src/test/resources/crates/hasPartHierarchy/ro-crate-metadata.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,24 @@
4242
},
4343
{
4444
"@id": "sub-b-sub-a.file",
45-
"@type": "File"
45+
"@type": "File",
46+
"hasPart": {"@id": "looper.file"}
4647
},
4748
{
4849
"@id": "sub-b-sub-b.file",
4950
"@type": "File",
5051
"isPartOf": { "@id": "sub-b.file" }
52+
},
53+
{
54+
"@id": "looper.file",
55+
"@type": "File",
56+
"hasPart": {"@id": "sub-b.file"}
57+
},
58+
{
59+
"@id": "looper-isPartOf.file",
60+
"@type": "File",
61+
"hasPart": {"@id": "sub-b.file"},
62+
"isPartOf": {"@id": "sub-b.file"}
5163
}
5264
]
5365
}

0 commit comments

Comments
 (0)