From a2115850354382f9fa65db301e4604ef80cc1747 Mon Sep 17 00:00:00 2001 From: Tomvbe <34196062+Tomvbe@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:57:16 +0100 Subject: [PATCH] fix: improve ldes client materialisation docs (#491) --- docs/_ldio/ldio-inputs/ldio-ldes-client.md | 41 ++++++++++++------- .../ldes/ldio/LdioLdesClientProperties.java | 5 +-- .../ldio/config/MemberSupplierFactory.java | 3 +- .../config/MemberSupplierFactoryTest.java | 3 +- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/docs/_ldio/ldio-inputs/ldio-ldes-client.md b/docs/_ldio/ldio-inputs/ldio-ldes-client.md index 81a3f8856..8a1c4b3ae 100644 --- a/docs/_ldio/ldio-inputs/ldio-ldes-client.md +++ b/docs/_ldio/ldio-inputs/ldio-ldes-client.md @@ -8,23 +8,34 @@ title: LDES Client ***Ldio:LdesClient*** -An LDIO wrapper component for the [LDI LDES Client building block](../../core/ldi-inputs/ldes-client) +An LDIO wrapper component for the [LDI LDES Client building block](../../_core/ldi-inputs/ldes-client) ## Config -| Property | Description | Required | Default | Example | Supported values | -|:----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------|:-------------------------------------|:---------------------------------------------------------------|:--------------------------------------------------------------| -| urls | List of URLs of the LDES data sources | Yes | N/A | http://localhost:8080/my-ldes | HTTP and HTTPS urls | -| source-format | The 'Content-Type' that should be requested to the server. | No | application/ld+json | application/n-quads | Any type supported by [Apache Jena](https://jena.apache.org/) | -| state | 'sqlite', 'memory', 'file' or 'postgres' to indicate how the state should be persisted. | No | memory | sqlite | 'sqlite', 'files' or 'memory' | -| keep-state | Indicates if the state should be persisted on shutdown (n/a for in memory states) | No | false | false | true or false | -| postgres.url | JDBC url of the Postgres database. | No | N/A | jdbc:postgresql://test.postgres.database.azure.com:5432/sample | String | -| postgres.username | Username used to connect to Postgres database. | No | N/A | myUsername@test | String | -| postgres.password | Password used to connect to Postgres database. | No | N/A | myPassword | String | -| timestamp-path | The property-path used to determine the timestamp on which the members will be ordered | No | N/A | http://www.w3.org/ns/prov#generatedAtTime | A property path | -| use-version-materialisation | Indicates if the client should return state-objects (true) or version-objects (false). | No | false | true | true or false | -| version-of-property | Property that points to the versionOfPath. | No | http://purl.org/dc/terms/isVersionOf | "http://purl.org/dc/terms/isVersionOf" | true or false | -| restrict-to-members | Indicates that only the statements about the ldes:member should be included, including potential nested blank nodes. If this is enabled, statements about referenced entities are excluded. | No | false | false | true or false | +### General properties + +| Property | Description | Required | Default | Example | Supported values | +|:----------------------------|:----------------------------------------------------------------------------------------|:---------|:-------------------------------------|:---------------------------------------------------------------|:--------------------------------------------------------------| +| urls | List of URLs of the LDES data sources | Yes | N/A | http://localhost:8080/my-ldes | HTTP and HTTPS urls | +| source-format | The 'Content-Type' that should be requested to the server. | No | application/ld+json | application/n-quads | Any type supported by [Apache Jena](https://jena.apache.org/) | +| state | 'sqlite', 'memory', 'file' or 'postgres' to indicate how the state should be persisted. | No | memory | sqlite | 'sqlite', 'files' or 'memory' | +| keep-state | Indicates if the state should be persisted on shutdown (n/a for in memory states) | No | false | false | true or false | +| timestamp-path | The property-path used to determine the timestamp on which the members will be ordered | No | N/A | http://www.w3.org/ns/prov#generatedAtTime | A property path | + +### Postgres properties + +| Property | Description | Required | Default | Example | Supported values | +|:----------------------------|:----------------------------------------------------------------------------------------|:---------|:-------------------------------------|:---------------------------------------------------------------|:--------------------------------------------------------------| +| postgres.url | JDBC url of the Postgres database. | No | N/A | jdbc:postgresql://test.postgres.database.azure.com:5432/sample | String | +| postgres.username | Username used to connect to Postgres database. | No | N/A | myUsername@test | String | +| postgres.password | Password used to connect to Postgres database. | No | N/A | myPassword | String | + +### Version materialisation properties + +| Property | Description | Required | Default | Example | Supported values | +|:------------------------------------|:----------------------------------------------------------------------------------------|:---------|:-------------------------------------|:---------------------------------------------------------------|:--------------------------------------------------------------| +| materialisation.enabled | Indicates if the client should return state-objects (true) or version-objects (false). | No | false | true | true or false | +| materialisation.version-of-property | Property that points to the versionOfPath. | No | http://purl.org/dc/terms/isVersionOf | "http://purl.org/dc/terms/isVersionOf" | true or false | This component uses the "LDIO Http Requester" to make the HTTP request. Refer to [LDIO Http Requester](../ldio-core) for the config. @@ -38,6 +49,8 @@ Refer to [LDIO Http Requester](../ldio-core) for the config. urls: - http://localhost:8080/my-ldes sourceFormat: text/turtle + materialisation: + enabled: true retries: enabled: true auth: diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientProperties.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientProperties.java index a46426cd0..023c1281a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientProperties.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientProperties.java @@ -17,8 +17,7 @@ private LdioLdesClientProperties() { public static final String TIMESTAMP_PATH_PROP = "timestamp-path"; // version materialisation properties - public static final String USE_VERSION_MATERIALISATION = "use-version-materialisation"; - public static final String VERSION_OF_PROPERTY = "version-of-property"; - public static final String RESTRICT_TO_MEMBERS = "restrict-to-members"; + public static final String USE_VERSION_MATERIALISATION = "materialisation.enabled"; + public static final String VERSION_OF_PROPERTY = "materialisation.version-of-property"; } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java index 3491264d4..695fe0476 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java @@ -90,8 +90,7 @@ private VersionMaterialiser createVersionMaterialiser() { .getOptionalProperty(VERSION_OF_PROPERTY) .map(ResourceFactory::createProperty) .orElseGet(() -> createProperty("http://purl.org/dc/terms/isVersionOf")); - final boolean restrictToMembers = properties.getOptionalBoolean(RESTRICT_TO_MEMBERS).orElse(false); - return new VersionMaterialiser(versionOfProperty, restrictToMembers); + return new VersionMaterialiser(versionOfProperty, false); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java index 5d58f20c2..32aead66c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java @@ -10,6 +10,7 @@ import java.util.HashMap; import java.util.Map; +import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.USE_VERSION_MATERIALISATION; import static org.assertj.core.api.Assertions.assertThat; class MemberSupplierFactoryTest { @@ -25,7 +26,7 @@ void setUp() { @Test void when_VersionMaterialisationIsEnabled_then_VersionMaterialisedMemberSupplierIsReturned() { - defaultInputConfig.put("use-version-materialisation", "true"); + defaultInputConfig.put(USE_VERSION_MATERIALISATION, "true"); final var componentProperties = new ComponentProperties(defaultInputConfig); MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier();