Skip to content

Commit

Permalink
fix: do not save date when the string is emty (#545)
Browse files Browse the repository at this point in the history
* fix: do not save date when the string is emty

* fix: review
  • Loading branch information
EmmanuelDemey authored Mar 11, 2024
1 parent bda2142 commit 66acbed
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -299,8 +300,14 @@ private void persistStatisticsInformations(IRI datasetIri, Dataset dataset, Mode
model.add(node, RDF.TYPE, DCTERMS.PERIOD_OF_TIME, graph);

if(dataset.getTemporalCoverageDataType().endsWith("date")){
model.add(node, DCAT.START_DATE, RdfUtils.setLiteralDate(dataset.getTemporalCoverageStartDate()), graph);
model.add(node, DCAT.END_DATE, RdfUtils.setLiteralDate(dataset.getTemporalCoverageEndDate()), graph);

if(StringUtils.hasLength(dataset.getTemporalCoverageStartDate())){
model.add(node, DCAT.START_DATE, RdfUtils.setLiteralDate(dataset.getTemporalCoverageStartDate()), graph);
}
if(StringUtils.hasLength(dataset.getTemporalCoverageEndDate())){
model.add(node, DCAT.END_DATE, RdfUtils.setLiteralDate(dataset.getTemporalCoverageEndDate()), graph);
}

} else {
model.add(node, DCAT.START_DATE, RdfUtils.setLiteralYear(dataset.getTemporalCoverageStartDate()), graph);
model.add(node, DCAT.END_DATE, RdfUtils.setLiteralYear(dataset.getTemporalCoverageEndDate()), graph);
Expand Down

0 comments on commit 66acbed

Please sign in to comment.