Skip to content

Commit

Permalink
ci: finalize release 2.7.0 (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
jobulcke authored Jun 4, 2024
2 parents 5e48fad + 2798665 commit 401f794
Show file tree
Hide file tree
Showing 223 changed files with 5,290 additions and 490 deletions.
2 changes: 2 additions & 0 deletions docs/_ldio/ldio-adapters/ldio-json-to-json-ld.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: Json To JsonLd Transformer
---

# LDIO Json To JsonLd Adapter

***Ldio:JsonToLdAdapter***

The json-to-ld-adapter receives json messages and adds a linked data context to transform the messages to json-ld.
Expand All @@ -14,4 +15,5 @@ The json-to-ld-adapter receives json messages and adds a linked data context to
| Property | Description | Required | Default | Example | Supported values |
|:----------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------|:---------|:--------|:--------------------------|:-------------------------------------------------|
| _context_ | URI of json-ld context Or an JSON-LD context object. | Yes | N/A | http://example.com/my-api | URI or Json Object (containing "@context" entry) |
| _force-content-type_ | Flag that indicates if `application/json` should be forced as mime type. | No | false | true | true or false |
| _max-jsonld-cache-capacity_ | After retrieving an external JSON-LD context, it is cached for reuse. This property allows to specify the size of this cache (number of stored contexts). | No | 100 | 100 | Integer |
2 changes: 1 addition & 1 deletion ldi-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes</groupId>
<artifactId>linked-data-interactions</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

import java.util.List;

/**
* The LDI Transformer provides a user to take a linked data model (RDF) from
* the pipeline and perform transformations onto it, which can result in many linked data models.
* Afterwards, each of these models will be put back onto the pipeline towards a next transformer or an LDI Output.
*/
@FunctionalInterface
public interface LdiOneToManyTransformer extends LdiComponent {
List<Model> transform(Model model);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* onto it. Afterwards, this model will be put back onto the pipeline towards a
* next transformer or an LDI Output.
*/
@FunctionalInterface
public interface LdiOneToOneTransformer extends LdiComponent {
Model transform(Model model);
}
2 changes: 1 addition & 1 deletion ldi-core/change-detection-filter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes.ldi</groupId>
<artifactId>ldi-core</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>

<artifactId>change-detection-filter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public ChangeDetectionFilter(HashedStateMemberRepository hashedStateMemberReposi

/**
* Filters out the model by returning an empty model when the model's hash has already been processed
*
* @param model The model to be filtered
* @return Either the same model if not processed yet, otherwise an empty model
*/
Expand All @@ -46,15 +47,18 @@ public Model transform(Model model) {
canonicalizeInputModel(model, outputStream);
String hashedModel = hashModelBytes(outputStream.toByteArray());
final HashedStateMember hashedStateMember = new HashedStateMember(subject.getURI(), hashedModel);
if(hashedStateMemberRepository.containsHashedStateMember(hashedStateMember)) {
if (hashedStateMemberRepository.containsHashedStateMember(hashedStateMember)) {
return ModelFactory.createDefaultModel();
}
hashedStateMemberRepository.saveHashedStateMember(hashedStateMember);
return model;
}

/**
* Clean up the resources, should be called when the component is not used anymore
*/
public void destroyState() {
if(!keepState) {
if (!keepState) {
hashedStateMemberRepository.destroyState();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

import be.vlaanderen.informatievlaanderen.ldes.ldi.entities.HashedStateMember;

/**
* Repository to maintain the HashedStateMember objects into the database
*/
public interface HashedStateMemberRepository {
/**
* Checks if the database already contain a record that contains the exact same HashedStateMember
*
* @param hashedStateMember representation object that contains a memberId and the hash of the state member
* @return true if an exact same record has found, otherwise false
*/
boolean containsHashedStateMember(HashedStateMember hashedStateMember);

void saveHashedStateMember(HashedStateMember hashedStateMember);

/**
* Clean up the resources, should be called when the repository is not used anymore
*/
void destroyState();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ public class HashedStateMemberEntityMapper {
private HashedStateMemberEntityMapper() {
}

/**
* Maps a HashedStateMember from a domain object to an entity object
*
* @param hashedStateMember the domain object
* @return the entity object
*/
public static HashedStateMemberEntity fromHashedStateMember(HashedStateMember hashedStateMember) {
return new HashedStateMemberEntity(hashedStateMember.memberId(), hashedStateMember.memberHash());
}
Expand Down
2 changes: 1 addition & 1 deletion ldi-core/file-archiving/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes.ldi</groupId>
<artifactId>ldi-core</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>

<artifactId>file-archiving</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ldi-core/geojson-to-wkt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes.ldi</groupId>
<artifactId>ldi-core</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>

<artifactId>geojson-to-wkt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@

import static be.vlaanderen.informatievlaanderen.ldes.ldi.WktConverter.GEOJSON_GEOMETRY;

/**
* Ldi Transformer components that is in fact a wrapper around a GeoJsonConverter
*/
public class GeoJsonToWktTransformer implements LdiOneToOneTransformer {

private final GeoJsonConverter geoJsonConverter;

/**
* Constructs either around a converter that converts the GeoJson to simple WKT or to WKT in RDF format
*
* @param transformToRdfWkt boolean that determines whether to convert the input to RDF+WKT if true or to simple RDF if false
*/
public GeoJsonToWktTransformer(boolean transformToRdfWkt) {
this.geoJsonConverter = transformToRdfWkt ?
new GeoJsonToRdfPlusWktConverter() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

public interface GeoJsonConverter {

/**
* Creates new Geometry statements based on
* @param statement
* @param geometryModel
* @return
*/
List<Statement> createNewGeometryStatements(Statement statement, Model geometryModel);

}
2 changes: 1 addition & 1 deletion ldi-core/json-to-ld-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes.ldi</groupId>
<artifactId>ldi-core</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>

<artifactId>json-to-ld-adapter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.util.stream.Stream;

/**
* LdiAdapter implementation that adapts json to json-ld by adding a context to the json data
*/
public class JsonToLdAdapter implements LdiAdapter {

private final Logger log = LoggerFactory.getLogger(JsonToLdAdapter.class);
Expand All @@ -34,6 +37,13 @@ public JsonToLdAdapter(String context, boolean forceContentType, Context jenaCon
this.jenaContext = jenaContext;
}

/**
* Implementation of the adaptation function that converts json to json-ld
*
* @param content the json content, should have <code>application/json</code> as mime-type
* @return the data adapted to json-ld
* @throws UnsupportedMimeTypeException when an invalid mime-type is provided and <code>application/json</code> is not forced
*/
@Override
public Stream<Model> apply(Content content) {
if (!validateMimeType(content.mimeType())) {
Expand Down Expand Up @@ -63,7 +73,7 @@ private Stream<Model> translateJsonToLD(String data) {
}

throw new IllegalArgumentException("Only objects and arrays can be transformed to RDF. " +
"The following json does not match this criteria: " + json);
"The following json does not match this criteria: " + json);
} catch (JsonParseException e) {
throw new ParseToJsonException(e, data);
}
Expand All @@ -81,7 +91,7 @@ private Model mapJsonObjectToModel(JsonValue json) {
return model;
} else {
throw new IllegalArgumentException("Only objects can be transformed to RDF. " +
"The following json does not match this criteria: " + json);
"The following json does not match this criteria: " + json);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ldi-core/ldes-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>be.vlaanderen.informatievlaanderen.ldes.ldi</groupId>
<artifactId>ldi-core</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ldi-core/ldes-client/starting-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ldes-client</artifactId>
<groupId>be.vlaanderen.informatievlaanderen.ldes.client</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>starting-node</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

import java.util.List;

/**
* Wrapper around a RequestExecutor instance to more easily handle redirect responses
*/
public class RedirectRequestExecutor {

private final RequestExecutor requestExecutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public StartingTreeNodeRelationsFinder(RequestExecutor requestExecutor) {
this.requestExecutor = new RedirectRequestExecutor(requestExecutor);
}

/**
* Determines all starting relations that needs to be queued.
*
* @param startingNodeRequest can contain a collection, view or treeNode.
* @return all nodes that must be further queued by the discoverer
*/
public List<StartingTreeNode> findAllStartingTreeNodes(final StartingNodeRequest startingNodeRequest) {
final Response response = requestExecutor.execute(startingNodeRequest);
final Model model = getModelFromResponse(startingNodeRequest.lang(), response.getBody().orElseThrow(), startingNodeRequest.url());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import java.util.function.Predicate;

/**
* Interface to declare the specification of the provided starting node of an LDES
*/
public interface StartingNodeSpecification extends Predicate<Model> {

StartingTreeNode extractStartingNode(Model model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import static org.apache.jena.rdf.model.ResourceFactory.createProperty;
import static org.apache.jena.rdf.model.ResourceFactory.createResource;

/**
* Used when the starting node is already part of a view, or in other words, a fragment
*/
public class TreeNodeSpecification implements StartingNodeSpecification {
public static final String TREE = "https://w3id.org/tree#";
public static final Resource TREE_NODE_RESOURCE = createResource(TREE + "Node");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

import static org.apache.jena.rdf.model.ResourceFactory.createProperty;

/**
* Used when the provided starting node of the LDES is the LDES definition itself or the tree:view definition
*/
public class ViewSpecification implements StartingNodeSpecification {
public static final String TREE = "https://w3id.org/tree#";
public static final Property TREE_VIEW = createProperty(TREE, "view");
Expand Down
2 changes: 1 addition & 1 deletion ldi-core/ldes-client/tree-node-fetcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ldes-client</artifactId>
<groupId>be.vlaanderen.informatievlaanderen.ldes.client</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import java.time.LocalDateTime;
import java.util.List;

/**
* Responsible for fetching the next TreeNodes
*/
public class TreeNodeFetcher {

private static final LocalDateTime maxSupportedDateTime = LocalDateTime.of(294276, 12, 31, 23, 59, 59);
Expand All @@ -27,6 +30,10 @@ public TreeNodeFetcher(RequestExecutor requestExecutor, TimestampExtractor times
this.timestampExtractor = timestampExtractor;
}

/**
* @param treeNodeRequest based on the relations found in the previous TreeNode
* @return the new TreeNode with all its information
*/
public TreeNodeResponse fetchTreeNode(TreeNodeRequest treeNodeRequest) {
final Response response = requestExecutor.execute(treeNodeRequest.createRequest());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

import static ldes.client.treenodefetcher.domain.valueobjects.Constants.*;

/**
* Wrapper around the RDF response to more easily extract the required information from that response
*/
public class ModelResponse {
private TimestampExtractor timestampExtractor;
private final TimestampExtractor timestampExtractor;
private final ModelExtract modelExtract = new ModelExtract(new StatementTripleBoundary(TripleBoundary.stopNowhere));
private final Model model;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import java.time.LocalDateTime;
import java.util.Arrays;

/**
* Keeps track when the received http response is about to change, is in fact a reflection of the
* <code>Cache-Control</code> header
*/
public class MutabilityStatus {

public static final int DEFAULT_MAX_AGE = 60;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

import java.util.List;

/**
* Contains the endpoint to connect to the server. This can only be a fragment
*/
public class TreeNodeRequest {
private final String treeNodeUrl;
private final Lang lang;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

import java.util.List;

/**
* Wrapper around the RDF response that represents a fragment to more easily extract the required information
* from that response
*/
public class TreeNodeResponse {
private final List<String> relation;
private final List<TreeMember> members;
private final MutabilityStatus mutabilityStatus;

public TreeNodeResponse(List<String> relations, List<TreeMember> members,
MutabilityStatus mutabilityStatus) {
MutabilityStatus mutabilityStatus) {
this.relation = relations;
this.members = members;
this.mutabilityStatus = mutabilityStatus;
Expand Down
2 changes: 1 addition & 1 deletion ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ldes-client</artifactId>
<groupId>be.vlaanderen.informatievlaanderen.ldes.client</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit 401f794

Please sign in to comment.