Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7692032
chore(deps): update dependency commons-io:commons-io to v2.20.0
renovate[bot] Jul 18, 2025
a850f65
chore(deps): update dependency commons-validator:commons-validator to…
renovate[bot] Jul 9, 2025
76669b3
chore(deps): update dependency gradle to v8.14.3
renovate[bot] Jul 4, 2025
0573f84
chore(deps): update dependency com.networknt:json-schema-validator to…
renovate[bot] Jun 28, 2025
42f4186
chore(deps): update plugin io.freefair.maven-publish-java to v8.14
renovate[bot] Jun 18, 2025
92bcf09
chore(deps): update jacksonversion to v2.19.2
renovate[bot] Jul 18, 2025
bfb85d7
chore(deps): update dependency org.junit:junit-bom to v5.13.4
renovate[bot] Jul 21, 2025
f711e67
chore(deps): update jacksonversion to v2.20.0
renovate[bot] Aug 31, 2025
0f144c6
chore(deps): update actions/setup-java action to v5
renovate[bot] Aug 21, 2025
80c2903
chore(deps): update plugin io.freefair.maven-publish-java to v8.14.2
renovate[bot] Aug 18, 2025
901f801
chore(deps): update actions/checkout action to v5
renovate[bot] Aug 11, 2025
a0e3178
chore(deps): update dependency com.github.fslev:json-compare to v7.1
renovate[bot] Aug 1, 2025
f87beea
chore(deps): update actions/upload-artifact action to v5
renovate[bot] Oct 27, 2025
ac1ae17
chore(deps): update dependency jacoco to v0.8.14
renovate[bot] Oct 14, 2025
c928ed5
chore(deps): update github/codeql-action action to v4
renovate[bot] Oct 13, 2025
3a446e1
chore(deps): update dependency com.apicatalog:titanium-json-ld to v1.7.0
renovate[bot] Oct 8, 2025
4679880
chore(deps): update gradle/actions action to v5
renovate[bot] Oct 4, 2025
d7b3bb5
chore(deps): update plugin io.freefair.maven-publish-java to v9
renovate[bot] Sep 27, 2025
89cbca5
chore(deps): update dependency org.junit:junit-bom to v5.14.1
renovate[bot] Nov 3, 2025
32feded
chore(deps): update dependency com.networknt:json-schema-validator to…
renovate[bot] Sep 13, 2025
b6cc350
chore(deps): update jacksonversion to v2.20.1
renovate[bot] Nov 5, 2025
b7e4d01
chore(deps): update dependency org.junit:junit-bom to v6
renovate[bot] Nov 5, 2025
2e31dce
chore(deps): update dependency commons-io:commons-io to v2.21.0
renovate[bot] Nov 8, 2025
a3f54a4
docs: document members concerning the improved removal speed
Pfeil Oct 2, 2025
1887d46
refactor: deprecate hasInHasPart method and introduce hasPart method …
Pfeil Oct 2, 2025
e4c68a8
chore: fix typo in parameter name in setHasPart method
Pfeil Oct 2, 2025
185767d
test: sketch hierarchy creation api
Pfeil Oct 10, 2025
faad861
feat: file hierarchy creation
Pfeil Oct 10, 2025
727ac5c
feat: addDataEntity connecting to a given entity ID instead of root
Pfeil Nov 4, 2025
1dbc1de
feat: ignore empty strings as entity types
Pfeil Nov 5, 2025
af85c11
fix: deserialize entity types properly into types set for consistent …
Pfeil Nov 5, 2025
bbdf895
fix: deserialize DataSetEntity properly
Pfeil Nov 5, 2025
e672f8f
chore: cleanup
Pfeil Nov 5, 2025
af62864
fix: allow DataEntity to connect to root explicitly
Pfeil Nov 5, 2025
784a211
chore: fixup compilation in RoCrateBuilder::addDataEntity
Pfeil Nov 5, 2025
55f57ba
test: add several tests for addDataEntity
Pfeil Nov 5, 2025
140717f
test: add several tests for addDataEntity, splitting between the buil…
Pfeil Nov 5, 2025
3907385
cleanup: simplify HierarchyRecognitionResult
Pfeil Nov 5, 2025
79e0bb1
cleanup: simplify HierarchyRecognitionConfig
Pfeil Nov 5, 2025
35ba4be
chore: ignore language server related files and directories
Pfeil Nov 5, 2025
0b53863
cleanup: remove unnecessary java.lang before String types
Pfeil Nov 5, 2025
26d9bfd
fix(test): tests indicated misleadingly that we properly deserialize …
Pfeil Nov 5, 2025
c07728d
fix: deserialize hasPart for DataSetEntitys into member field
Pfeil Nov 5, 2025
a2c0350
fix: avoid adding blank strings as hasPart IDs to DataSetEntitys
Pfeil Nov 5, 2025
36a5c07
docs: rephase DataSet related Javadocs more concise and informative
Pfeil Nov 5, 2025
dc4f477
refactor: rename hierarchy module and move tests accordingly
Pfeil Nov 10, 2025
eef989c
deprecate: announce deprecation of unsafe addFromCollection method
Pfeil Nov 10, 2025
c23df4f
docs: add package documentation for the hierarchy recognition feature
Pfeil Nov 10, 2025
59f10e1
fix: only add entity types which are not null AND not empty
Pfeil Nov 10, 2025
ee6d014
fix: avoid reading empty strings to hasPart
Pfeil Nov 10, 2025
6a21367
fix: error in local file path detection
Pfeil Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4

