Skip to content

Commit

Permalink
fix: improve ldes client materialisation docs (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomvbe authored Feb 12, 2024
1 parent 59ce5ab commit a211585
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
41 changes: 27 additions & 14 deletions docs/_ldio/ldio-inputs/ldio-ldes-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down

0 comments on commit a211585

Please sign in to comment.