Repository: kit-data-manager/ro-crate-java
Pull request #231: Fix #226 allow arrays of literals as property values
Author: login: Pfeil
Created: 2025-03-14T12:36:35Z | Merged: 2025-03-14T14:11:37Z

Fixes #226 

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
	- Updated data validation to support a broader range of data types and enforce essential identifier properties, offering enhanced flexibility and improved data consistency.
  
- **Tests**
	- Expanded test coverage by introducing validations for mixed and nested array structures, ensuring more robust handling of complex data scenarios and bolstering overall system reliability.
  
- **Documentation**
	- Improved clarity and detail in method documentation for property addition, enhancing user understanding without altering functionality.

These improvements contribute to a more resilient and flexible experience while maintaining stringent data validation standards.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Linked issue #226: Array of literals are valid/flat json-ld
According to [JSON-LD playground](https://tinyurl.com/248t9z2m) this is a valid/flat document:
```json
{
  "@context": "http://schema.org/",
  "@type": "Person",
  "numberArray": [1, 2,3]
}
```

However this code:
```java
DataEntityBuilder builder = new DataEntityBuilder();
ObjectMapper mapper = new ObjectMapper();
ArrayNode jsonArray = mapper.createArrayNode();
jsonArray.add(1).add(2).add(3);
builder.addProperty("integerArray", jsonArray);
builder.build();
```
Produces the following log
```
The property: 
[ 1, 2, 3 ]
does not comply with the flattened structure of the RO-Crate json document.
```
Linked issue comments: user: login: Pfeil
created_at: 2025-03-12T09:10:18Z
body: Thank you for the contribution! And sorry for the late response. I will look into this in the next days.
author_association: MEMBER
user: login: Pfeil
created_at: 2025-03-14T11:12:37Z
body: Some notes/updates:
 
- I can confirm this is happening.
- I did not find any reason in the specs which contradict allowing arrays -> its a bug and we will fix it.
- Investigating further, the "addProperty" methods may be inconsistent with the naming conventions in ro-crate-java. Calling addProperties("p", n) multiple times with different n will override (set) the current value, not "add" the property if it already exists. The "add" makes sense as it will append a property to the data entity, though. This can be confusing. We should at least make some clarification in the documentation. Not sure if we need to change the code here. But at least some additional methods which do have a different behavior may make sense.
- Allowing flat arrays with primitives should fix the issue. Probably the best is to extend/fix the json schema `entity_field_structure_schema.json`.
author_association: MEMBER
user: login: Pfeil
created_at: 2025-03-14T12:57:20Z
body: Feel free to review and test the linked PR. I can also do a pre-release if this is easier for you.
author_association: MEMBER
user: login: Pfeil
created_at: 2025-03-14T18:41:55Z
body: Released as v2.0.2. I hope it works for you (otherwise, just report back :) ).
author_association: MEMBER

