Skip to content

Commit

Permalink
feat: remove ontologie (#832)
Browse files Browse the repository at this point in the history
* feat: remove ontologie

* feat: add unit test

* feat: add static in order to remove sonar issues

* fix: remove unused ontology
  • Loading branch information
EmmanuelDemey authored Dec 12, 2024
1 parent d04513a commit 3aa58f6
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public class CollectionExportBuilder extends RdfService {
@Autowired
ExportUtils exportUtils;

private final String xslFile = "/xslTransformerFiles/rmes2odt.xsl";
private final String xmlPattern = "/xslTransformerFiles/collection/collectionPatternContent.xml";
private final String zip = "/xslTransformerFiles/collection/toZipForCollection.zip";
private final String zipold = "/xslTransformerFiles/collection/toZipForCollectionOld.zip";
private final String xmlPatternFR = "/xslTransformerFiles/collection/collectionFrPatternContent.xml";
private final String xmlPatternEN = "/xslTransformerFiles/collection/collectionEnPatternContent.xml";
private final String xmlPatternODS = "/xslTransformerFiles/collection/collectionOdsPatternContent.xml";
private final String zipODS = "/xslTransformerFiles/collection/toZipForCollectionOds.zip";
private static final String xslFile = "/xslTransformerFiles/rmes2odt.xsl";
private static final String xmlPattern = "/xslTransformerFiles/collection/collectionPatternContent.xml";
private static final String zip = "/xslTransformerFiles/collection/toZipForCollection.zip";
private static final String zipold = "/xslTransformerFiles/collection/toZipForCollectionOld.zip";
private static final String xmlPatternFR = "/xslTransformerFiles/collection/collectionFrPatternContent.xml";
private static final String xmlPatternEN = "/xslTransformerFiles/collection/collectionEnPatternContent.xml";
private static final String xmlPatternODS = "/xslTransformerFiles/collection/collectionOdsPatternContent.xml";
private static final String zipODS = "/xslTransformerFiles/collection/toZipForCollectionOds.zip";

final Collator instance = Collator.getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import fr.insee.rmes.model.links.OperationsLink;
import fr.insee.rmes.model.operations.Indicator;
import fr.insee.rmes.persistance.ontologies.INSEE;
import fr.insee.rmes.persistance.ontologies.PROV;
import fr.insee.rmes.persistance.sparql_queries.operations.indicators.IndicatorsQueries;
import fr.insee.rmes.utils.DateUtils;
import fr.insee.rmes.utils.XMLUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package fr.insee.rmes.bauhaus_services.rdf_utils;

import fr.insee.rmes.bauhaus_services.Constants;
import fr.insee.rmes.persistance.ontologies.*;
import fr.insee.rmes.persistance.ontologies.GEO;
import fr.insee.rmes.persistance.ontologies.INSEE;
import fr.insee.rmes.persistance.ontologies.QB;
import fr.insee.rmes.persistance.ontologies.SDMX_MM;
import jakarta.validation.constraints.NotNull;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.vocabulary.DCAT;
import org.eclipse.rdf4j.model.vocabulary.FOAF;
import org.eclipse.rdf4j.model.vocabulary.ORG;
import org.eclipse.rdf4j.model.vocabulary.SKOS;

import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import fr.insee.rmes.bauhaus_services.Constants;
import fr.insee.rmes.persistance.ontologies.DCMITYPE;
import fr.insee.rmes.persistance.ontologies.GEO;
import fr.insee.rmes.persistance.ontologies.ORG;
import fr.insee.rmes.persistance.ontologies.SDMX_MM;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.vocabulary.ORG;
import org.eclipse.rdf4j.model.vocabulary.XSD;

import java.util.HashMap;
Expand Down
68 changes: 0 additions & 68 deletions src/main/java/fr/insee/rmes/persistance/ontologies/ORG.java

This file was deleted.

35 changes: 0 additions & 35 deletions src/main/java/fr/insee/rmes/persistance/ontologies/PROV.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import fr.insee.rmes.bauhaus_services.rdf_utils.RdfUtils;
import fr.insee.rmes.bauhaus_services.rdf_utils.RepositoryGestion;
import fr.insee.rmes.config.Config;
import fr.insee.rmes.exceptions.RmesBadRequestException;
import fr.insee.rmes.exceptions.RmesException;
import fr.insee.rmes.model.classification.ClassificationItem;
import fr.insee.rmes.persistance.sparql_queries.classifications.ItemsQueries;
Expand All @@ -17,6 +18,8 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
Expand All @@ -32,6 +35,25 @@ class ClassificationItemUtilsTest {
@InjectMocks
ClassificationItemUtils classificationItemUtils;

@Test
void shouldThrowExceptionIfPrefLabelLg1Null() throws RmesException {
when(config.getLg1()).thenReturn("fr");
when(config.getLg2()).thenReturn("en");


RdfUtils.setConfig(config);
ItemsQueries.setConfig(config);
ClassificationItem item = new ClassificationItem();
item.setId("1");
item.setPrefLabelLg2("label2");
item.setDefinitionLg1("<p>Definition Lg1</p>");
item.setDefinitionLg1Uri("http://definition-lg1");

RmesException exception = assertThrows(RmesBadRequestException.class, () -> classificationItemUtils.updateClassificationItem(item, "http://uri", "1"));
assertThat(exception.getDetails()).contains("The property prefLabelLg1 is required");

}

@Test
void shouldAddNotes() throws RmesException {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fr.insee.rmes.bauhaus_services.rdf_utils;

import org.eclipse.rdf4j.model.vocabulary.ORG;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class ObjectTypeTest {
@Test
void testOrganizationEnumValues() {
assertEquals("organization", ObjectType.getEnum(ORG.ORGANIZATION).labelType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package fr.insee.rmes.model.operations.documentations;

import org.eclipse.rdf4j.model.vocabulary.ORG;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class RangeTypeTest {

@Test
void testOrganizationEnumValues() {
assertEquals("ORGANIZATION", RangeType.getEnumByRdfType(ORG.ORGANIZATION).getJsonType());
}
}

0 comments on commit 3aa58f6

Please sign in to comment.