# Command-line programs to run using the OS shell.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -69,4 +69,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up openJDK version
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.jdk }}
distribution: 'zulu'
- name: Install Dependencies
run: npm install -g ro-crate-html-js
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v5
- name: Build and Test with Gradle
run: ./gradlew -Dprofile=release build
- name: Upload (test) reports as artifact on GitHub on manual runs
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: test-report ${{ matrix.os }} JDK ${{ matrix.jdk }}
path: build/reports
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publishRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'zulu' # openjdk
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.classpath
.project
.settings
.tmp

### VSCode ###
.vscode/*
#!.vscode/settings.json
Expand Down
26 changes: 14 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ plugins {
// Publishing of JAR to Nexus instances (e.g., OSSRH)
// https://github.com/gradle-nexus/publish-plugin
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "io.freefair.maven-publish-java" version "8.13.1"
id "io.freefair.maven-publish-java" version "9.0.0"
}

group 'edu.kit.datamanager'
group = 'edu.kit.datamanager'
description = "A library for easy creation and modification of valid RO-Crates."

println "Running gradle version: $gradle.gradleVersion"
println "Building ${name} version: ${version}"
println "JDK version: ${JavaVersion.current()}"
println "Profile (system property): ${System.getProperty('profile')}"

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

if (JavaVersion.current() == JavaVersion.VERSION_17) {
println "Setting encoding to UTF-8 manually"
Expand All @@ -38,12 +40,12 @@ repositories {
}

ext {
jacksonVersion = '2.19.0'
jacksonVersion = '2.20.1'
}

dependencies {
// JUnit setup for testing
testImplementation(platform("org.junit:junit-bom:5.13.0"))
testImplementation(platform("org.junit:junit-bom:6.0.1"))
testImplementation('org.junit.jupiter:junit-jupiter')
testRuntimeOnly('org.junit.platform:junit-platform-launcher')
// JSON object mapping / (de-)serialization
Expand All @@ -52,19 +54,19 @@ dependencies {
// http client
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
// common file system operations
implementation group: 'commons-io', name: 'commons-io', version: '2.19.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.21.0'
// read from and write to zip files
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.11.5'
// compare json documents in tests
implementation 'com.github.fslev:json-compare:7.0'
implementation 'com.github.fslev:json-compare:7.1'
// url validator
implementation group: 'commons-validator', name: 'commons-validator', version: '1.9.0'
implementation group: 'commons-validator', name: 'commons-validator', version: '1.10.0'
// logging
implementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '2.0.17'
// JSON-LD, Zenodo mapping
implementation group: 'com.apicatalog', name: 'titanium-json-ld', version: '1.6.0'
implementation group: 'com.apicatalog', name: 'titanium-json-ld', version: '1.7.0'
// metadata validation, profiles based on JSON schema
implementation group: "com.networknt", name: "json-schema-validator", version: "1.5.7"
implementation group: "com.networknt", name: "json-schema-validator", version: "1.5.9"
implementation 'org.glassfish:jakarta.json:2.0.1'
//JTE for template processing
implementation('gg.jte:jte:3.2.1')
Expand Down Expand Up @@ -189,7 +191,7 @@ jacocoTestReport {
}

jacoco {
toolVersion = "0.8.13"
toolVersion = "0.8.14"
}

// maxParallelForks(2)
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
62 changes: 59 additions & 3 deletions src/main/java/edu/kit/datamanager/ro_crate/Crate.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import java.util.Set;

import edu.kit.datamanager.ro_crate.context.CrateMetadataContext;
import edu.kit.datamanager.ro_crate.hierarchy.HierarchyRecognitionConfig;
import edu.kit.datamanager.ro_crate.hierarchy.HierarchyRecognitionResult;
import edu.kit.datamanager.ro_crate.entities.AbstractEntity;
import edu.kit.datamanager.ro_crate.entities.contextual.ContextualEntity;
import edu.kit.datamanager.ro_crate.entities.data.DataEntity;
import edu.kit.datamanager.ro_crate.entities.data.DataSetEntity;
import edu.kit.datamanager.ro_crate.entities.data.RootDataEntity;
import edu.kit.datamanager.ro_crate.preview.CratePreview;
import edu.kit.datamanager.ro_crate.special.CrateVersion;
Expand Down Expand Up @@ -103,15 +106,27 @@ public interface Crate {

String getJsonMetadata();

DataEntity getDataEntityById(java.lang.String id);
/**
* Gets a data entity by its ID.
* @param id the ID of the data entity
* @return the DataEntity with the specified ID or null if not found
*/
DataEntity getDataEntityById(String id);