Diff:
diff --git a/src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java b/src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java
index 778794d6..580e625b 100644
--- a/src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java
+++ b/src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java
@@ -158,11 +158,12 @@ public void removeProperties(Collection<String> keys) {
     }
 
     /**
-     * Add a JSON property to the entity. Here the value of the property is a
-     * String.
+     * Adds a property to the entity.
+     * <p>
+     * It may override values, if the key already exists.
      *
-     * @param key the name of the property (term).
-     * @param value the value that the property has.
+     * @param key the key of the property.
+     * @param value value of the property.
      */
     public void addProperty(String key, String value) {
         if (key != null && value != null) {
@@ -172,11 +173,12 @@ public void addProperty(String key, String value) {
     }
 
     /**
-     * This is another way of adding a property, this time the value is a long
-     * integer.
+     * Adds a property to the entity.
+     * <p>
+     * It may override values, if the key already exists.
      *
-     * @param key the String key of the property.
-     * @param value the long value.
+     * @param key the key of the property.
+     * @param value value of the property.
      */
     public void addProperty(String key, long value) {
         if (key != null) {
@@ -186,10 +188,12 @@ public void addProperty(String key, long value) {
     }
 
     /**
-     * Another way of adding a property this time the value is a double.
+     * Adds a property to the entity.
+     * <p>
+     * It may override values, if the key already exists.
      *
-     * @param key the string key of the property.
-     * @param value double value of the property.
+     * @param key the key of the property.
+     * @param value value of the property.
      */
     public void addProperty(String key, double value) {
         if (key != null) {
@@ -199,11 +203,17 @@ public void addProperty(String key, double value) {
     }
 
     /**
-     * This is the most generic way of adding a property. The value is a
-     * JsonNode that could contain anything possible. This is way firstly it is
-     * validated that it follows the correct guidelines.
+     * Adds a generic property to the entity.
+     * <p>
+     * It may fail with an error message on stdout, in which case the
+     * value is not added.
+     * It may override values, if the key already exists.
+     * This is the most generic way to add a property. The value is a
+     * JsonNode that could contain anything possible. It is limited to
+     * objects allowed to flattened documents, which means any literal,
+     * an array of literals, or an object with an @id property.
      *
-     * @param key String key of the property.
+     * @param key   String key of the property.
      * @param value The JsonNode representing the value.
      */
     public void addProperty(String key, JsonNode value) {
@@ -222,8 +232,8 @@ private static boolean addProperty(ObjectNode whereToAdd, String key, JsonNode v
     }
 
     /**
-     * Add a property that looks like this: "name" : {"@id" : "id"} If the name
-     * property already exists add a second @id to it.
+     * Add a property that looks like this: "name" : {"@id" : "id"} If the
+     * name property already exists add a second @id to it.
      *
      * @param name the "key" of the property.
      * @param id the "id" of the property.
diff --git a/src/main/resources/json_schemas/entity_field_structure_schema.json b/src/main/resources/json_schemas/entity_field_structure_schema.json
index 87638cac..864422e9 100644
--- a/src/main/resources/json_schemas/entity_field_structure_schema.json
+++ b/src/main/resources/json_schemas/entity_field_structure_schema.json
@@ -7,7 +7,10 @@
       "items": {
         "anyOf": [
           { "$ref": "#/$defs/idProperty"},
-          {"type": "string"}
+          {"type": "string"},
+          {"type": "number"},
+          {"type": "boolean"},
+          {"type": "null"}
         ]
 
       }
@@ -30,14 +33,15 @@
   ],
   "$defs" : {
     "idProperty": {
-      "type": "object",
+      "type": ["object"],
       "properties": {
         "@id": {
-          "type": "string"
+          "type": ["string"]
         }
       },
+      "required": ["@id"],
       "additionalProperties": false
     }
 
-  }
+    }
 }
\ No newline at end of file
diff --git a/src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java b/src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java
index c598bb02..f551c891 100644
--- a/src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java
+++ b/src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java
@@ -1,6 +1,8 @@
 package edu.kit.datamanager.ro_crate.entities.data;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import java.io.IOException;
@@ -9,14 +11,18 @@
 import edu.kit.datamanager.ro_crate.HelpFunctions;
 import edu.kit.datamanager.ro_crate.entities.data.DataEntity.DataEntityBuilder;
 import edu.kit.datamanager.ro_crate.objectmapper.MyObjectMapper;
-import java.net.MalformedURLException;
 import java.net.URI;
 
 import java.net.URISyntaxException;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Stream;
+
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
@@ -93,12 +99,14 @@ void testUriCheck() {
 
         assertNotNull(dataEntity);
 
-        Exception exception = assertThrows(IllegalArgumentException.class, () -> {
-            new DataEntity.DataEntityBuilder()
-                    .addType("File")
-                    .setLocationWithExceptions(URI.create("zzz://wrong/url"))
-                    .build();
-        });
+        Exception exception = assertThrows(
+                IllegalArgumentException.class,
+                () ->
+                        new DataEntity.DataEntityBuilder()
+                                .addType("File")
+                                .setLocationWithExceptions(URI.create("zzz://wrong/url"))
+                                .build()
+        );
 
         assertEquals("This Data Entity remote ID does not resolve to a valid URL.", exception.getMessage());
 
@@ -114,22 +122,25 @@ void testPathCheck() throws IOException {
                 .addProperty("name", "RO-Crate specification")
                 .setEncodingFormat("application/json")
                 .build();
-        assertEquals(dataEntity.getId(), "example.json");
+        assertEquals("example.json", dataEntity.getId());
         HelpFunctions.compareEntityWithFile(dataEntity, "/json/entities/data/localFile.json");
 
+        String fileName = "cp7glop.ai";
+        Path filePath = Paths.get(fileName);
+
         dataEntity = new FileEntity.FileEntityBuilder()
-                .setLocationWithExceptions(Paths.get("cp7glop.ai"))
-                .setId("cp7glop.ai")
+                .setLocationWithExceptions(filePath)
+                .setId(fileName)
                 .addProperty("name", "Diagram showing trend to increase")
                 .setEncodingFormat("application/pdf")
                 .build();
-        assertEquals(dataEntity.getId(), "cp7glop.ai");
-        assertEquals(dataEntity.getPath(), Paths.get("cp7glop.ai"));
-        assertEquals(dataEntity.getProperty("encodingFormat").asText(), "application/pdf");
+        assertEquals(fileName, dataEntity.getId());
+        assertEquals(dataEntity.getPath(), filePath);
+        assertEquals("application/pdf", dataEntity.getProperty("encodingFormat").asText());
     }
 
     @Test
-    void testEncodedUrl() throws MalformedURLException, URISyntaxException {
+    void testEncodedUrl() throws URISyntaxException {
         //this entity id is a valid URL so there should not be any console information
         DataEntity dataEntity = new DataEntity.DataEntityBuilder()
                 .addType("File")
@@ -156,7 +167,7 @@ void testEncodedUrl() throws MalformedURLException, URISyntaxException {
                 .build();
 
         assertTrue(dataEntity.getTypes().contains("File"));
-        assertEquals(dataEntity.getId(), "almost-50%25.json");
+        assertEquals("almost-50%25.json", dataEntity.getId());
 
         // even if the Path is not correctly encoded, the data entity will be added with an encoded Path.
         dataEntity = new DataEntity.DataEntityBuilder()
@@ -164,7 +175,7 @@ void testEncodedUrl() throws MalformedURLException, URISyntaxException {
                 .setLocationWithExceptions(Paths.get("/json/crate/Results and Diagrams/almost-50%.json"))
                 .setId("almost-50%.json")
                 .build();
-        assertEquals(dataEntity.getId(), "almost-50%25.json");
+        assertEquals("almost-50%25.json", dataEntity.getId());
 
     }
 
@@ -179,10 +190,50 @@ void testRemoveProperty() {
 
         dataEntity.removeProperty("url");
         assertNull(dataEntity.getProperty("url"));
-        assertEquals(dataEntity.getProperties().size(), 4);
+        assertEquals(4, dataEntity.getProperties().size());
 
         List<String> keyList = Arrays.asList("encodingFormat", "name");
         dataEntity.removeProperties(keyList);
-        assertEquals(dataEntity.getProperties().size(), 2);
+        assertEquals(2, dataEntity.getProperties().size());
+    }
+
+    @Test
+    void testMixedArrayProperties() {
+        ObjectMapper mapper = new ObjectMapper();
+
+        ArrayNode propertyValue = mapper.createArrayNode();
+        propertyValue
+                .add(1)
+                .add("2")
+                .add(3.14)
+                .add(true)
+                .add((JsonNode) null)
+                .add(mapper.nullNode());
+        String propertyName = "mixedArray";
+
+        DataEntity entity = new DataEntityBuilder()
+                .addProperty(propertyName, propertyValue)
+                .build();
+        assertEquals(propertyValue, entity.getProperty(propertyName));
+    }
+
+    @ParameterizedTest
+    @MethodSource("provideInvalidPropertyValues")
+    void testNestedArrayProperties(ArrayNode propertyValue) {
+        String propertyName = "invalidArray";
+        DataEntity entity = new DataEntityBuilder()
+                .addProperty(propertyName, propertyValue)
+                .build();
+        assertNull(entity.getProperty(propertyName));
+    }
+
+    private static Stream<ArrayNode> provideInvalidPropertyValues() {
+        ObjectMapper mapper = new ObjectMapper();
+        ArrayNode withSubArray = mapper.createArrayNode().add(1).add("2");
+        withSubArray.addArray();
+        ArrayNode withSubObject = mapper.createArrayNode().add(1).add("2");
+        withSubObject.addObject();
+
+        return Stream.of(withSubArray, withSubObject);
     }
 }


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (2)</summary><blockquote>

<details>
<summary>src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java (2)</summary><blockquote>

`200-219`: **Remove debug logging statement**

There's an unnecessary System.out.println statement that should be removed.


```diff
-        System.out.println(entity.getProperty(propertyName));
         assertEquals(propertyValue, entity.getProperty(propertyName));
```

---

`221-230`: **Remove debug logging statement**

There's an unnecessary System.out.println statement that should be removed.


```diff
-        System.out.println(entity.getProperty(propertyName));
         assertNull(entity.getProperty(propertyName));
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 16bfa426c40f76df8d018a022aab81ad4021ffad and 50ff4c3e40de3b5a5c3202a8917922cf4990fb5e.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `src/main/resources/json_schemas/entity_field_structure_schema.json` (2 hunks)
* `src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java` (6 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (5)</summary>

* GitHub Check: build (macos-latest, 17)
* GitHub Check: build (ubuntu-latest, 21)
* GitHub Check: build (windows-latest, 17)
* GitHub Check: build (windows-latest, 21)
* GitHub Check: Analyze (java)

</details>

<details>
<summary>🔇 Additional comments (8)</summary><blockquote>

<details>
<summary>src/main/resources/json_schemas/entity_field_structure_schema.json (2)</summary>

`10-13`: **Enhanced schema flexibility with additional array item types**

The schema now allows numbers, booleans, and null values in arrays, not just strings. This properly addresses the issue described in the PR to allow arrays of literals as property values.

---

`36-42`: **Improved type declarations and added required property constraint**

Good changes:
1. Using array notation for type declarations (`"type": ["object"]` and `"type": ["string"]`) follows best practices in JSON Schema and allows for future extension
2. Adding `"required": ["@id"]` enforces that all objects must have an `@id` property, which is essential for RO-Crate entities

These changes improve schema validation while maintaining backward compatibility.

</details>
<details>
<summary>src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java (6)</summary>

`3-6`: **Added appropriate imports for new functionality**

The imports for JsonNode, ArrayNode, Path, and JUnit parameterized test support are necessary for the new test methods.



Also applies to: 17-18, 21-25

---

`102-109`: **Improved exception handling format**

The reformatted exception handling is more readable and consistent with modern Java style.

---

`128-140`: **Enhanced type safety using Path objects**

Using Path objects instead of string literals for file paths improves type safety and makes the test more robust.

---

`200-219`: **Comprehensive test for mixed array properties**

This test validates that arrays can contain different primitive types (integer, string, decimal, boolean, null) as specified in the updated schema. It properly checks that the DataEntity class correctly maintains the mixed array structure.

---

`221-230`: **Well-structured parameterized test for invalid array properties**

Good approach using a parameterized test to validate that nested arrays are rejected. This ensures the implementation properly handles invalid structures according to the schema.

---

`232-240`: **Comprehensive test cases for invalid property values**

The test data provider creates two types of invalid array structures (arrays containing sub-arrays and arrays containing sub-objects) to validate schema enforcement. This is a thorough approach to ensure the implementation correctly rejects invalid structures.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-14T12:39:10Z
user: login: fpotier
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-14T13:10:49Z
user: login: Pfeil
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-14T14:10:21Z

Review comments:
diff_hunk: @@ -199,11 +203,17 @@ public void addProperty(String key, double value) {
     }
 
     /**
-     * This is the most generic way of adding a property. The value is a
-     * JsonNode that could contain anything possible. This is way firstly it is
-     * validated that it follows the correct guidelines.
+     * Adds a generic property to the entity.
+     * <p>
+     * It may fail with an error message on stdout, in which case the
+     * value is not added.
+     * It may override values, if the key already exists.
+     * This is the most generic way to add a property. The value is a
+     * JsonNode that could contain anything possible. It is limited to
+     * objects allowed to flattened documents, which means any literal,
+     * an array of literals, or an object with an @id property.
path: src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java
user: login: fpotier
body: As I mentioned in #230 and I guess it would require significant changes but would it make sense to:
- First output the json-ld as-is
- Validate and flatten it with  [titanium-json-ld](https://github.com/filip26/titanium-json-ld)
- Implement a RO-Crate base profile validator similar to [this python library](https://github.com/crs4/rocrate-validator)

Anyway, thank you for the work, it looks good to me!
created_at: 2025-03-14T13:10:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -199,11 +203,17 @@ public void addProperty(String key, double value) {
     }
 
     /**
-     * This is the most generic way of adding a property. The value is a
-     * JsonNode that could contain anything possible. This is way firstly it is
-     * validated that it follows the correct guidelines.
+     * Adds a generic property to the entity.
+     * <p>
+     * It may fail with an error message on stdout, in which case the
+     * value is not added.
+     * It may override values, if the key already exists.
+     * This is the most generic way to add a property. The value is a
+     * JsonNode that could contain anything possible. It is limited to
+     * objects allowed to flattened documents, which means any literal,
+     * an array of literals, or an object with an @id property.
path: src/main/java/edu/kit/datamanager/ro_crate/entities/AbstractEntity.java
user: login: Pfeil
body: Thanks for your review :)

As the bug hinders certain use cases, I wanted to do a quick release with a fix for #226 before looking into larger refactorings. I agree this should be looked into at some point. But for the quick releases, I'd like to fix it with the current approaches.

If I remember correctly, we have a JSON schema that validates the crate at some point in the end, and I agree to use something like this, and probably it is already in place (not sure if optional).
created_at: 2025-03-14T14:10:21Z
author_association: MEMBER

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-03-14T12:36:42Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough

The JSON schema has been updated to accept additional data types for array items and enforce the presence of the `@id` property. Specifically, new types (number, boolean, null) are added alongside string types, and type declarations for certain properties have been changed to array forms. In parallel, the test suite for DataEntity has been enhanced. This includes improved exception handling and safer type assertions using Path objects, as well as the addition of new tests to validate both mixed array properties and the rejection of nested arrays, with a dedicated provider for invalid test cases.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `src/main/.../entity_field_structure_schema.json` | Expanded schema definition: added `number`, `boolean`, and `null` to `items.anyOf`; updated `$defs.idProperty` type to array; modified `@id` type to array and marked it as required. |
| `src/test/.../DataEntityTest.java` | Updated test methods for clarity and type-safety; added new tests for mixed array properties and nested array validations; introduced a provider method supplying invalid array structures for parameterized tests. |
| `src/main/.../AbstractEntity.java` | Enhanced documentation for overloaded `addProperty` methods, clarifying functionality and parameter descriptions without altering functionality. |

## Poem

> I'm a little rabbit, hopping through the code,  
> Updating schemas and tests on a busy, bouncy road.  
> Arrays can now mingle numbers, booleans, and null with cheer,  
> And '@id' stands required, shining bright and clear.  
> With each test that passes, my whiskers twitch with delight,  
> Coding adventures make my heart hop day and night!

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡🧪 Multi-step agentic review comment chat (experimental)</summary>
> 
> - We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
> 						- To enable this feature, set early_access to true under in the settings.
> 
> </details>

<!-- announcements_end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between a4ea18c1537cddf5644b4c2f38658cd27d0d6312 and c506c5fe5b98b5ce81564cb547863fb9e60c5719.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java` (6 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Analyze (java)
* GitHub Check: build (windows-latest, 21)
* GitHub Check: build (windows-latest, 17)

</details>

<details>
<summary>🔇 Additional comments (10)</summary><blockquote>

<details>
<summary>src/test/java/edu/kit/datamanager/ro_crate/entities/data/DataEntityTest.java (10)</summary>

`3-5`: **Well-structured imports for JSON handling**

These new imports for JsonNode and ArrayNode from the Jackson library are properly added to support the new array functionality tests. The imports are organized logically with the rest of the Jackson-related imports.

---

`17-22`: **Appropriate imports for new functionality**

The addition of Path import is consistent with the improved type safety in the testPathCheck method. The Stream import is needed for the new parameterized test provider method. All imports are well-organized and grouped logically.

---

`24-25`: **Proper setup for parameterized testing**

Adding imports for ParameterizedTest and MethodSource is appropriate for the new test case testing invalid property values with multiple scenarios.

---

`102-109`: **Improved code formatting for exception test**

The reformatted exception test is now more readable with proper indentation. The functionality remains unchanged, but the improved formatting makes the code easier to maintain.

---

`125-140`: **Enhanced type safety with Path objects**

Using Path objects instead of string literals for file paths improves type safety and makes the code more robust. The assertions have been updated to directly compare expected values with actual values, improving readability and error reporting.

---

`169-178`: **More precise assertions**

Replacing assertTrue with assertEquals provides more specific error messages on test failures, making debugging easier. This is a good practice for test maintenance.

---

`193-198`: **Clearer property count verification**

The updated assertions provide a clearer expectation of the property count after operations, making the test's intent more explicit.

---

`200-218`: **Comprehensive test for mixed array properties**

This new test effectively validates the core functionality being added in this PR - supporting arrays with mixed types of literals. The test creates an array with various data types (integers, strings, floats, booleans, nulls) and verifies they're correctly preserved in the DataEntity.

The test is well-structured and includes a variety of data types that could appear in RO-Crate metadata.

---

`220-228`: **Robust validation of nested array rejection**

Using parameterized testing is an excellent approach for testing multiple invalid cases. This test verifies that nested arrays (arrays containing other arrays or objects) are properly rejected, which is important for maintaining RO-Crate compatibility.

---

`230-238`: **Well-implemented test data provider**

The provider method creates two types of invalid array structures for testing: arrays containing sub-arrays and arrays containing objects. This approach ensures robust testing of the validation logic.

The Stream.of() approach is an elegant way to provide multiple test cases to the parameterized test.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARABi8AAekGYATKkAbOi++ADu6BRUssj4AGaQ3urK3shoyLz43JS48hJo3iGIMZC5dZCI2ALM6jT0cuGwntiIlNalJPB+mPSo8EoY4qXw0X0YTgKzqQDMAIwaMJM8FPDMLvLc2BTc+DP85bgIyLYoyATotLQAohkEgBp49swDnx0llcuoEFgPp4As9EOp8K5zh5IEpEAxrtxxPgsA0JGtoqgBgwGPAMGIADT9XDUWlEfo3bjeeTxJLSFIw+ndWm0eAMFkYNkfagTTwMWCYUjIW5KFCIz5eXz+IKdMIuTy0mgYJT0P5A/DeKQy/pNGlbCnAkLnOIYyClR5IvhKZmLRCMpEavwBYKhRiYSAHdDU6QzejS/2lc3ePKsyAAVRsABkuABtWC4XDcRAcAD0xaI8MGGiYzGLAGt1GBaNQ0GBbhg0KQKMWKIR8dQSGAhGg2sWHr5i8cTgBdAAUeYLRdL5Y+lerdYbTeZrcwHco3d7VBog+HaFHPm8E9OAEoNEZ9MZw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7Yvc7DXZ/HEfoyfH2VNUYHXY7UUBbfAR7VfabGcY3HuNkRg1QoElMGgjnLyLnSlMvJSCvPfb3UHdPTPUXGHXPfPHpMPGXSPOJYsbfeE3fGZNXNAfHS7J4qoifQYt4wRD4o6W474sneFRzQE0eEEpgxkJMJLVzEgKErAGEgkqgIk15fnViFE/3LPIPCXeHAvbEovIZPEwUhE4kxPR4onSkgYjYKfd4u7ekr4thJk/4lnWQVk4EyAUExkKo47TwSE13A/I6JU4U0jJEtPL1VEwPdE4PbpRHHE+4viR0yvFUk8MkzXLtDU143VHUknHKBkg0342MAEFk8E5GC0yAaI0lJnW0znN3B0uEoUwMkUl0sUt0iUtEnPL00PcPAZP0iSAMqvEkpPKpFPeiBCdhWdN8DCRvNNAI/CfwNAIiFvbZcYCCSiNQaiOCOiAwVs3CdQISNYRAISAIMkBeOgRSFwMIe8Kcx8SAAAVgAAYe8AAWBgI4EgQ8vcpQI4AQHctAHck81IPc1INAAADgAE4TgAB2V89IBgUoQ81818g868zweCbctAQ8n6E4Z8hgE4Hco4D8hgAEUoHcjIQ8w8gQY81IUoI4Z8jIHc6C2gVID82gC8jIU4VIWiQwac/cjIBgHc+YHcgQV858683iZ82C1Chga8w8j83Co4UoJikgDIPcuij8k4V8yihiKAGc3AOcs9RckgZc3IVc58SioAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=kit-data-manager/ro-crate-java&utm_content=231):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: coveralls
created_at: 2025-03-14T14:19:55Z
body: ## Pull Request Test Coverage Report for [Build #302](https://coveralls.io/builds/72723843)

### Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

- For more information on this, see <a target="_blank" href="https://docs.coveralls.io/build-types#tracking-coverage-changes-with-pull_request-builds">Tracking coverage changes with pull request builds</a>.
- To avoid this issue with future PRs, see these <a target="_blank" href="https://docs.coveralls.io/build-types#recommended-ci-configurations">Recommended CI Configurations</a>.
- For a quick fix, <a target="_blank" href="https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/#update-your-pull-request-branch-by-rebasing">rebase this PR at GitHub</a>. Your next report should be accurate.

### Details

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage remained the same at **90.688%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/72723843/badge)](https://coveralls.io/builds/72723843) |
| :-- | --: |
| Change from base [Build #273](https://coveralls.io/builds/70790542): |  0.0% |
| Covered Lines: | 1607 |
| Relevant Lines: | 1772 |

---
##### 💛  - [Coveralls](https://coveralls.io)

author_association: NONE