/**
* Gets a data set entity by its ID.
* @param id the ID of the data set entity
* @return the DataSetEntity with the specified ID or empty if not found
*/
Optional<DataSetEntity> getDataSetById(String id);

Set<DataEntity> getAllDataEntities();

ContextualEntity getContextualEntityById(java.lang.String id);
ContextualEntity getContextualEntityById(String id);

Set<ContextualEntity> getAllContextualEntities();

AbstractEntity getEntityById(java.lang.String id);
AbstractEntity getEntityById(String id);

/**
* Adds a data entity to the crate.
Expand All @@ -120,12 +135,31 @@ public interface Crate {
*/
void addDataEntity(DataEntity entity);

/**
* Adds a data entity to the crate with a specified parent ID.
* <p>
* Consider using
* @param entity the DataEntity to add to this crate.
* @param parentId the ID of the parent entity. Must not be null.
* @throws IllegalArgumentException if parentId is null or not found, or not a DataEntity.
*/
void addDataEntity(DataEntity entity, String parentId) throws IllegalArgumentException;

void addContextualEntity(ContextualEntity entity);

void deleteEntityById(String entityId);

void setUntrackedFiles(Collection<File> files);

/**
* Unsafely adds a collection of entities to the crate.
* <p>
* WARNING: This method does not perform any checks and may lead to an inconsistent crate state.
*
* @param entities the collection of entities to add
* @deprecated use individual add methods to ensure crate consistency. If you really need an unchecked method, consider creating a subclass or contact us at our issue tracker so we can discuss replacements before removal.
*/
@Deprecated(forRemoval = true)
void addFromCollection(Collection<? extends AbstractEntity> entities);

void addItemFromDataCite(String locationUrl);
Expand All @@ -135,4 +169,26 @@ public interface Crate {
void deleteUrlFromContext(String url);

Collection<File> getUntrackedFiles();

/**
* Automatically recognizes hierarchical file structure from DataEntity IDs
* and connects them using hasPart relationships.
* <p>
* WARNING: This will not change existing hasPart relationships.
*
* @param addInverseRelationships if true, also adds isPartOf relationships from child to parent
* @return result object containing information about what was processed, as well as potential errors.
*/
HierarchyRecognitionResult createDataEntityFileStructure(boolean addInverseRelationships);

/**
* Automatically recognizes hierarchical file structure from DataEntity IDs
* and connects them using hasPart relationships with fine-grained configuration.
* <p>
* Note: Only processes IDs that appear to be relative file paths.
*
* @param config configuration object specifying how the recognition should behave
* @return result object containing information about what was processed, as well as potential errors.
*/
HierarchyRecognitionResult createDataEntityFileStructure(HierarchyRecognitionConfig config);
}
Loading
Loading