list) {
setFrom(list);
if (list != null && list.size() == 1) {
setOneFrom(true);
- setFromNode(graph.getGraphNode(getFrom().get(0)));
+ setFromNode(graph.getGraphNode(getFrom().getFirst()));
if (getFromNode() == null) {
setOneFrom(false);
}
diff --git a/src/main/java/fr/inria/corese/core/util/Property.java b/src/main/java/fr/inria/corese/core/util/Property.java
index 1543f67f5..ba2d239bc 100644
--- a/src/main/java/fr/inria/corese/core/util/Property.java
+++ b/src/main/java/fr/inria/corese/core/util/Property.java
@@ -228,7 +228,6 @@ public static void define(String name, String value) {
}
static void basicSet(Value value, boolean b) {
- logger.debug("{} = {}", value, b);
getSingleton().getBooleanProperty().put(value, b);
switch (value) {
@@ -430,7 +429,6 @@ static void basicSet(Value value, boolean b) {
}
static void basicSet(Value value, String... str) {
- logger.debug("{} = {}", value, str);
switch (value) {
case FEDERATE_BLACKLIST:
getSingleton().blacklist(str);
@@ -442,7 +440,6 @@ static void basicSet(Value value, String... str) {
}
static void basicSet(Value value, String str) {
- logger.debug("{} = {}", value, str);
getSingleton().getStringProperty().put(value, str);
switch (value) {
@@ -549,7 +546,6 @@ static void basicSet(Value value, String str) {
}
static void basicSet(Value value, int n) {
- logger.debug("{} = {}", value, n);
getSingleton().getIntegerProperty().put(value, n);
switch (value) {
@@ -687,10 +683,8 @@ private void imports() throws IOException {
String importPath = expand(name);
if (getImports().containsKey(importPath)) {
- logger.info("Skip import: " + importPath);
} else {
getImports().put(importPath, importPath);
- logger.info("Import: " + importPath);
try (FileReader importReader = new FileReader(importPath)) {
getProperties().load(importReader);
}
@@ -712,7 +706,7 @@ void defineProperty() {
try {
define(name, value);
} catch (Exception e) {
- logger.info("Incorrect Property: " + name + " " + value);
+ logger.error("Incorrect Property: " + name + " " + value);
}
}
}
@@ -774,7 +768,6 @@ void split(String list) {
for (String str : list.split(SEP)) {
alist.add(NSManager.nsm().toNamespace(str));
}
- logger.info("Split: " + alist);
FederateVisitor.DEFAULT_SPLIT = alist;
}
@@ -805,11 +798,6 @@ private void defineVariableMap() {
for (Pair pair : getValueListBasic(Value.VARIABLE)) {
String variable = varName(pair.getKey());
- if (getVariableMap().containsKey(variable)) {
- logger.info("Overload variable: " + variable);
- }
- logger.info(String.format("variable: %s=%s", variable, expand(pair.getValue())));
-
getVariableMap().put(variable, expand(pair.getValue()));
}
}
@@ -848,7 +836,6 @@ void queryPlan(String str) {
}
void defineFederation(String path) {
- logger.info("federation: " + path);
QueryProcess exec = QueryProcess.create(Graph.create());
try {
Graph g = exec.defineFederation(path);
@@ -861,7 +848,7 @@ void loadFunction(String str) {
QueryProcess exec = QueryProcess.create();
for (String name : str.split(SEP)) {
try {
- exec.imports(str);
+ exec.imports(name);
} catch (EngineException ex) {
logger.error(ex.toString());
}
@@ -923,7 +910,6 @@ void loadList(Graph g, String path) {
for (String name : path.split(SEP)) {
try {
String file = expand(name);
- logger.info("Load: " + file);
ld.parse(file.strip());
} catch (LoadException ex) {
logger.error(ex.toString());
@@ -939,7 +925,6 @@ void variable() {
for (Pair pair : getValueListBasic(Value.LDSCRIPT_VARIABLE)) {
String variable = pair.getKey().strip();
String val = pair.getValue().strip();
- logger.info(String.format("ldscript variable: %s=%s", variable, val));
IDatatype dt = DatatypeMap.newValue(val);
Binding.setStaticVariable(variable, dt);
}
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/FileFormatTest.java b/src/test/java/fr/inria/corese/core/next/api/base/io/FileFormatTest.java
similarity index 70%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/FileFormatTest.java
rename to src/test/java/fr/inria/corese/core/next/api/base/io/FileFormatTest.java
index 2e3308e18..92302b3d7 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/FileFormatTest.java
+++ b/src/test/java/fr/inria/corese/core/next/api/base/io/FileFormatTest.java
@@ -1,27 +1,19 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.api.base.io;
-import static org.junit.jupiter.api.Assertions.assertAll;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.*;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Stream;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.DisplayNameGeneration;
-import org.junit.jupiter.api.DisplayNameGenerator;
-import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
+import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for {@link FileFormat}.
+ * Unit tests for {@link fr.inria.corese.core.next.api.base.io.FileFormat}.
*
*
* Coverage :
@@ -64,7 +56,7 @@ void constructor_sets_all_fields(String name,
List extensions,
List mimeTypes) {
- FileFormat format = new FileFormat(name, extensions, mimeTypes);
+ fr.inria.corese.core.next.api.base.io.FileFormat format = new fr.inria.corese.core.next.api.base.io.FileFormat(name, extensions, mimeTypes);
assertAll("All getters reflect constructor arguments",
() -> assertEquals(name, format.getName(), "name"),
@@ -88,31 +80,31 @@ class Constructor_argument_validation {
@Test
void null_name_throws_NPE() {
assertThrows(NullPointerException.class,
- () -> new FileFormat(null, EXT, MIME));
+ () -> new fr.inria.corese.core.next.api.base.io.FileFormat(null, EXT, MIME));
}
@Test
void null_extensions_throws_NPE() {
assertThrows(NullPointerException.class,
- () -> new FileFormat("Turtle", null, MIME));
+ () -> new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", null, MIME));
}
@Test
void null_mimeTypes_throws_NPE() {
assertThrows(NullPointerException.class,
- () -> new FileFormat("Turtle", EXT, null));
+ () -> new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", EXT, null));
}
@Test
void empty_extensions_throws_IAE() {
assertThrows(IllegalArgumentException.class,
- () -> new FileFormat("Turtle", List.of(), MIME));
+ () -> new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", List.of(), MIME));
}
@Test
void empty_mimeTypes_throws_IAE() {
assertThrows(IllegalArgumentException.class,
- () -> new FileFormat("Turtle", EXT, List.of()));
+ () -> new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", EXT, List.of()));
}
}
@@ -126,7 +118,7 @@ void internal_lists_are_immutable_and_defensively_copied() {
// Build mutable lists
List ext = new ArrayList<>(List.of("ttl"));
List mime = new ArrayList<>(List.of("text/turtle"));
- FileFormat format = new FileFormat("Turtle", ext, mime);
+ fr.inria.corese.core.next.api.base.io.FileFormat format = new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", ext, mime);
// Mutate originals AFTER construction
ext.add("bad");
@@ -152,11 +144,11 @@ void internal_lists_are_immutable_and_defensively_copied() {
@Nested
class Equals_and_hashCode_contract {
- private final FileFormat base = new FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
+ private final fr.inria.corese.core.next.api.base.io.FileFormat base = new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
@Test
void symmetry_and_case_insensitivity() {
- FileFormat sameDifferentCase = new FileFormat("tUrTlE", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat sameDifferentCase = new fr.inria.corese.core.next.api.base.io.FileFormat("tUrTlE", List.of("ttl"), List.of("text/turtle"));
assertEquals(base, sameDifferentCase);
assertEquals(sameDifferentCase, base);
@@ -165,9 +157,9 @@ void symmetry_and_case_insensitivity() {
@Test
void transitivity() {
- FileFormat a = new FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
- FileFormat b = new FileFormat("TURTLE", List.of("ttl"), List.of("text/turtle"));
- FileFormat c = new FileFormat("turtle", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat a = new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat b = new fr.inria.corese.core.next.api.base.io.FileFormat("TURTLE", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat c = new fr.inria.corese.core.next.api.base.io.FileFormat("turtle", List.of("ttl"), List.of("text/turtle"));
assertAll(
() -> assertEquals(a, b),
@@ -177,9 +169,9 @@ void transitivity() {
@Test
void inequality_when_any_field_differs() {
- FileFormat diffName = new FileFormat("N-Triples", List.of("ttl"), List.of("text/turtle"));
- FileFormat diffExt = new FileFormat("Turtle", List.of("nt"), List.of("text/turtle"));
- FileFormat diffMime = new FileFormat("Turtle", List.of("ttl"), List.of("application/n-triples"));
+ fr.inria.corese.core.next.api.base.io.FileFormat diffName = new fr.inria.corese.core.next.api.base.io.FileFormat("N-Triples", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat diffExt = new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", List.of("nt"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat diffMime = new fr.inria.corese.core.next.api.base.io.FileFormat("Turtle", List.of("ttl"), List.of("application/n-triples"));
assertAll(
() -> assertNotEquals(base, diffName),
@@ -197,7 +189,7 @@ void inequality_when_any_field_differs() {
*/
@Test
void toString_contains_all_relevant_information() {
- FileFormat format = new FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
+ fr.inria.corese.core.next.api.base.io.FileFormat format = new FileFormat("Turtle", List.of("ttl"), List.of("text/turtle"));
String out = format.toString();
assertTrue(
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/RdfFormatTest.java b/src/test/java/fr/inria/corese/core/next/api/base/io/RDFFormatTest.java
similarity index 77%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/RdfFormatTest.java
rename to src/test/java/fr/inria/corese/core/next/api/base/io/RDFFormatTest.java
index 28f5da4b1..e5859edfa 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/RdfFormatTest.java
+++ b/src/test/java/fr/inria/corese/core/next/api/base/io/RDFFormatTest.java
@@ -1,4 +1,4 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.api.base.io;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -8,7 +8,7 @@
import static org.junit.jupiter.api.Assertions.*;
-class RdfFormatTest {
+class RDFFormatTest {
@Test
@@ -20,7 +20,7 @@ void constructorAndGetters() {
boolean supportsNamespaces = true;
boolean supportsNamedGraphs = false;
- RdfFormat format = new RdfFormat(name, extensions, mimeTypes, supportsNamespaces, supportsNamedGraphs);
+ RDFFormat format = new RDFFormat(name, extensions, mimeTypes, supportsNamespaces, supportsNamedGraphs);
assertEquals(name, format.getName(), "Name should match constructor argument");
assertEquals(extensions, format.getExtensions(), "Extensions list should match constructor argument");
@@ -38,7 +38,7 @@ void constructorThrowsForNullName() {
List extensions = List.of("tf");
List mimeTypes = List.of("text/plain");
assertThrows(NullPointerException.class,
- () -> new RdfFormat(null, extensions, mimeTypes, true, false),
+ () -> new RDFFormat(null, extensions, mimeTypes, true, false),
"Constructor should throw NPE for null name");
}
@@ -47,7 +47,7 @@ void constructorThrowsForNullName() {
void constructorThrowsForNullExtensions() {
List mimeTypes = List.of("text/plain");
assertThrows(NullPointerException.class,
- () -> new RdfFormat("Test", null, mimeTypes, true, false),
+ () -> new RDFFormat("Test", null, mimeTypes, true, false),
"Constructor should throw NPE for null extensions list");
}
@@ -57,7 +57,7 @@ void constructorThrowsForNullExtensions() {
void constructorThrowsForNullMimeTypes() {
List extensions = List.of("tf");
assertThrows(NullPointerException.class,
- () -> new RdfFormat("Test", extensions, null, true, false),
+ () -> new RDFFormat("Test", extensions, null, true, false),
"Constructor should throw NPE for null mimeTypes list");
}
@@ -65,7 +65,7 @@ void constructorThrowsForNullMimeTypes() {
@Test
@DisplayName("toString() should return a meaningful string representation")
void testToString() {
- RdfFormat format = RdfFormat.TURTLE;
+ RDFFormat format = RDFFormat.TURTLE;
String expected = "Turtle [extensions: ttl, mimeTypes: text/turtle, prefixes: true, namedGraphs: false]";
assertEquals(expected, format.toString(), "toString() should match expected format");
@@ -74,7 +74,7 @@ void testToString() {
@Test
@DisplayName("equals() should return true for identical objects")
void equalsIdenticalObjects() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, false);
assertEquals(format1, format1, "Object should be equal to itself");
}
@@ -82,8 +82,8 @@ void equalsIdenticalObjects() {
@Test
@DisplayName("equals() should return true for logically equal objects")
void equalsLogicallyEqualObjects() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("test", List.of("t"), List.of("text/t"), true, false); // Name case-insensitive
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("test", List.of("t"), List.of("text/t"), true, false); // Name case-insensitive
assertEquals(format1, format2, "Objects with same properties (case-insensitive name) should be equal");
}
@@ -91,8 +91,8 @@ void equalsLogicallyEqualObjects() {
@Test
@DisplayName("equals() should return false for objects with different names")
void equalsDifferentNames() {
- RdfFormat format1 = new RdfFormat("Test1", List.of("t"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("Test2", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test1", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("Test2", List.of("t"), List.of("text/t"), true, false);
assertNotEquals(format1, format2, "Objects with different names should not be equal");
}
@@ -100,8 +100,8 @@ void equalsDifferentNames() {
@Test
@DisplayName("equals() should return false for objects with different extensions")
void equalsDifferentExtensions() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t1"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("Test", List.of("t2"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t1"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("Test", List.of("t2"), List.of("text/t"), true, false);
assertNotEquals(format1, format2, "Objects with different extensions should not be equal");
}
@@ -109,8 +109,8 @@ void equalsDifferentExtensions() {
@Test
@DisplayName("equals() should return false for objects with different mimeTypes")
void equalsDifferentMimeTypes() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t1"), true, false);
- RdfFormat format2 = new RdfFormat("Test", List.of("t"), List.of("text/t2"), true, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t1"), true, false);
+ RDFFormat format2 = new RDFFormat("Test", List.of("t"), List.of("text/t2"), true, false);
assertNotEquals(format1, format2, "Objects with different mimeTypes should not be equal");
}
@@ -118,8 +118,8 @@ void equalsDifferentMimeTypes() {
@Test
@DisplayName("equals() should return false for objects with different supportsNamespaces")
void equalsDifferentSupportsNamespaces() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("Test", List.of("t"), List.of("text/t"), false, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("Test", List.of("t"), List.of("text/t"), false, false);
assertNotEquals(format1, format2, "Objects with different supportsNamespaces should not be equal");
}
@@ -127,8 +127,8 @@ void equalsDifferentSupportsNamespaces() {
@Test
@DisplayName("equals() should return false for objects with different supportsNamedGraphs")
void equalsDifferentSupportsNamedGraphs() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, true);
- RdfFormat format2 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, true);
+ RDFFormat format2 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, false);
assertNotEquals(format1, format2, "Objects with different supportsNamedGraphs should not be equal");
}
@@ -136,8 +136,8 @@ void equalsDifferentSupportsNamedGraphs() {
@Test
@DisplayName("hashCode() should be consistent with equals()")
void hashCodeConsistency() {
- RdfFormat format1 = new RdfFormat("Test", List.of("t"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("test", List.of("t"), List.of("text/t"), true, false);
assertEquals(format1, format2, "Objects should be equal");
assertEquals(format1.hashCode(), format2.hashCode(), "Hash codes must be equal for equal objects");
@@ -146,8 +146,8 @@ void hashCodeConsistency() {
@Test
@DisplayName("hashCode() should return different values for unequal objects (high probability)")
void hashCodeDifference() {
- RdfFormat format1 = new RdfFormat("Test1", List.of("t"), List.of("text/t"), true, false);
- RdfFormat format2 = new RdfFormat("Test2", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format1 = new RDFFormat("Test1", List.of("t"), List.of("text/t"), true, false);
+ RDFFormat format2 = new RDFFormat("Test2", List.of("t"), List.of("text/t"), true, false);
assertNotEquals(format1.hashCode(), format2.hashCode(), "Hash codes should ideally be different for unequal objects");
}
@@ -156,7 +156,7 @@ void hashCodeDifference() {
@Test
@DisplayName("TURTLE constant should be correctly defined")
void turtleConstant() {
- RdfFormat turtle = RdfFormat.TURTLE;
+ RDFFormat turtle = RDFFormat.TURTLE;
assertNotNull(turtle, "TURTLE constant should not be null");
assertEquals("Turtle", turtle.getName());
@@ -169,7 +169,7 @@ void turtleConstant() {
@Test
@DisplayName("NTRIPLES constant should be correctly defined")
void nTriplesConstant() {
- RdfFormat ntriples = RdfFormat.NTRIPLES;
+ RDFFormat ntriples = RDFFormat.NTRIPLES;
assertNotNull(ntriples, "NTRIPLES constant should not be null");
assertEquals("N-Triples", ntriples.getName());
@@ -182,7 +182,7 @@ void nTriplesConstant() {
@Test
@DisplayName("NQUADS constant should be correctly defined")
void nQuadsConstant() {
- RdfFormat nquads = RdfFormat.NQUADS;
+ RDFFormat nquads = RDFFormat.NQUADS;
assertNotNull(nquads, "NQUADS constant should not be null");
assertEquals("N-Quads", nquads.getName());
@@ -195,7 +195,7 @@ void nQuadsConstant() {
@Test
@DisplayName("JSONLD constant should be correctly defined")
void jsonLdConstant() {
- RdfFormat jsonld = RdfFormat.JSONLD;
+ RDFFormat jsonld = RDFFormat.JSONLD;
assertNotNull(jsonld, "JSONLD constant should not be null");
assertEquals("JSON-LD", jsonld.getName());
@@ -208,7 +208,7 @@ void jsonLdConstant() {
@Test
@DisplayName("RDFXML constant should be correctly defined")
void rdfXmlConstant() {
- RdfFormat rdfxml = RdfFormat.RDFXML;
+ RDFFormat rdfxml = RDFFormat.RDFXML;
assertNotNull(rdfxml, "RDFXML constant should not be null");
assertEquals("RDF/XML", rdfxml.getName());
@@ -222,7 +222,7 @@ void rdfXmlConstant() {
@Test
@DisplayName("TRIG constant should be correctly defined")
void trigConstant() {
- RdfFormat trig = RdfFormat.TRIG;
+ RDFFormat trig = RDFFormat.TRIG;
assertNotNull(trig, "TRIG constant should not be null");
assertEquals("TriG", trig.getName());
@@ -235,16 +235,16 @@ void trigConstant() {
@Test
@DisplayName("byName() should find existing format by name (case-insensitive)")
void byNameFound() {
- Optional format = RdfFormat.byName("TuRtLe");
+ Optional format = RDFFormat.byName("TuRtLe");
assertTrue(format.isPresent(), "Turtle format should be found by name");
- assertEquals(RdfFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
+ assertEquals(RDFFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
}
@Test
@DisplayName("byName() should return empty Optional for non-existent name")
void byNameNotFound() {
- Optional format = RdfFormat.byName("NonExistentFormat");
+ Optional format = RDFFormat.byName("NonExistentFormat");
assertFalse(format.isPresent(), "Non-existent format should not be found");
}
@@ -252,20 +252,20 @@ void byNameNotFound() {
@Test
@DisplayName("byExtension() should find existing format by extension (case-insensitive)")
void byExtensionFound() {
- Optional format = RdfFormat.byExtension("TTL");
+ Optional format = RDFFormat.byExtension("TTL");
assertTrue(format.isPresent(), "Turtle format should be found by extension");
- assertEquals(RdfFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
+ assertEquals(RDFFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
- Optional rdfXmlFormat = RdfFormat.byExtension("XML");
+ Optional rdfXmlFormat = RDFFormat.byExtension("XML");
assertTrue(rdfXmlFormat.isPresent());
- assertEquals(RdfFormat.RDFXML, rdfXmlFormat.get());
+ assertEquals(RDFFormat.RDFXML, rdfXmlFormat.get());
}
@Test
@DisplayName("byExtension() should return empty Optional for non-existent extension")
void byExtensionNotFound() {
- Optional format = RdfFormat.byExtension("xyz");
+ Optional format = RDFFormat.byExtension("xyz");
assertFalse(format.isPresent(), "Non-existent extension should not find a format");
}
@@ -273,21 +273,21 @@ void byExtensionNotFound() {
@Test
@DisplayName("byMimeType() should find existing format by MIME type (case-insensitive)")
void byMimeTypeFound() {
- Optional format = RdfFormat.byMimeType("text/TuRtLe");
+ Optional format = RDFFormat.byMimeType("text/TuRtLe");
assertTrue(format.isPresent(), "Turtle format should be found by MIME type");
- assertEquals(RdfFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
+ assertEquals(RDFFormat.TURTLE, format.get(), "Found format should be the TURTLE constant");
- Optional nTriplesFormat = RdfFormat.byMimeType("text/plain");
+ Optional nTriplesFormat = RDFFormat.byMimeType("text/plain");
assertTrue(nTriplesFormat.isPresent());
- assertEquals(RdfFormat.NTRIPLES, nTriplesFormat.get());
+ assertEquals(RDFFormat.NTRIPLES, nTriplesFormat.get());
}
@Test
@DisplayName("byMimeType() should return empty Optional for non-existent MIME type")
void byMimeTypeNotFound() {
- Optional format = RdfFormat.byMimeType("application/x-unknown");
+ Optional format = RDFFormat.byMimeType("application/x-unknown");
assertFalse(format.isPresent(), "Non-existent MIME type should not find a format");
}
@@ -295,19 +295,19 @@ void byMimeTypeNotFound() {
@Test
@DisplayName("all() should return a list containing all predefined formats")
void allFormats() {
- List allFormats = RdfFormat.all();
+ List allFormats = RDFFormat.all();
assertNotNull(allFormats, "List of all formats should not be null");
assertEquals(6, allFormats.size(), "List should contain 5 predefined formats"); // TURTLE, NTRIPLES, NQUADS, JSONLD, RDFXML, TRIG
- assertTrue(allFormats.contains(RdfFormat.TURTLE));
- assertTrue(allFormats.contains(RdfFormat.NTRIPLES));
- assertTrue(allFormats.contains(RdfFormat.NQUADS));
- assertTrue(allFormats.contains(RdfFormat.JSONLD));
- assertTrue(allFormats.contains(RdfFormat.RDFXML));
- assertTrue(allFormats.contains(RdfFormat.TRIG));
+ assertTrue(allFormats.contains(RDFFormat.TURTLE));
+ assertTrue(allFormats.contains(RDFFormat.NTRIPLES));
+ assertTrue(allFormats.contains(RDFFormat.NQUADS));
+ assertTrue(allFormats.contains(RDFFormat.JSONLD));
+ assertTrue(allFormats.contains(RDFFormat.RDFXML));
+ assertTrue(allFormats.contains(RDFFormat.TRIG));
- assertThrows(UnsupportedOperationException.class, () -> allFormats.add(RdfFormat.TURTLE),
+ assertThrows(UnsupportedOperationException.class, () -> allFormats.add(RDFFormat.TURTLE),
"The list returned by all() should be unmodifiable");
}
}
\ No newline at end of file
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/CircularJSONLDIOTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/CircularJSONLDIOTest.java
new file mode 100644
index 000000000..5aa7c5305
--- /dev/null
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/CircularJSONLDIOTest.java
@@ -0,0 +1,28 @@
+package fr.inria.corese.core.next.impl.io;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests the parser and serializer for the format JSON-LD
+ */
+public class CircularJSONLDIOTest {
+
+ @Test
+ public void basicJSONLDString() {
+ // TODO: implement this test
+ }
+
+ @Test
+ public void basicJSONLDFile() {
+ // TODO: implement this test
+ }
+
+ @Test
+ public void jsonldWithBlankNodes() {
+ // TODO: implement this test
+ }
+
+ @Test void jsonldWithNamedGraphs() {
+ // TODO: implement this test
+ }
+}
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/option/TitaniumJSONLDProcessorOptionTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/option/TitaniumJSONLDProcessorOptionTest.java
new file mode 100644
index 000000000..5b0ac465d
--- /dev/null
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/option/TitaniumJSONLDProcessorOptionTest.java
@@ -0,0 +1,96 @@
+package fr.inria.corese.core.next.impl.io.option;
+
+import com.apicatalog.jsonld.JsonLdVersion;
+import org.junit.jupiter.api.Test;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * Tests to check that values are properly set
+ */
+class TitaniumJSONLDProcessorOptionTest {
+
+ private TitaniumJSONLDProcessorOption optionAllTrue = new TitaniumJSONLDProcessorOption.Builder().base("http://example.org/AllTrue")
+ .extractAllScripts(true)
+ .compactToRelative(true)
+ .compactArrays(true)
+ .ordered(true)
+ .useRdfType(true)
+ .useNativeTypes(true)
+ .build();
+
+ private TitaniumJSONLDProcessorOption optionAllFalse = new TitaniumJSONLDProcessorOption.Builder().base("http://example.org/AllFalse")
+ .extractAllScripts(false)
+ .compactArrays(false)
+ .compactToRelative(false)
+ .ordered(false)
+ .useRdfType(false)
+ .useNativeTypes(false)
+ .build();
+
+ @Test
+ void isCompactArrays() {
+ assertTrue(optionAllTrue.compactsArrays());
+ assertFalse(optionAllFalse.compactsArrays());
+ }
+
+ @Test
+ void isCompactToRelative() {
+ assertTrue(optionAllTrue.compactsToRelative());
+ assertFalse(optionAllFalse.compactsToRelative());
+ }
+
+ @Test
+ void isExtractAllScripts() {
+ assertTrue(optionAllTrue.isExtractAllScripts());
+ assertFalse(optionAllFalse.isExtractAllScripts());
+ }
+
+ @Test
+ void isOrdered() {
+ assertTrue(optionAllTrue.isOrdered());
+ assertFalse(optionAllFalse.isOrdered());
+ }
+
+ @Test
+ void getProcessingMode() {
+ TitaniumJSONLDProcessorOption option10 = new TitaniumJSONLDProcessorOption.Builder().processingMode(JsonLdVersion.V1_0).build();
+ TitaniumJSONLDProcessorOption option11 = new TitaniumJSONLDProcessorOption.Builder().processingMode(JsonLdVersion.V1_1).build();
+ assertEquals(JsonLdVersion.V1_0, option10.getProcessingMode());
+ assertEquals(JsonLdVersion.V1_1, option11.getProcessingMode());
+ }
+
+ @Test
+ void getTimeout() {
+ TitaniumJSONLDProcessorOption option10seconds = new TitaniumJSONLDProcessorOption.Builder().timeout(Duration.of(10, ChronoUnit.SECONDS)).build();
+ assertNull(optionAllTrue.getTimeout());
+ assertEquals(Duration.of(10, ChronoUnit.SECONDS), option10seconds.getTimeout());
+ }
+
+ @Test
+ void isUseNativeTypes() {
+ assertTrue(optionAllTrue.usesNativeTypes());
+ assertFalse(optionAllFalse.usesNativeTypes());
+ }
+
+ @Test
+ void isUseRdfType() {
+ assertTrue(optionAllTrue.usesRdfType());
+ assertFalse(optionAllFalse.usesRdfType());
+ }
+
+ @Test
+ void getJsonLdOptions() {
+ assertNotNull(optionAllTrue.getJsonLdOptions());
+ assertNotNull(optionAllFalse.getJsonLdOptions());
+ }
+
+ @Test
+ void getBase() {
+ assertEquals("http://example.org/AllTrue", optionAllTrue.getBase());
+ assertEquals("http://example.org/AllFalse", optionAllFalse.getBase());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/parser/jsonld/JSONLDParserTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/parser/jsonld/JSONLDParserTest.java
new file mode 100644
index 000000000..08d7dbf72
--- /dev/null
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/parser/jsonld/JSONLDParserTest.java
@@ -0,0 +1,313 @@
+package fr.inria.corese.core.next.impl.io.parser.jsonld;
+
+import fr.inria.corese.core.next.api.*;
+import fr.inria.corese.core.next.api.base.io.RDFFormat;
+import fr.inria.corese.core.next.api.io.parser.RDFParser;
+import fr.inria.corese.core.next.impl.io.parser.ParserFactory;
+import fr.inria.corese.core.next.impl.temp.CoreseAdaptedValueFactory;
+import fr.inria.corese.core.next.impl.temp.CoreseModel;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayInputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class JSONLDParserTest {
+
+ private static final Logger logger = LoggerFactory.getLogger(JSONLDParserTest.class);
+ private final ParserFactory factory = new ParserFactory();
+ private final ValueFactory valueFactory = new CoreseAdaptedValueFactory();
+
+ @Test
+ void constructorNullModelThrowsTest() {
+ assertThrows(NullPointerException.class, () -> new JSONLDParser(null, valueFactory));
+ }
+
+ @Test
+ void constructorNullValueFactoryThrowsTest() {
+ assertThrows(NullPointerException.class, () -> new JSONLDParser(new CoreseModel(), null));
+ }
+
+ @Test
+ void constructorNullModelAndValueFactoryThrowsTest() {
+ assertThrows(NullPointerException.class, () -> new JSONLDParser(null, null));
+ }
+
+ @Test
+ void constructorConfigNoThrowsTest() {
+ assertDoesNotThrow(() -> new JSONLDParser(new CoreseModel(), valueFactory, null));
+ }
+
+ @Test
+ void getRDFFormatTest() {
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, new CoreseModel(), valueFactory);
+ assertEquals(RDFFormat.JSONLD, parser.getRDFFormat());
+ }
+
+ /**
+ * Test method for {@link JSONLDParser#parse(java.io.InputStream)}. No relative IRIs in this test.
+ */
+ @Test
+ public void testParseInputStream() {
+ // taken from https://www.w3.org/TR/json-ld-api/#object-to-rdf-conversion
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+ }
+ """;
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ parser.parse(new ByteArrayInputStream(sampleJsonLD.getBytes()));
+
+ assertEquals(3, model.size());
+ IRI subject = valueFactory.createIRI("http://me.markus-lanthaler.com/");
+ IRI namePredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/name");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ Literal nameMarkusObject = valueFactory.createLiteral("Markus Lanthaler");
+ Literal nameDaveObject = valueFactory.createLiteral("Dave Longley");
+ Statement daveNameStatement = valueFactory.createStatement(subject, namePredicate, nameMarkusObject);
+
+ assertTrue(model.contains(daveNameStatement));
+ assertTrue(model.contains(subject, knowsPredicate, null));
+ assertTrue(model.contains(null, namePredicate, nameDaveObject));
+ }
+
+ /**
+ * Test method for {@link JSONLDParser#parse(java.io.InputStream, java.lang.String)}. A relative IRI is used in this test.
+ */
+ @Test
+ public void testParseInputStreamString() {
+ // taken from https://www.w3.org/TR/json-ld-api/#object-to-rdf-conversion
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+ }
+ """;
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ parser.parse(new ByteArrayInputStream(sampleJsonLD.getBytes()), "http://me.markus-lanthaler.com/");
+
+ assertEquals(3, model.size());
+ IRI subject = valueFactory.createIRI("http://me.markus-lanthaler.com/");
+ IRI namePredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/name");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ Literal nameMarkusObject = valueFactory.createLiteral("Markus Lanthaler");
+ Literal nameDaveObject = valueFactory.createLiteral("Dave Longley");
+ Statement daveNameStatement = valueFactory.createStatement(subject, namePredicate, nameMarkusObject);
+
+ assertTrue(model.contains(daveNameStatement));
+ assertTrue(model.contains(subject, knowsPredicate, null));
+ assertTrue(model.contains(null, namePredicate, nameDaveObject));
+ }
+
+ /**
+ * Test of {@link JSONLDParser#parse(java.io.Reader, java.lang.String)}, of class JSONLDParser. No relative IRIs are used in this test.
+ */
+ @Test
+ public void testParseReader() {
+ // taken from https://www.w3.org/TR/json-ld-api/#object-to-rdf-conversion
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+ }
+ """;
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ parser.parse(new StringReader(sampleJsonLD));
+
+ assertEquals(3, model.size());
+ IRI subject = valueFactory.createIRI("http://me.markus-lanthaler.com/");
+ IRI namePredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/name");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ Literal nameMarkusObject = valueFactory.createLiteral("Markus Lanthaler");
+ Literal nameDaveObject = valueFactory.createLiteral("Dave Longley");
+ Statement daveNameStatement = valueFactory.createStatement(subject, namePredicate, nameMarkusObject);
+
+ assertTrue(model.contains(daveNameStatement));
+ assertTrue(model.contains(subject, knowsPredicate, null));
+ assertTrue(model.contains(null, namePredicate, nameDaveObject));
+ }
+
+ /**
+ * Test of {@link JSONLDParser#parse(java.io.Reader, java.lang.String)}, of class JSONLDParser. A relative IRI is used in this test.
+ */
+ @Test
+ public void testParseReaderString() {
+ // taken from https://www.w3.org/TR/json-ld-api/#object-to-rdf-conversion
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+ }
+ """;
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ parser.parse(new StringReader(sampleJsonLD), "http://me.markus-lanthaler.com/");
+
+ assertEquals(3, model.size());
+ IRI subject = valueFactory.createIRI("http://me.markus-lanthaler.com/");
+ IRI namePredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/name");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ Literal nameMarkusObject = valueFactory.createLiteral("Markus Lanthaler");
+ Literal nameDaveObject = valueFactory.createLiteral("Dave Longley");
+ Statement daveNameStatement = valueFactory.createStatement(subject, namePredicate, nameMarkusObject);
+
+ assertTrue(model.contains(daveNameStatement));
+ assertTrue(model.contains(subject, knowsPredicate, null));
+ assertTrue(model.contains(null, namePredicate, nameDaveObject));
+ }
+
+ /**
+ * Test parsing JSON-LD with blank nodes.
+ */
+ @Test
+ public void testParseJsonLDWithBlankNodes() {
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+
+ "@graph":
+ [
+ {
+ "@id": "_:b0",
+ "foaf:knows": {"@id": "_:b1"}
+ },
+
+ {
+ "@id": "_:b1",
+ "foaf:knows": {"@id": "_:b0"}
+ }
+ ]
+ }
+
+ """;
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ Reader reader = new StringReader(sampleJsonLD);
+ parser.parse(reader);
+
+ assertEquals(2, model.size());
+ BNode b0 = valueFactory.createBNode("b0");
+ BNode b1 = valueFactory.createBNode("b1");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ assertTrue(model.contains(b0, knowsPredicate, b1));
+ assertTrue(model.contains(b1, knowsPredicate, b0));
+ }
+
+ @Test
+ public void testParseJSONLDWithGraphs() {
+ // Taken from https://www.w3.org/TR/json-ld11/#named-graphs
+ String sampleJsonLD = """
+ {
+ "@context": {
+ "generatedAt": {
+ "@id": "http://www.w3.org/ns/prov#generatedAtTime"
+ },
+ "Person": {
+ "@id": "http://xmlns.com/foaf/0.1/Person"
+ },
+ "name": {
+ "@id": "http://xmlns.com/foaf/0.1/name"
+ },
+ "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
+ },
+ "@id": "http://example.org/foaf-graph",
+ "generatedAt": {
+ "@value": "2012-04-09T00:00:00",
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+ },
+ "@graph": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "knows": "https://greggkellogg.net/foaf#me"
+ }, {
+ "@id": "https://greggkellogg.net/foaf#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+ ]
+ }
+ """;
+
+ Model model = new CoreseModel();
+ RDFParser parser = factory.createRDFParser(RDFFormat.JSONLD, model, valueFactory);
+ parser.parse(new StringReader(sampleJsonLD));
+
+ assertEquals(7, model.size());
+ Resource graphIRI = valueFactory.createIRI("http://example.org/foaf-graph");
+ IRI generatedAt = valueFactory.createIRI("http://www.w3.org/ns/prov#generatedAtTime");
+ IRI datetimeDatatype = valueFactory.createIRI("http://www.w3.org/2001/XMLSchema#dateTime");
+ Literal generatedAtValue = valueFactory.createLiteral("2012-04-09T00:00:00", datetimeDatatype) ;
+ IRI manuIRI = valueFactory.createIRI("http://manu.sporny.org/about#manu");
+ Literal manuName = valueFactory.createLiteral("Manu Sporny");
+ IRI greggIRI = valueFactory.createIRI("https://greggkellogg.net/foaf#me");
+ Literal greggName = valueFactory.createLiteral("Gregg Kellogg");
+ IRI typeIRI = valueFactory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+ IRI knowsPredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/knows");
+ IRI personType = valueFactory.createIRI("http://xmlns.com/foaf/0.1/Person");
+ IRI namePredicate = valueFactory.createIRI("http://xmlns.com/foaf/0.1/name");
+
+ // .
+ assertTrue(model.contains(manuIRI, knowsPredicate, greggIRI, graphIRI));
+ // "Gregg Kellogg" .
+ assertTrue(model.contains(greggIRI, namePredicate, greggName, graphIRI));
+ // .
+ assertTrue(model.contains(greggIRI, knowsPredicate, manuIRI, graphIRI));
+ // .
+ assertTrue(model.contains(manuIRI, typeIRI, personType, graphIRI));
+ // "2012-04-09T00:00:00"^^ .
+ assertTrue(model.contains(graphIRI, generatedAt, generatedAtValue));
+ // "Manu Sporny" .
+ assertTrue(model.contains(manuIRI, namePredicate, manuName, graphIRI));
+ // .
+ assertTrue(model.contains(greggIRI, typeIRI, personType, graphIRI));
+ }
+}
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserSpec.java b/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserTest.java
similarity index 91%
rename from src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserSpec.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserTest.java
index 6d8f12c83..13a245645 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserSpec.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/ANTLRTurtleParserTest.java
@@ -2,7 +2,7 @@
import fr.inria.corese.core.next.api.Model;
import fr.inria.corese.core.next.api.ValueFactory;
-import fr.inria.corese.core.next.api.base.parser.RDFParser;
+import fr.inria.corese.core.next.api.io.parser.RDFParser;
import fr.inria.corese.core.next.impl.temp.CoreseAdaptedValueFactory;
import fr.inria.corese.core.next.impl.temp.CoreseModel;
import org.junit.jupiter.api.Test;
@@ -11,7 +11,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
-public class ANTLRTurtleParserSpec {
+public class ANTLRTurtleParserTest {
private Model parseFromString(String turtleData, String baseURI) throws Exception {
Model model = new CoreseModel();
ValueFactory factory = new CoreseAdaptedValueFactory();
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplSpec.java b/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplTest.java
similarity index 93%
rename from src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplSpec.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplTest.java
index 3f7326452..7d7a15bc0 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplSpec.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/parser/turtle/TurtleListenerImplTest.java
@@ -18,7 +18,7 @@
import static org.junit.jupiter.api.Assertions.*;
-public class TurtleListenerImplSpec {
+public class TurtleListenerImplTest {
private Model parseAndPrintModel(String turtleData) throws Exception {
ValueFactory factory = new CoreseAdaptedValueFactory();
@@ -30,20 +30,9 @@ private Model parseAndPrintModel(String turtleData) throws Exception {
ParseTree tree = parser.turtleDoc();
Model model = new CoreseModel();
- TurtleListenerImpl listener = new TurtleListenerImpl(model, null, factory);
+ TurtleListenerImpl listener = new TurtleListenerImpl(model, factory, null);
walker.walk((ParseTreeListener) listener, tree);
-
- /*
- model.forEach(stmt -> {
- System.out.println(stmt.getSubject().stringValue() + " " +
- stmt.getPredicate().stringValue() + " " +
- stmt.getObject().stringValue());
- });
-
- */
-
-
return model;
}
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/DefaultSerializerFactoryTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/DefaultSerializerFactoryTest.java
similarity index 72%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/DefaultSerializerFactoryTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/DefaultSerializerFactoryTest.java
index b6ad13c7e..cbc605952 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/DefaultSerializerFactoryTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/DefaultSerializerFactoryTest.java
@@ -1,8 +1,14 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization;
import fr.inria.corese.core.next.api.Model;
-import fr.inria.corese.core.next.api.RdfSerializer;
-import fr.inria.corese.core.next.api.SerializationConfig;
+import fr.inria.corese.core.next.api.base.io.RDFFormat;
+import fr.inria.corese.core.next.api.io.serialization.RDFSerializer;
+import fr.inria.corese.core.next.api.io.serialization.SerializationOption;
+import fr.inria.corese.core.next.impl.io.serialization.nquads.NQuadsSerializer;
+import fr.inria.corese.core.next.impl.io.serialization.ntriples.NTriplesSerializer;
+import fr.inria.corese.core.next.impl.io.serialization.rdfxml.XmlSerializer;
+import fr.inria.corese.core.next.impl.io.serialization.trig.TriGSerializer;
+import fr.inria.corese.core.next.impl.io.serialization.turtle.TurtleSerializer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -15,28 +21,28 @@
/**
* Unit tests for the {@link DefaultSerializerFactory} class.
* This class verifies that the factory correctly creates instances of
- * various {@link RdfSerializer} implementations based on the provided
- * {@link RdfFormat} and handles null inputs gracefully.
+ * various {@link RDFSerializer} implementations based on the provided
+ * {@link RDFFormat} and handles null inputs gracefully.
*/
class DefaultSerializerFactoryTest {
private DefaultSerializerFactory factory;
private Model mockModel;
- private SerializationConfig mockConfig;
+ private SerializationOption mockConfig;
@BeforeEach
void setUp() {
factory = new DefaultSerializerFactory();
mockModel = mock(Model.class);
- mockConfig = mock(SerializationConfig.class);
+ mockConfig = mock(SerializationOption.class);
}
@Test
@DisplayName("createSerializer should return TurtleSerializer for TURTLE format")
void createSerializer_shouldReturnTurtleSerializer_forTurtleFormat() {
try (MockedConstruction mockedConstruction = mockConstruction(TurtleSerializer.class)) {
- RdfSerializer serializer = factory.createSerializer(RdfFormat.TURTLE, mockModel, mockConfig);
+ RDFSerializer serializer = factory.createSerializer(RDFFormat.TURTLE, mockModel, mockConfig);
assertNotNull(serializer);
assertTrue(serializer instanceof TurtleSerializer);
@@ -48,7 +54,7 @@ void createSerializer_shouldReturnTurtleSerializer_forTurtleFormat() {
@DisplayName("createSerializer should return NTriplesSerializer for NTRIPLES format")
void createSerializer_shouldReturnNTriplesSerializer_forNTriplesFormat() {
try (MockedConstruction mockedConstruction = mockConstruction(NTriplesSerializer.class)) {
- RdfSerializer serializer = factory.createSerializer(RdfFormat.NTRIPLES, mockModel, mockConfig);
+ RDFSerializer serializer = factory.createSerializer(RDFFormat.NTRIPLES, mockModel, mockConfig);
assertNotNull(serializer);
assertTrue(serializer instanceof NTriplesSerializer);
@@ -60,7 +66,7 @@ void createSerializer_shouldReturnNTriplesSerializer_forNTriplesFormat() {
@DisplayName("createSerializer should return NQuadsSerializer for NQUADS format")
void createSerializer_shouldReturnNQuadsSerializer_forNQuadsFormat() {
try (MockedConstruction mockedConstruction = mockConstruction(NQuadsSerializer.class)) {
- RdfSerializer serializer = factory.createSerializer(RdfFormat.NQUADS, mockModel, mockConfig);
+ RDFSerializer serializer = factory.createSerializer(RDFFormat.NQUADS, mockModel, mockConfig);
assertNotNull(serializer);
assertTrue(serializer instanceof NQuadsSerializer);
@@ -72,7 +78,7 @@ void createSerializer_shouldReturnNQuadsSerializer_forNQuadsFormat() {
@DisplayName("createSerializer should return TriGSerializer for TRIG format")
void createSerializer_shouldReturnTriGSerializer_forTriGFormat() {
try (MockedConstruction mockedConstruction = mockConstruction(TriGSerializer.class)) {
- RdfSerializer serializer = factory.createSerializer(RdfFormat.TRIG, mockModel, mockConfig);
+ RDFSerializer serializer = factory.createSerializer(RDFFormat.TRIG, mockModel, mockConfig);
assertNotNull(serializer);
assertTrue(serializer instanceof TriGSerializer);
@@ -84,7 +90,7 @@ void createSerializer_shouldReturnTriGSerializer_forTriGFormat() {
@DisplayName("createSerializer should return XmlSerializer for RDFXML format")
void createSerializer_shouldReturnXmlSerializer_forRdfXmlFormat() {
try (MockedConstruction mockedConstruction = mockConstruction(XmlSerializer.class)) {
- RdfSerializer serializer = factory.createSerializer(RdfFormat.RDFXML, mockModel, mockConfig);
+ RDFSerializer serializer = factory.createSerializer(RDFFormat.RDFXML, mockModel, mockConfig);
assertNotNull(serializer);
assertTrue(serializer instanceof XmlSerializer);
@@ -97,14 +103,14 @@ void createSerializer_shouldReturnXmlSerializer_forRdfXmlFormat() {
void createSerializer_shouldThrowNPE_forNullFormat() {
assertThrows(NullPointerException.class,
() -> factory.createSerializer(null, mockModel, mockConfig),
- "Should throw NullPointerException for null RdfFormat");
+ "Should throw NullPointerException for null RDFFormat");
}
@Test
@DisplayName("createSerializer should throw NullPointerException for a null model")
void createSerializer_shouldThrowNPE_forNullModel() {
assertThrows(NullPointerException.class,
- () -> factory.createSerializer(RdfFormat.TURTLE, null, mockConfig),
+ () -> factory.createSerializer(RDFFormat.TURTLE, null, mockConfig),
"Should throw NullPointerException for null Model");
}
@@ -112,7 +118,7 @@ void createSerializer_shouldThrowNPE_forNullModel() {
@DisplayName("createSerializer should throw NullPointerException for a null config")
void createSerializer_shouldThrowNPE_forNullConfig() {
assertThrows(NullPointerException.class,
- () -> factory.createSerializer(RdfFormat.TURTLE, mockModel, null),
+ () -> factory.createSerializer(RDFFormat.TURTLE, mockModel, null),
"Should throw NullPointerException for null SerializationConfig");
}
}
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TestStatementFactory.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/TestStatementFactory.java
similarity index 98%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/TestStatementFactory.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/TestStatementFactory.java
index 3fd8dc034..b16e046a1 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TestStatementFactory.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/TestStatementFactory.java
@@ -1,4 +1,4 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization;
import fr.inria.corese.core.next.api.IRI;
import fr.inria.corese.core.next.api.Literal;
diff --git a/src/test/java/fr/inria/corese/core/next/impl/io/serialization/jsonld/JSONLDSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/jsonld/JSONLDSerializerTest.java
new file mode 100644
index 000000000..b8a97059d
--- /dev/null
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/jsonld/JSONLDSerializerTest.java
@@ -0,0 +1,233 @@
+package fr.inria.corese.core.next.impl.io.serialization.jsonld;
+
+import com.apicatalog.jsonld.json.JsonLdComparison;
+import fr.inria.corese.core.next.api.*;
+import fr.inria.corese.core.next.api.io.serialization.RDFSerializer;
+import fr.inria.corese.core.next.impl.io.option.TitaniumJSONLDProcessorOption;
+import fr.inria.corese.core.next.impl.temp.CoreseAdaptedValueFactory;
+import fr.inria.corese.core.next.impl.temp.CoreseModel;
+import jakarta.json.Json;
+import jakarta.json.JsonReader;
+import jakarta.json.JsonReaderFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class JSONLDSerializerTest {
+
+ private Model model;
+ private ValueFactory factory = new CoreseAdaptedValueFactory();
+ private IRI iriNode = factory.createIRI("http://example.org/iri1");
+ private IRI iriPred = factory.createIRI("http://example.org/pred1");
+ private Literal basicLiteral = factory.createLiteral("literal1");
+ private Literal typedLiteral = factory.createLiteral("literal2", factory.createIRI("http://example.org/datatype1"));
+ private Literal langLiteral = factory.createLiteral("literal3", "en");
+ private BNode blankNode = factory.createBNode("blank1");
+ private IRI graph1 = factory.createIRI("http://example.org/graph1");
+ private IRI graph2 = factory.createIRI("http://example.org/graph2");
+
+ @BeforeEach
+ public void setUp() {
+ model = new CoreseModel();
+ }
+
+ /**
+ * Check that the serializer can handle a small model with all types of literals
+ */
+ @Test
+ public void smallModelTest() {
+ // IRI IRI IRI
+ this.model.add(iriNode, iriPred, iriNode);
+ // IRI IRI Literal
+ this.model.add(iriNode, iriPred, basicLiteral);
+ // IRI IRI TypedLiteral
+ this.model.add(iriNode, iriPred, typedLiteral);
+ // IRI IRI LangLiteral
+ this.model.add(iriNode, iriPred, langLiteral);
+
+ RDFSerializer serializer = new JSONLDSerializer(this.model, (new TitaniumJSONLDProcessorOption.Builder()).ordered(true).build());
+
+ StringWriter writer = new StringWriter();
+
+ serializer.write(writer);
+ String result = writer.toString();
+
+ String expectedResult = """
+ [
+ {
+ "@id": "http://example.org/iri1",
+ "http://example.org/pred1": [
+ {
+ "@id": "http://example.org/iri1"
+ },
+ {
+ "@value": "literal1"
+ },
+ {
+ "@value": "literal2",
+ "@type": "http://example.org/datatype1"
+ },
+ {
+ "@language": "en",
+ "@value": "literal3"
+ }
+ ]
+ }
+ ]
+ """.replace('\n', ' ').replaceAll("\\s+", "");
+
+ Reader resultReader = new StringReader(result);
+ Reader expectedResultReader = new StringReader(expectedResult);
+
+ JsonReaderFactory factory = Json.createReaderFactory(null);
+ JsonReader resultJsonReader = factory.createReader(resultReader);
+ JsonReader expectedResultJsonReader = factory.createReader(expectedResultReader);
+ assertTrue(JsonLdComparison.equals(resultJsonReader.readValue(), expectedResultJsonReader.readValue()), "The result should be the expected JSON object");
+ }
+
+ /**
+ * Test the serialization of a model with blank nodes.
+ */
+ @Test
+ public void modelWithBlankNodesTest() {
+ // IRI IRI BlankNode
+ this.model.add(iriNode, iriPred, blankNode);
+ // BlankNode IRI IRI
+ this.model.add(blankNode, iriPred, iriNode);
+ // BlankNode IRI Literal
+ this.model.add(blankNode, iriPred, basicLiteral);
+ // BlankNode IRI BlankNode
+ this.model.add(blankNode, iriPred, blankNode);
+
+ RDFSerializer serializer = new JSONLDSerializer(this.model);
+
+ StringWriter writer = new StringWriter();
+ serializer.write(writer);
+ String result = writer.toString();
+
+ String expectedResult = """
+[
+ {
+ "@id":"http://example.org/iri1",
+ "http://example.org/pred1":[
+ {"@id":"blank1"}
+ ]
+ },
+ {
+ "@id":"blank1",
+ "http://example.org/pred1":[
+ {
+ "@id":"http://example.org/iri1"
+ },
+ {
+ "@id":"blank1"
+ },
+ {
+ "@value":"literal1"
+ }
+ ]
+ }
+]
+ """.replace('\n', ' ').replaceAll("\\s+", "");
+
+ Reader resultReader = new StringReader(result);
+ Reader expectedResultReader = new StringReader(expectedResult);
+
+ JsonReaderFactory factory = Json.createReaderFactory(null);
+ JsonReader resultJsonReader = factory.createReader(resultReader);
+ JsonReader expectedResultJsonReader = factory.createReader(expectedResultReader);
+ assertTrue(JsonLdComparison.equals(resultJsonReader.readValue(), expectedResultJsonReader.readValue()), "The result should be " + expectedResult);
+ }
+
+ /**
+ * Test the serialization of a model with named graphs.
+ */
+ @Test
+ public void modelWithNamedGraphsTest() {
+ // IRI IRI IRI
+ this.model.add(iriNode, iriPred, iriNode);
+ // IRI IRI Literal
+ this.model.add(iriNode, iriPred, basicLiteral, graph1);
+ // IRI IRI TypedLiteral
+ this.model.add(iriNode, iriPred, typedLiteral, graph2);
+ // IRI IRI LangLiteral
+ this.model.add(iriNode, iriPred, langLiteral, graph1, graph2);
+
+ RDFSerializer serializer = new JSONLDSerializer(this.model);
+
+ StringWriter writer = new StringWriter();
+ serializer.write(writer);
+ String result = writer.toString();
+
+ String expectedResult = """
+[
+ {
+ "@id":"http://example.org/iri1",
+ "http://example.org/pred1":[
+ {
+ "@id":"http://example.org/iri1"
+ },
+ {
+ "@value":"literal1"
+ },
+ {
+ "@value":"literal2",
+ "@type":"http://example.org/datatype1"
+ },
+ {
+ "@language":"en",
+ "@value":"literal3"
+ }
+ ]
+ },
+ {
+ "@id":"http://example.org/graph1",
+ "@graph":[
+ {
+ "@id":"http://example.org/iri1",
+ "http://example.org/pred1":[
+ {
+ "@value":"literal1"
+ },
+ {
+ "@language":"en",
+ "@value":"literal3"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "@id":"http://example.org/graph2",
+ "@graph":[
+ {
+ "@id":"http://example.org/iri1",
+ "http://example.org/pred1":[
+ {
+ "@value":"literal2",
+ "@type":"http://example.org/datatype1"
+ },
+ {
+ "@language":"en",
+ "@value":"literal3"
+ }
+ ]
+ }
+ ]
+ }
+]
+ """.replace('\n', ' ').replaceAll("\\s+", "");
+ Reader resultReader = new StringReader(result);
+ Reader expectedResultReader = new StringReader(expectedResult);
+
+ JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(null);
+ JsonReader resultJsonReader = jsonReaderFactory.createReader(resultReader);
+ JsonReader expectedResultJsonReader = jsonReaderFactory.createReader(expectedResultReader);
+ assertTrue(JsonLdComparison.equals(resultJsonReader.readValue(), expectedResultJsonReader.readValue()), "The result should be the " + expectedResult);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NQuadsConfigTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsOptionTest.java
similarity index 80%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NQuadsConfigTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsOptionTest.java
index 8fdb09247..2b0428c11 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NQuadsConfigTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsOptionTest.java
@@ -1,25 +1,26 @@
-package fr.inria.corese.core.next.impl.common.serialization.config;
+package fr.inria.corese.core.next.impl.io.serialization.nquads;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for the {@link NQuadsConfig} class.
+ * Unit tests for the {@link NQuadsOption} class.
* These tests verify the default configuration settings and the functionality
* of the builder pattern for customizing N-Quads serialization options.
*/
-class NQuadsConfigTest {
+class NQuadsOptionTest {
@Test
@DisplayName("defaultConfig() should return a config with expected N-Quads defaults")
void defaultConfig_shouldReturnExpectedDefaults() {
- NQuadsConfig config = NQuadsConfig.defaultConfig();
+ NQuadsOption config = NQuadsOption.defaultConfig();
assertNotNull(config, "Default config should not be null");
- assertTrue(config.strictMode, "Default strictMode should be true for N-Quads");
+ assertTrue(config.isStrictMode(), "Default strictMode should be true for N-Quads");
assertTrue(config.escapeUnicode(), "Default escapeUnicode should be true for N-Quads");
assertEquals(LiteralDatatypePolicyEnum.ALWAYS_TYPED, config.getLiteralDatatypePolicy(), "Default literalDatatypePolicy should be ALWAYS_TYPED");
assertNull(config.getBaseIRI(), "Default baseIRI should be null");
@@ -31,7 +32,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
@Test
@DisplayName("Builder should allow overriding includeContext")
void builder_shouldAllowOverridingIncludeContext() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.includeContext(false)
.build();
@@ -41,7 +42,7 @@ void builder_shouldAllowOverridingIncludeContext() {
@Test
@DisplayName("Builder should allow overriding literalDatatypePolicy")
void builder_shouldAllowOverridingLiteralDatatypePolicy() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.build();
@@ -51,7 +52,7 @@ void builder_shouldAllowOverridingLiteralDatatypePolicy() {
@Test
@DisplayName("Builder should allow overriding escapeUnicode")
void builder_shouldAllowOverridingEscapeUnicode() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.escapeUnicode(false)
.build();
@@ -61,18 +62,18 @@ void builder_shouldAllowOverridingEscapeUnicode() {
@Test
@DisplayName("Builder should allow overriding strictMode")
void builder_shouldAllowOverridingStrictMode() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.strictMode(false)
.build();
- assertFalse(config.strictMode, "strictMode should be overridden to false");
+ assertFalse(config.isStrictMode(), "strictMode should be overridden to false");
}
@Test
@DisplayName("Builder should allow setting baseIRI")
void builder_shouldAllowSettingBaseIRI() {
String testBaseIRI = "http://example.org/base/";
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.baseIRI(testBaseIRI)
.build();
@@ -83,7 +84,7 @@ void builder_shouldAllowSettingBaseIRI() {
@DisplayName("Builder should allow setting lineEnding")
void builder_shouldAllowSettingLineEnding() {
String customLineEnding = "\r\n";
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.lineEnding(customLineEnding)
.build();
@@ -93,7 +94,7 @@ void builder_shouldAllowSettingLineEnding() {
@Test
@DisplayName("Builder should allow overriding validateURIs")
void builder_shouldAllowOverridingValidateURIs() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.validateURIs(true)
.build();
@@ -103,7 +104,7 @@ void builder_shouldAllowOverridingValidateURIs() {
@Test
@DisplayName("Builder should allow overriding stableBlankNodeIds")
void builder_shouldAllowOverridingStableBlankNodeIds() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.stableBlankNodeIds(true)
.build();
@@ -113,7 +114,7 @@ void builder_shouldAllowOverridingStableBlankNodeIds() {
@Test
@DisplayName("Builder should handle null values for optional fields gracefully (e.g., baseIRI)")
void builder_shouldHandleNullForOptionalFields() {
- NQuadsConfig config = NQuadsConfig.builder()
+ NQuadsOption config = NQuadsOption.builder()
.baseIRI(null)
.build();
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/NQuadsSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsSerializerTest.java
similarity index 97%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/NQuadsSerializerTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsSerializerTest.java
index 2feaa385b..ea3f653a9 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/NQuadsSerializerTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/nquads/NQuadsSerializerTest.java
@@ -1,8 +1,9 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization.nquads;
import fr.inria.corese.core.next.api.*;
-import fr.inria.corese.core.next.impl.common.serialization.config.NQuadsConfig;
+import fr.inria.corese.core.next.impl.io.serialization.TestStatementFactory;
import fr.inria.corese.core.next.impl.exception.SerializationException;
+
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -21,7 +22,7 @@
class NQuadsSerializerTest {
private Model model;
- private NQuadsConfig config;
+ private NQuadsOption config;
private NQuadsSerializer nQuadsSerializer;
private TestStatementFactory factory;
@@ -40,7 +41,7 @@ class NQuadsSerializerTest {
@BeforeEach
void setUp() {
model = mock(Model.class);
- config = NQuadsConfig.defaultConfig();
+ config = NQuadsOption.defaultConfig();
nQuadsSerializer = new NQuadsSerializer(model, config);
factory = new TestStatementFactory();
@@ -262,7 +263,7 @@ void shouldHandleLiteralsWithLanguageTags() throws SerializationException {
Writer writer = new StringWriter();
- NQuadsSerializer serializer = new NQuadsSerializer(currentTestModel, NQuadsConfig.defaultConfig());
+ NQuadsSerializer serializer = new NQuadsSerializer(currentTestModel, NQuadsOption.defaultConfig());
serializer.write(writer);
String expectedOutput = String.format("<%s> <%s> \"%s\"@%s",
@@ -285,7 +286,7 @@ void shouldHandleLiteralsWithCustomDatatypes() throws SerializationException {
Model currentTestModel = mock(Model.class);
when(currentTestModel.iterator()).thenReturn(new MockStatementIterator(stmt));
- NQuadsSerializer serializer = new NQuadsSerializer(currentTestModel, NQuadsConfig.defaultConfig());
+ NQuadsSerializer serializer = new NQuadsSerializer(currentTestModel, NQuadsOption.defaultConfig());
StringWriter writer = new StringWriter();
serializer.write(writer);
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NTriplesConfigTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesOptionTest.java
similarity index 79%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NTriplesConfigTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesOptionTest.java
index 0f7ec0927..d4b4f7d42 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/NTriplesConfigTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesOptionTest.java
@@ -1,25 +1,26 @@
-package fr.inria.corese.core.next.impl.common.serialization.config;
+package fr.inria.corese.core.next.impl.io.serialization.ntriples;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for the {@link NTriplesConfig} class.
+ * Unit tests for the {@link NTriplesOption} class.
* These tests verify the default configuration settings and the functionality
* of the builder pattern for customizing N-Triples serialization options.
*/
-class NTriplesConfigTest {
+class NTriplesOptionTest {
@Test
@DisplayName("defaultConfig() should return a config with expected N-Triples defaults")
void defaultConfig_shouldReturnExpectedDefaults() {
- NTriplesConfig config = NTriplesConfig.defaultConfig();
+ NTriplesOption config = NTriplesOption.defaultConfig();
assertNotNull(config, "Default config should not be null");
- assertTrue(config.strictMode, "Default strictMode should be true for N-Triples");
+ assertTrue(config.isStrictMode(), "Default strictMode should be true for N-Triples");
assertTrue(config.escapeUnicode(), "Default escapeUnicode should be true for N-Triples");
assertEquals(LiteralDatatypePolicyEnum.ALWAYS_TYPED, config.getLiteralDatatypePolicy(), "Default literalDatatypePolicy should be ALWAYS_TYPED");
assertNull(config.getBaseIRI(), "Default baseIRI should be null");
@@ -31,7 +32,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
@Test
@DisplayName("Builder should allow overriding includeContext")
void builder_shouldAllowOverridingIncludeContext() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.includeContext(true)
.build();
@@ -41,7 +42,7 @@ void builder_shouldAllowOverridingIncludeContext() {
@Test
@DisplayName("Builder should allow overriding literalDatatypePolicy")
void builder_shouldAllowOverridingLiteralDatatypePolicy() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.build();
@@ -51,7 +52,7 @@ void builder_shouldAllowOverridingLiteralDatatypePolicy() {
@Test
@DisplayName("Builder should allow overriding escapeUnicode")
void builder_shouldAllowOverridingEscapeUnicode() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.escapeUnicode(false)
.build();
@@ -61,18 +62,18 @@ void builder_shouldAllowOverridingEscapeUnicode() {
@Test
@DisplayName("Builder should allow overriding strictMode")
void builder_shouldAllowOverridingStrictMode() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.strictMode(false)
.build();
- assertFalse(config.strictMode, "strictMode should be overridden to false");
+ assertFalse(config.isStrictMode(), "strictMode should be overridden to false");
}
@Test
@DisplayName("Builder should allow setting baseIRI")
void builder_shouldAllowSettingBaseIRI() {
String testBaseIRI = "http://example.org/base/";
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.baseIRI(testBaseIRI)
.build();
@@ -83,7 +84,7 @@ void builder_shouldAllowSettingBaseIRI() {
@DisplayName("Builder should allow setting lineEnding")
void builder_shouldAllowSettingLineEnding() {
String customLineEnding = "\r\n";
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.lineEnding(customLineEnding)
.build();
@@ -93,7 +94,7 @@ void builder_shouldAllowSettingLineEnding() {
@Test
@DisplayName("Builder should allow overriding validateURIs")
void builder_shouldAllowOverridingValidateURIs() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.validateURIs(true)
.build();
@@ -103,7 +104,7 @@ void builder_shouldAllowOverridingValidateURIs() {
@Test
@DisplayName("Builder should allow overriding stableBlankNodeIds")
void builder_shouldAllowOverridingStableBlankNodeIds() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.stableBlankNodeIds(true)
.build();
@@ -113,7 +114,7 @@ void builder_shouldAllowOverridingStableBlankNodeIds() {
@Test
@DisplayName("Builder should handle null values for optional fields gracefully (e.g., baseIRI)")
void builder_shouldHandleNullForOptionalFields() {
- NTriplesConfig config = NTriplesConfig.builder()
+ NTriplesOption config = NTriplesOption.builder()
.baseIRI(null)
.build();
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/NTriplesSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesSerializerTest.java
similarity index 88%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/NTriplesSerializerTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesSerializerTest.java
index aa51f1536..07b4088f1 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/NTriplesSerializerTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/ntriples/NTriplesSerializerTest.java
@@ -1,13 +1,15 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization.ntriples;
import fr.inria.corese.core.next.api.*;
-import fr.inria.corese.core.next.impl.common.serialization.config.NTriplesConfig;
+import fr.inria.corese.core.next.impl.io.serialization.TestStatementFactory;
import fr.inria.corese.core.next.impl.exception.SerializationException;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import org.mockito.Mockito;
import java.io.IOException;
import java.io.StringWriter;
@@ -21,7 +23,7 @@
class NTriplesSerializerTest {
private Model model;
- private NTriplesConfig config;
+ private NTriplesOption config;
private NTriplesSerializer nTriplesSerializer;
private TestStatementFactory factory;
@@ -40,7 +42,7 @@ class NTriplesSerializerTest {
@BeforeEach
void setUp() {
model = mock(Model.class);
- config = NTriplesConfig.defaultConfig();
+ config = NTriplesOption.defaultConfig();
nTriplesSerializer = new NTriplesSerializer(model, config);
factory = new TestStatementFactory();
@@ -75,7 +77,7 @@ void writeShouldSerializeSimpleStatement() throws SerializationException {
mockExName,
mockLiteralJohn
);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
StringWriter writer = new StringWriter();
nTriplesSerializer.write(writer);
@@ -85,7 +87,7 @@ void writeShouldSerializeSimpleStatement() throws SerializationException {
mockExName.stringValue(),
escapeNTriplesString(lexJohn)) + " .\n";
- assertEquals(expected, writer.toString());
+ Assertions.assertEquals(expected, writer.toString());
}
@Test
@@ -98,7 +100,7 @@ void writeShouldSerializeStatementWithContext() throws SerializationException {
mockLiteralJohn,
mockContext
);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
StringWriter writer = new StringWriter();
nTriplesSerializer.write(writer);
@@ -108,7 +110,7 @@ void writeShouldSerializeStatementWithContext() throws SerializationException {
mockExName.stringValue(),
escapeNTriplesString(lexJohn)) + " .\n";
- assertEquals(expected, writer.toString());
+ Assertions.assertEquals(expected, writer.toString());
}
@Test
@@ -119,7 +121,7 @@ void writeShouldHandleBlankNodes() throws SerializationException {
mockExKnows,
mockBNode2
);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
StringWriter writer = new StringWriter();
nTriplesSerializer.write(writer);
@@ -129,7 +131,7 @@ void writeShouldHandleBlankNodes() throws SerializationException {
mockExKnows.stringValue(),
mockBNode2.stringValue()) + " .\n";
- assertEquals(expected, writer.toString());
+ Assertions.assertEquals(expected, writer.toString());
}
@Test
@@ -140,9 +142,9 @@ void writeShouldThrowOnIOException() throws IOException {
mockExName,
mockLiteralJohn
);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
- Writer faultyWriter = mock(Writer.class);
+ Writer faultyWriter = Mockito.mock(Writer.class);
doThrow(new IOException("Simulated IO error during write")).when(faultyWriter).write(anyString());
doThrow(new IOException("Simulated IO error (char array)")).when(faultyWriter).write(any(char[].class), anyInt(), anyInt());
@@ -188,11 +190,11 @@ void writeShouldThrowOnNullPredicateValue() {
@Test
@DisplayName("Write should throw SerializationException for null object value in strict mode")
void writeShouldThrowOnNullObjectValue() {
- Statement stmt = mock(Statement.class);
- when(stmt.getSubject()).thenReturn(mockExPerson);
- when(stmt.getPredicate()).thenReturn(mockExName);
- when(stmt.getObject()).thenReturn(null);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Statement stmt = Mockito.mock(Statement.class);
+ Mockito.when(stmt.getSubject()).thenReturn(mockExPerson);
+ Mockito.when(stmt.getPredicate()).thenReturn(mockExName);
+ Mockito.when(stmt.getObject()).thenReturn(null);
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
StringWriter writer = new StringWriter();
SerializationException thrown = assertThrows(SerializationException.class, () -> nTriplesSerializer.write(writer));
@@ -243,7 +245,7 @@ void writeShouldHandleVariousLiterals(String literalValue) throws SerializationE
mockExName,
literalMock
);
- when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Mockito.when(model.iterator()).thenReturn(new MockStatementIterator(stmt));
StringWriter writer = new StringWriter();
nTriplesSerializer.write(writer);
@@ -255,21 +257,20 @@ void writeShouldHandleVariousLiterals(String literalValue) throws SerializationE
mockExName.stringValue(),
expectedEscapedLiteral) + " .\n";
- assertEquals(expectedOutput, writer.toString());
+ Assertions.assertEquals(expectedOutput, writer.toString());
}
-
@Test
@DisplayName("Should handle literals with language tags")
void shouldHandleLiteralsWithLanguageTags() throws SerializationException {
Statement stmt = factory.createStatement(mockExPerson, factory.createIRI("http://example.org/greeting"), mockLiteralHelloEn);
- Model currentTestModel = mock(Model.class);
- when(currentTestModel.iterator()).thenReturn(new MockStatementIterator(stmt));
+ Model currentTestModel = Mockito.mock(Model.class);
+ Mockito.when(currentTestModel.iterator()).thenReturn(new MockStatementIterator(stmt));
Writer writer = new StringWriter();
- NTriplesSerializer serializer = new NTriplesSerializer(currentTestModel, NTriplesConfig.defaultConfig());
+ NTriplesSerializer serializer = new NTriplesSerializer(currentTestModel, NTriplesOption.defaultConfig());
serializer.write(writer);
String expectedOutput = String.format("<%s> <%s> \"%s\"@%s",
@@ -278,7 +279,7 @@ void shouldHandleLiteralsWithLanguageTags() throws SerializationException {
escapeNTriplesString(hello),
mockLiteralHelloEn.getLanguage().get()) + " .\n";
- assertEquals(expectedOutput, writer.toString());
+ Assertions.assertEquals(expectedOutput, writer.toString());
}
@@ -293,7 +294,7 @@ void shouldHandleLiteralsWithCustomDatatypes() throws SerializationException {
Model currentTestModel = mock(Model.class);
when(currentTestModel.iterator()).thenReturn(new MockStatementIterator(stmt));
- NTriplesSerializer serializer = new NTriplesSerializer(currentTestModel, NTriplesConfig.defaultConfig());
+ NTriplesSerializer serializer = new NTriplesSerializer(currentTestModel, NTriplesOption.defaultConfig());
StringWriter writer = new StringWriter();
serializer.write(writer);
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/XmlConfigTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlConfigTest.java
similarity index 85%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/XmlConfigTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlConfigTest.java
index 7e55fd903..562bd866d 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/XmlConfigTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlConfigTest.java
@@ -1,6 +1,8 @@
-package fr.inria.corese.core.next.impl.common.serialization.config;
+package fr.inria.corese.core.next.impl.io.serialization.rdfxml;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.PrefixOrderingEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -10,7 +12,7 @@
import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for the {@link XmlConfig} class.
+ * Unit tests for the {@link XmlOption} class.
* These tests verify the default configuration settings and the functionality
* of the builder pattern for customizing RDF/XML serialization options.
*/
@@ -19,7 +21,7 @@ class XmlConfigTest {
@Test
@DisplayName("defaultConfig() should return a config with expected RDF/XML defaults")
void defaultConfig_shouldReturnExpectedDefaults() {
- XmlConfig config = XmlConfig.defaultConfig();
+ XmlOption config = XmlOption.defaultConfig();
assertNotNull(config, "Default config should not be null");
@@ -42,7 +44,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
assertFalse(config.sortPredicates(), "Default sortPredicates should be false for XML");
assertTrue(config.useMultilineLiterals(), "Default useMultilineLiterals should be true for XML");
- assertTrue(config.strictMode, "Default strictMode should be true");
+ assertTrue(config.isStrictMode(), "Default strictMode should be true");
assertFalse(config.escapeUnicode(), "Default escapeUnicode should be false for XML");
assertEquals(LiteralDatatypePolicyEnum.ALWAYS_TYPED, config.getLiteralDatatypePolicy(), "Default literalDatatypePolicy should be ALWAYS_TYPED for XML");
assertNull(config.getBaseIRI(), "Default baseIRI should be null");
@@ -52,7 +54,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
@Test
@DisplayName("Builder should allow overriding usePrefixes")
void builder_shouldAllowOverridingUsePrefixes() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.usePrefixes(false)
.build();
assertFalse(config.usePrefixes(), "usePrefixes should be overridden to false");
@@ -61,7 +63,7 @@ void builder_shouldAllowOverridingUsePrefixes() {
@Test
@DisplayName("Builder should allow overriding autoDeclarePrefixes")
void builder_shouldAllowOverridingAutoDeclarePrefixes() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.autoDeclarePrefixes(false)
.build();
assertFalse(config.autoDeclarePrefixes(), "autoDeclarePrefixes should be overridden to false");
@@ -70,7 +72,7 @@ void builder_shouldAllowOverridingAutoDeclarePrefixes() {
@Test
@DisplayName("Builder should allow overriding prefixOrdering")
void builder_shouldAllowOverridingPrefixOrdering() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.prefixOrdering(PrefixOrderingEnum.USAGE_ORDER)
.build();
assertEquals(PrefixOrderingEnum.USAGE_ORDER, config.getPrefixOrdering(), "prefixOrdering should be overridden to USAGE_ORDER");
@@ -81,7 +83,7 @@ void builder_shouldAllowOverridingPrefixOrdering() {
void builder_shouldAllowAddingCustomPrefixes() {
String customPrefix = "my";
String customNamespace = "http://my.example.org/";
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.addCustomPrefix(customPrefix, customNamespace)
.build();
@@ -94,7 +96,7 @@ void builder_shouldAllowAddingCustomPrefixes() {
@Test
@DisplayName("Builder should allow overriding prettyPrint")
void builder_shouldAllowOverridingPrettyPrint() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.prettyPrint(false)
.build();
assertFalse(config.prettyPrint(), "prettyPrint should be overridden to false");
@@ -104,7 +106,7 @@ void builder_shouldAllowOverridingPrettyPrint() {
@DisplayName("Builder should allow overriding indent")
void builder_shouldAllowOverridingIndent() {
String customIndent = "\t";
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.indent(customIndent)
.build();
assertEquals(customIndent, config.getIndent(), "indent should be overridden to custom value");
@@ -114,7 +116,7 @@ void builder_shouldAllowOverridingIndent() {
@DisplayName("Builder should allow overriding maxLineLength")
void builder_shouldAllowOverridingMaxLineLength() {
int customLength = 120;
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.maxLineLength(customLength)
.build();
assertEquals(customLength, config.getMaxLineLength(), "maxLineLength should be overridden to custom value");
@@ -123,7 +125,7 @@ void builder_shouldAllowOverridingMaxLineLength() {
@Test
@DisplayName("Builder should allow overriding sortSubjects")
void builder_shouldAllowOverridingSortSubjects() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.sortSubjects(true)
.build();
assertTrue(config.sortSubjects(), "sortSubjects should be overridden to true");
@@ -132,7 +134,7 @@ void builder_shouldAllowOverridingSortSubjects() {
@Test
@DisplayName("Builder should allow overriding sortPredicates")
void builder_shouldAllowOverridingSortPredicates() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.sortPredicates(true)
.build();
assertTrue(config.sortPredicates(), "sortPredicates should be overridden to true");
@@ -141,7 +143,7 @@ void builder_shouldAllowOverridingSortPredicates() {
@Test
@DisplayName("Builder should allow overriding useMultilineLiterals")
void builder_shouldAllowOverridingUseMultilineLiterals() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.useMultilineLiterals(false)
.build();
assertFalse(config.useMultilineLiterals(), "useMultilineLiterals should be overridden to false");
@@ -150,16 +152,16 @@ void builder_shouldAllowOverridingUseMultilineLiterals() {
@Test
@DisplayName("Builder should allow overriding strictMode")
void builder_shouldAllowOverridingStrictMode() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.strictMode(false)
.build();
- assertFalse(config.strictMode, "strictMode should be overridden to false");
+ assertFalse(config.isStrictMode(), "strictMode should be overridden to false");
}
@Test
@DisplayName("Builder should allow overriding escapeUnicode")
void builder_shouldAllowOverridingEscapeUnicode() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.escapeUnicode(true)
.build();
assertTrue(config.escapeUnicode(), "escapeUnicode should be overridden to true");
@@ -168,7 +170,7 @@ void builder_shouldAllowOverridingEscapeUnicode() {
@Test
@DisplayName("Builder should allow overriding literalDatatypePolicy")
void builder_shouldAllowOverridingLiteralDatatypePolicy() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.build();
assertEquals(LiteralDatatypePolicyEnum.MINIMAL, config.getLiteralDatatypePolicy(), "literalDatatypePolicy should be overridden to MINIMAL");
@@ -178,7 +180,7 @@ void builder_shouldAllowOverridingLiteralDatatypePolicy() {
@DisplayName("Builder should allow setting baseIRI")
void builder_shouldAllowSettingBaseIRI() {
String testBaseIRI = "http://example.org/base/";
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.baseIRI(testBaseIRI)
.build();
assertEquals(testBaseIRI, config.getBaseIRI(), "baseIRI should be set correctly");
@@ -188,7 +190,7 @@ void builder_shouldAllowSettingBaseIRI() {
@DisplayName("Builder should allow overriding lineEnding")
void builder_shouldAllowOverridingLineEnding() {
String customLineEnding = "\r\n";
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.lineEnding(customLineEnding)
.build();
assertEquals(customLineEnding, config.getLineEnding(), "lineEnding should be overridden to custom value");
@@ -197,7 +199,7 @@ void builder_shouldAllowOverridingLineEnding() {
@Test
@DisplayName("Builder should allow overriding validateURIs")
void builder_shouldAllowOverridingValidateURIs() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.validateURIs(true)
.build();
assertTrue(config.validateURIs(), "validateURIs should be overridden to true");
@@ -206,7 +208,7 @@ void builder_shouldAllowOverridingValidateURIs() {
@Test
@DisplayName("Builder should allow overriding stableBlankNodeIds")
void builder_shouldAllowOverridingStableBlankNodeIds() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.stableBlankNodeIds(false)
.build();
assertFalse(config.stableBlankNodeIds(), "stableBlankNodeIds should be overridden to false");
@@ -215,7 +217,7 @@ void builder_shouldAllowOverridingStableBlankNodeIds() {
@Test
@DisplayName("Builder should allow overriding includeContext")
void builder_shouldAllowOverridingIncludeContext() {
- XmlConfig config = new XmlConfig.Builder()
+ XmlOption config = new XmlOption.Builder()
.includeContext(true)
.build();
assertTrue(config.includeContext(), "includeContext should be overridden to true");
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/XmlSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlSerializerTest.java
similarity index 94%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/XmlSerializerTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlSerializerTest.java
index 54d27e46c..34bae8f51 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/XmlSerializerTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/rdfxml/XmlSerializerTest.java
@@ -1,11 +1,11 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization.rdfxml;
import fr.inria.corese.core.next.api.Model;
import fr.inria.corese.core.next.api.Statement;
-import fr.inria.corese.core.next.impl.common.serialization.config.LiteralDatatypePolicyEnum;
-import fr.inria.corese.core.next.impl.common.serialization.config.PrefixOrderingEnum;
-import fr.inria.corese.core.next.impl.common.serialization.config.XmlConfig;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.TestStatementFactory;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.PrefixOrderingEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import fr.inria.corese.core.next.impl.exception.SerializationException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
@@ -27,7 +27,7 @@ class XmlSerializerTest {
@Mock
private Model mockModel;
- XmlConfig mockConfig;
+ XmlOption mockConfig;
private TestStatementFactory factory;
private StringWriter writer;
@@ -38,7 +38,7 @@ void setUp() {
writer = new StringWriter();
factory = new TestStatementFactory();
- mockConfig = XmlConfig.defaultConfig();
+ mockConfig = XmlOption.defaultConfig();
}
@@ -53,7 +53,7 @@ void shouldSerializeSimpleIriTriple() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.autoDeclarePrefixes(true)
.usePrefixes(true)
.addCustomPrefix("foaf", "http://xmlns.com/foaf/0.1/")
@@ -88,7 +88,7 @@ void shouldHandleBlankNodeSubject() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.stableBlankNodeIds(true)
.addCustomPrefix("foaf", "http://xmlns.com/foaf/0.1/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -121,7 +121,7 @@ void shouldHandleBlankNodeObject() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.stableBlankNodeIds(true)
.addCustomPrefix("dc", "http://purl.org/dc/elements/1.1/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -154,7 +154,7 @@ void shouldSerializeLiteralWithStringDatatypeMinimalPolicy() throws Serializatio
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.addCustomPrefix("foaf", "http://xmlns.com/foaf/0.1/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -185,7 +185,7 @@ void shouldSerializeLiteralWithCustomDatatypeMinimalPolicy() throws Serializatio
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.addCustomPrefix("ex", "http://example.org/vocabulary/")
.addCustomPrefix("xsd", "http://www.w3.org/2001/XMLSchema#")
@@ -217,7 +217,7 @@ void shouldSerializeLiteralWithLanguage() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.addCustomPrefix("dc", "http://purl.org/dc/elements/1.1/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
.build();
@@ -254,7 +254,7 @@ void shouldRespectPrefixOrderingDefault() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt1, stmt2));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.addCustomPrefix("exorg", "http://ex.org/")
.addCustomPrefix("excom", "http://ex.com/")
.prefixOrdering(PrefixOrderingEnum.USAGE_ORDER)
@@ -296,7 +296,7 @@ void shouldSortSubjectsAlphabetically() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt1, stmt2));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.sortSubjects(true)
.addCustomPrefix("ex", "http://ex.org/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -332,7 +332,7 @@ void shouldEscapeXmlAttributeValues() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
.build();
@@ -362,7 +362,7 @@ void shouldEscapeXmlContentValues() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.ALWAYS_TYPED)
.addCustomPrefix("ex", "http://example.org/")
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -396,7 +396,7 @@ void shouldNotAutoDeclarePrefixesIfDisabled() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.autoDeclarePrefixes(false)
.usePrefixes(true)
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -428,7 +428,7 @@ void shouldNotUsePrefixesIfDisabled() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.usePrefixes(false)
.autoDeclarePrefixes(true)
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
@@ -466,7 +466,7 @@ void shouldNotGenerateStableBlankNodeIds() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.of(stmt1, stmt2));
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.stableBlankNodeIds(false)
.sortSubjects(true)
.addCustomPrefix("ex", "http://example.org/")
@@ -497,7 +497,7 @@ void shouldNotGenerateStableBlankNodeIds() throws SerializationException {
void shouldHandleEmptyModel() throws SerializationException {
when(mockModel.stream()).thenReturn(Stream.empty());
- XmlConfig testConfig = new XmlConfig.Builder()
+ XmlOption testConfig = new XmlOption.Builder()
.prefixOrdering(PrefixOrderingEnum.ALPHABETICAL)
.build();
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TriGConfigTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGOptionTest.java
similarity index 85%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TriGConfigTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGOptionTest.java
index ff16f055f..f847596cf 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TriGConfigTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGOptionTest.java
@@ -1,6 +1,9 @@
-package fr.inria.corese.core.next.impl.common.serialization.config;
+package fr.inria.corese.core.next.impl.io.serialization.trig;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.option.BlankNodeStyleEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.PrefixOrderingEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -10,16 +13,16 @@
import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for the {@link TriGConfig} class.
+ * Unit tests for the {@link TriGOption} class.
* These tests verify the default configuration settings and the functionality
* of the builder pattern for customizing TriG serialization options.
*/
-class TriGConfigTest {
+class TriGOptionTest {
@Test
@DisplayName("defaultConfig() should return a config with expected TriG defaults")
void defaultConfig_shouldReturnExpectedDefaults() {
- TriGConfig config = TriGConfig.defaultConfig();
+ TriGOption config = TriGOption.defaultConfig();
assertNotNull(config, "Default config should not be null");
@@ -48,7 +51,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
assertFalse(config.sortSubjects(), "Default sortSubjects should be false");
assertFalse(config.sortPredicates(), "Default sortPredicates should be false");
- assertTrue(config.strictMode, "Default strictMode should be true");
+ assertTrue(config.isStrictMode(), "Default strictMode should be true");
assertFalse(config.escapeUnicode(), "Default escapeUnicode should be false");
assertEquals(LiteralDatatypePolicyEnum.MINIMAL, config.getLiteralDatatypePolicy(), "Default literalDatatypePolicy should be MINIMAL");
assertNull(config.getBaseIRI(), "Default baseIRI should be null");
@@ -57,7 +60,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
@Test
@DisplayName("Builder should allow overriding includeContext")
void builder_shouldAllowOverridingIncludeContext() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.includeContext(false)
.build();
assertFalse(config.includeContext(), "includeContext should be overridden to false");
@@ -66,7 +69,7 @@ void builder_shouldAllowOverridingIncludeContext() {
@Test
@DisplayName("Builder should allow overriding blankNodeStyle")
void builder_shouldAllowOverridingBlankNodeStyle() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.blankNodeStyle(BlankNodeStyleEnum.ANONYMOUS)
.build();
assertEquals(BlankNodeStyleEnum.ANONYMOUS, config.getBlankNodeStyle(), "blankNodeStyle should be overridden to ANONYMOUS");
@@ -75,7 +78,7 @@ void builder_shouldAllowOverridingBlankNodeStyle() {
@Test
@DisplayName("Builder should allow overriding useCollections")
void builder_shouldAllowOverridingUseCollections() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.useCollections(true)
.build();
assertTrue(config.useCollections(), "useCollections should be overridden to true");
@@ -86,7 +89,7 @@ void builder_shouldAllowOverridingUseCollections() {
void builder_shouldAllowAddingCustomPrefixes() {
String customPrefix = "my";
String customNamespace = "http://my.example.org/";
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.addCustomPrefix(customPrefix, customNamespace)
.build();
@@ -99,7 +102,7 @@ void builder_shouldAllowAddingCustomPrefixes() {
@Test
@DisplayName("Builder should allow overriding usePrefixes")
void builder_shouldAllowOverridingUsePrefixes() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.usePrefixes(false)
.build();
assertFalse(config.usePrefixes(), "usePrefixes should be overridden to false");
@@ -108,7 +111,7 @@ void builder_shouldAllowOverridingUsePrefixes() {
@Test
@DisplayName("Builder should allow overriding autoDeclarePrefixes")
void builder_shouldAllowOverridingAutoDeclarePrefixes() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.autoDeclarePrefixes(false)
.build();
assertFalse(config.autoDeclarePrefixes(), "autoDeclarePrefixes should be overridden to false");
@@ -117,7 +120,7 @@ void builder_shouldAllowOverridingAutoDeclarePrefixes() {
@Test
@DisplayName("Builder should allow overriding prefixOrdering")
void builder_shouldAllowOverridingPrefixOrdering() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.prefixOrdering(PrefixOrderingEnum.USAGE_ORDER)
.build();
assertEquals(PrefixOrderingEnum.USAGE_ORDER, config.getPrefixOrdering(), "prefixOrdering should be overridden to USAGE_ORDER");
@@ -126,7 +129,7 @@ void builder_shouldAllowOverridingPrefixOrdering() {
@Test
@DisplayName("Builder should allow overriding useCompactTriples")
void builder_shouldAllowOverridingUseCompactTriples() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.useCompactTriples(false)
.build();
assertFalse(config.useCompactTriples(), "useCompactTriples should be overridden to false");
@@ -135,7 +138,7 @@ void builder_shouldAllowOverridingUseCompactTriples() {
@Test
@DisplayName("Builder should allow overriding useRdfTypeShortcut")
void builder_shouldAllowOverridingUseRdfTypeShortcut() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.useRdfTypeShortcut(false)
.build();
assertFalse(config.useRdfTypeShortcut(), "useRdfTypeShortcut should be overridden to false");
@@ -144,7 +147,7 @@ void builder_shouldAllowOverridingUseRdfTypeShortcut() {
@Test
@DisplayName("Builder should allow overriding useMultilineLiterals")
void builder_shouldAllowOverridingUseMultilineLiterals() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.useMultilineLiterals(false)
.build();
assertFalse(config.useMultilineLiterals(), "useMultilineLiterals should be overridden to false");
@@ -153,7 +156,7 @@ void builder_shouldAllowOverridingUseMultilineLiterals() {
@Test
@DisplayName("Builder should allow overriding prettyPrint")
void builder_shouldAllowOverridingPrettyPrint() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.prettyPrint(false)
.build();
assertFalse(config.prettyPrint(), "prettyPrint should be overridden to false");
@@ -163,7 +166,7 @@ void builder_shouldAllowOverridingPrettyPrint() {
@DisplayName("Builder should allow overriding indent")
void builder_shouldAllowOverridingIndent() {
String customIndent = "\t";
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.indent(customIndent)
.build();
assertEquals(customIndent, config.getIndent(), "indent should be overridden to custom value");
@@ -173,7 +176,7 @@ void builder_shouldAllowOverridingIndent() {
@DisplayName("Builder should allow overriding maxLineLength")
void builder_shouldAllowOverridingMaxLineLength() {
int customLength = 120;
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.maxLineLength(customLength)
.build();
assertEquals(customLength, config.getMaxLineLength(), "maxLineLength should be overridden to custom value");
@@ -182,7 +185,7 @@ void builder_shouldAllowOverridingMaxLineLength() {
@Test
@DisplayName("Builder should allow overriding groupBySubject")
void builder_shouldAllowOverridingGroupBySubject() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.groupBySubject(false)
.build();
assertFalse(config.groupBySubject(), "groupBySubject should be overridden to false");
@@ -191,7 +194,7 @@ void builder_shouldAllowOverridingGroupBySubject() {
@Test
@DisplayName("Builder should allow overriding sortSubjects")
void builder_shouldAllowOverridingSortSubjects() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.sortSubjects(true)
.build();
assertTrue(config.sortSubjects(), "sortSubjects should be overridden to true");
@@ -200,7 +203,7 @@ void builder_shouldAllowOverridingSortSubjects() {
@Test
@DisplayName("Builder should allow overriding sortPredicates")
void builder_shouldAllowOverridingSortPredicates() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.sortPredicates(true)
.build();
assertTrue(config.sortPredicates(), "sortPredicates should be overridden to true");
@@ -209,17 +212,17 @@ void builder_shouldAllowOverridingSortPredicates() {
@Test
@DisplayName("Builder should allow overriding strictMode")
void builder_shouldAllowOverridingStrictMode() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.strictMode(false)
.build();
- assertFalse(config.strictMode, "strictMode should be overridden to false");
+ assertFalse(config.isStrictMode(), "strictMode should be overridden to false");
}
@Test
@DisplayName("Builder should allow overriding literalDatatypePolicy")
void builder_shouldAllowOverridingLiteralDatatypePolicy() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.ALWAYS_TYPED)
.build();
assertEquals(LiteralDatatypePolicyEnum.ALWAYS_TYPED, config.getLiteralDatatypePolicy(), "literalDatatypePolicy should be overridden to ALWAYS_TYPED");
@@ -229,7 +232,7 @@ void builder_shouldAllowOverridingLiteralDatatypePolicy() {
@DisplayName("Builder should allow setting baseIRI")
void builder_shouldAllowSettingBaseIRI() {
String testBaseIRI = "http://example.org/base/";
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.baseIRI(testBaseIRI)
.build();
assertEquals(testBaseIRI, config.getBaseIRI(), "baseIRI should be set correctly");
@@ -239,7 +242,7 @@ void builder_shouldAllowSettingBaseIRI() {
@DisplayName("Builder should allow overriding lineEnding")
void builder_shouldAllowOverridingLineEnding() {
String customLineEnding = "\r\n";
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.lineEnding(customLineEnding)
.build();
assertEquals(customLineEnding, config.getLineEnding(), "lineEnding should be overridden to custom value");
@@ -248,7 +251,7 @@ void builder_shouldAllowOverridingLineEnding() {
@Test
@DisplayName("Builder should allow overriding validateURIs")
void builder_shouldAllowOverridingValidateURIs() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.validateURIs(true)
.build();
assertTrue(config.validateURIs(), "validateURIs should be overridden to true");
@@ -257,7 +260,7 @@ void builder_shouldAllowOverridingValidateURIs() {
@Test
@DisplayName("Builder should allow overriding stableBlankNodeIds")
void builder_shouldAllowOverridingStableBlankNodeIds() {
- TriGConfig config = TriGConfig.builder()
+ TriGOption config = TriGOption.builder()
.stableBlankNodeIds(true)
.build();
assertTrue(config.stableBlankNodeIds(), "stableBlankNodeIds should be overridden to true");
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TriGSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGSerializerTest.java
similarity index 96%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/TriGSerializerTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGSerializerTest.java
index cda7322cc..dd28ae083 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TriGSerializerTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/trig/TriGSerializerTest.java
@@ -1,12 +1,12 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization.trig;
import fr.inria.corese.core.next.api.IRI;
import fr.inria.corese.core.next.api.Model;
import fr.inria.corese.core.next.api.Statement;
import fr.inria.corese.core.next.impl.common.literal.RDF;
-import fr.inria.corese.core.next.impl.common.serialization.config.LiteralDatatypePolicyEnum;
-import fr.inria.corese.core.next.impl.common.serialization.config.TriGConfig;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.TestStatementFactory;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import fr.inria.corese.core.next.impl.exception.SerializationException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -27,13 +27,13 @@
class TriGSerializerTest {
private Model mockModel;
- private TriGConfig defaultConfig;
+ private TriGOption defaultConfig;
private TestStatementFactory factory;
@BeforeEach
void setUp() {
mockModel = mock(Model.class);
- defaultConfig = TriGConfig.defaultConfig();
+ defaultConfig = TriGOption.defaultConfig();
factory = new TestStatementFactory();
}
@@ -155,7 +155,7 @@ void testLiteralWithLanguageTag() throws SerializationException, IOException {
StringWriter writer = new StringWriter();
- TriGConfig customConfig = new TriGConfig.Builder()
+ TriGOption customConfig = new TriGOption.Builder()
.strictMode(false)
.build();
TriGSerializer triGSerializer = new TriGSerializer(mockModel, customConfig);
@@ -205,7 +205,7 @@ void testLiteralWithExplicitXsdStringType() throws SerializationException, IOExc
StringWriter writer = new StringWriter();
- TriGConfig customConfig = new TriGConfig.Builder()
+ TriGOption customConfig = new TriGOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.ALWAYS_TYPED)
.build();
TriGSerializer triGSerializer = new TriGSerializer(mockModel, customConfig);
@@ -255,7 +255,7 @@ void testBaseIRI() throws SerializationException, IOException {
StringWriter writer = new StringWriter();
- TriGConfig configWithBase = new TriGConfig.Builder()
+ TriGOption configWithBase = new TriGOption.Builder()
.baseIRI("http://example.org/base/")
.build();
TriGSerializer triGSerializer = new TriGSerializer(mockModel, configWithBase);
@@ -338,7 +338,7 @@ void testStrictModeInvalidLiteral() throws SerializationException {
StringWriter writer = new StringWriter();
- TriGConfig strictConfig = new TriGConfig.Builder().strictMode(true).build();
+ TriGOption strictConfig = new TriGOption.Builder().strictMode(true).build();
TriGSerializer triGSerializer = new TriGSerializer(mockModel, strictConfig);
@@ -374,7 +374,7 @@ void testStrictModeInvalidIRICharacters() throws SerializationException {
StringWriter writer = new StringWriter();
- TriGConfig strictConfig = new TriGConfig.Builder().strictMode(true).validateURIs(true).build();
+ TriGOption strictConfig = new TriGOption.Builder().strictMode(true).validateURIs(true).build();
TriGSerializer triGSerializer = new TriGSerializer(mockModel, strictConfig);
@@ -411,7 +411,7 @@ void testMultilineLiteralSerialization() throws SerializationException, IOExcept
.thenReturn(Stream.of(mockStatement));
StringWriter writer = new StringWriter();
- TriGConfig customConfig = new TriGConfig.Builder()
+ TriGOption customConfig = new TriGOption.Builder()
.useMultilineLiterals(true)
.prettyPrint(true)
.build();
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TurtleConfigTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleOptionTest.java
similarity index 84%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TurtleConfigTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleOptionTest.java
index 482d9718c..f1443fe8b 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/config/TurtleConfigTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleOptionTest.java
@@ -1,6 +1,9 @@
-package fr.inria.corese.core.next.impl.common.serialization.config;
+package fr.inria.corese.core.next.impl.io.serialization.turtle;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.option.BlankNodeStyleEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.option.PrefixOrderingEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -10,16 +13,16 @@
import static org.junit.jupiter.api.Assertions.*;
/**
- * Unit tests for the {@link TurtleConfig} class.
+ * Unit tests for the {@link TurtleOption} class.
* These tests verify the default configuration settings and the functionality
* of the builder pattern for customizing Turtle serialization options.
*/
-class TurtleConfigTest {
+class TurtleOptionTest {
@Test
@DisplayName("defaultConfig() should return a config with expected Turtle defaults")
void defaultConfig_shouldReturnExpectedDefaults() {
- TurtleConfig config = TurtleConfig.defaultConfig();
+ TurtleOption config = TurtleOption.defaultConfig();
assertNotNull(config, "Default config should not be null");
@@ -46,7 +49,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
assertEquals(80, config.getMaxLineLength(), "Default maxLineLength should be 80");
assertTrue(config.groupBySubject(), "Default groupBySubject should be true");
- assertTrue(config.strictMode, "Default strictMode should be true");
+ assertTrue(config.isStrictMode(), "Default strictMode should be true");
assertFalse(config.escapeUnicode(), "Default escapeUnicode should be false");
assertEquals(LiteralDatatypePolicyEnum.MINIMAL, config.getLiteralDatatypePolicy(), "Default literalDatatypePolicy should be MINIMAL");
assertNull(config.getBaseIRI(), "Default baseIRI should be null");
@@ -58,7 +61,7 @@ void defaultConfig_shouldReturnExpectedDefaults() {
@Test
@DisplayName("Builder should allow overriding useCollections")
void builder_shouldAllowOverridingUseCollections() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.useCollections(false)
.build();
assertFalse(config.useCollections(), "useCollections should be overridden to false");
@@ -67,7 +70,7 @@ void builder_shouldAllowOverridingUseCollections() {
@Test
@DisplayName("Builder should allow overriding blankNodeStyle")
void builder_shouldAllowOverridingBlankNodeStyle() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.blankNodeStyle(BlankNodeStyleEnum.NAMED)
.build();
assertEquals(BlankNodeStyleEnum.NAMED, config.getBlankNodeStyle(), "blankNodeStyle should be overridden to NAMED");
@@ -78,7 +81,7 @@ void builder_shouldAllowOverridingBlankNodeStyle() {
void builder_shouldAllowAddingCustomPrefixes() {
String customPrefix = "my";
String customNamespace = "http://my.example.org/";
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.addCustomPrefix(customPrefix, customNamespace)
.build();
@@ -91,7 +94,7 @@ void builder_shouldAllowAddingCustomPrefixes() {
@Test
@DisplayName("Builder should allow overriding usePrefixes")
void builder_shouldAllowOverridingUsePrefixes() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.usePrefixes(false)
.build();
assertFalse(config.usePrefixes(), "usePrefixes should be overridden to false");
@@ -100,7 +103,7 @@ void builder_shouldAllowOverridingUsePrefixes() {
@Test
@DisplayName("Builder should allow overriding autoDeclarePrefixes")
void builder_shouldAllowOverridingAutoDeclarePrefixes() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.autoDeclarePrefixes(false)
.build();
assertFalse(config.autoDeclarePrefixes(), "autoDeclarePrefixes should be overridden to false");
@@ -109,7 +112,7 @@ void builder_shouldAllowOverridingAutoDeclarePrefixes() {
@Test
@DisplayName("Builder should allow overriding prefixOrdering")
void builder_shouldAllowOverridingPrefixOrdering() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.prefixOrdering(PrefixOrderingEnum.USAGE_ORDER)
.build();
assertEquals(PrefixOrderingEnum.USAGE_ORDER, config.getPrefixOrdering(), "prefixOrdering should be overridden to USAGE_ORDER");
@@ -118,7 +121,7 @@ void builder_shouldAllowOverridingPrefixOrdering() {
@Test
@DisplayName("Builder should allow overriding useCompactTriples")
void builder_shouldAllowOverridingUseCompactTriples() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.useCompactTriples(false)
.build();
assertFalse(config.useCompactTriples(), "useCompactTriples should be overridden to false");
@@ -127,7 +130,7 @@ void builder_shouldAllowOverridingUseCompactTriples() {
@Test
@DisplayName("Builder should allow overriding useRdfTypeShortcut")
void builder_shouldAllowOverridingUseRdfTypeShortcut() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.useRdfTypeShortcut(false)
.build();
assertFalse(config.useRdfTypeShortcut(), "useRdfTypeShortcut should be overridden to false");
@@ -136,7 +139,7 @@ void builder_shouldAllowOverridingUseRdfTypeShortcut() {
@Test
@DisplayName("Builder should allow overriding useMultilineLiterals")
void builder_shouldAllowOverridingUseMultilineLiterals() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.useMultilineLiterals(false)
.build();
assertFalse(config.useMultilineLiterals(), "useMultilineLiterals should be overridden to false");
@@ -145,7 +148,7 @@ void builder_shouldAllowOverridingUseMultilineLiterals() {
@Test
@DisplayName("Builder should allow overriding prettyPrint")
void builder_shouldAllowOverridingPrettyPrint() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.prettyPrint(false)
.build();
assertFalse(config.prettyPrint(), "prettyPrint should be overridden to false");
@@ -155,7 +158,7 @@ void builder_shouldAllowOverridingPrettyPrint() {
@DisplayName("Builder should allow overriding indent")
void builder_shouldAllowOverridingIndent() {
String customIndent = "\t";
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.indent(customIndent)
.build();
assertEquals(customIndent, config.getIndent(), "indent should be overridden to custom value");
@@ -165,7 +168,7 @@ void builder_shouldAllowOverridingIndent() {
@DisplayName("Builder should allow overriding maxLineLength")
void builder_shouldAllowOverridingMaxLineLength() {
int customLength = 120;
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.maxLineLength(customLength)
.build();
assertEquals(customLength, config.getMaxLineLength(), "maxLineLength should be overridden to custom value");
@@ -174,7 +177,7 @@ void builder_shouldAllowOverridingMaxLineLength() {
@Test
@DisplayName("Builder should allow overriding groupBySubject")
void builder_shouldAllowOverridingGroupBySubject() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.groupBySubject(false)
.build();
assertFalse(config.groupBySubject(), "groupBySubject should be overridden to false");
@@ -183,7 +186,7 @@ void builder_shouldAllowOverridingGroupBySubject() {
@Test
@DisplayName("Builder should allow overriding sortSubjects")
void builder_shouldAllowOverridingSortSubjects() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.sortSubjects(true)
.build();
assertTrue(config.sortSubjects(), "sortSubjects should be overridden to true");
@@ -192,7 +195,7 @@ void builder_shouldAllowOverridingSortSubjects() {
@Test
@DisplayName("Builder should allow overriding sortPredicates")
void builder_shouldAllowOverridingSortPredicates() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.sortPredicates(true)
.build();
assertTrue(config.sortPredicates(), "sortPredicates should be overridden to true");
@@ -201,17 +204,17 @@ void builder_shouldAllowOverridingSortPredicates() {
@Test
@DisplayName("Builder should allow overriding strictMode")
void builder_shouldAllowOverridingStrictMode() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.strictMode(false)
.build();
- assertFalse(config.strictMode, "strictMode should be overridden to false");
+ assertFalse(config.isStrictMode(), "strictMode should be overridden to false");
}
@Test
@DisplayName("Builder should allow overriding literalDatatypePolicy")
void builder_shouldAllowOverridingLiteralDatatypePolicy() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.ALWAYS_TYPED)
.build();
assertEquals(LiteralDatatypePolicyEnum.ALWAYS_TYPED, config.getLiteralDatatypePolicy(), "literalDatatypePolicy should be overridden to ALWAYS_TYPED");
@@ -221,7 +224,7 @@ void builder_shouldAllowOverridingLiteralDatatypePolicy() {
@DisplayName("Builder should allow setting baseIRI")
void builder_shouldAllowSettingBaseIRI() {
String testBaseIRI = "http://example.org/base/";
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.baseIRI(testBaseIRI)
.build();
assertEquals(testBaseIRI, config.getBaseIRI(), "baseIRI should be set correctly");
@@ -231,7 +234,7 @@ void builder_shouldAllowSettingBaseIRI() {
@DisplayName("Builder should allow overriding lineEnding")
void builder_shouldAllowOverridingLineEnding() {
String customLineEnding = "\r\n";
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.lineEnding(customLineEnding)
.build();
assertEquals(customLineEnding, config.getLineEnding(), "lineEnding should be overridden to custom value");
@@ -240,7 +243,7 @@ void builder_shouldAllowOverridingLineEnding() {
@Test
@DisplayName("Builder should allow overriding validateURIs")
void builder_shouldAllowOverridingValidateURIs() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.validateURIs(true)
.build();
assertTrue(config.validateURIs(), "validateURIs should be overridden to true");
@@ -249,7 +252,7 @@ void builder_shouldAllowOverridingValidateURIs() {
@Test
@DisplayName("Builder should allow overriding stableBlankNodeIds")
void builder_shouldAllowOverridingStableBlankNodeIds() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.stableBlankNodeIds(true)
.build();
assertTrue(config.stableBlankNodeIds(), "stableBlankNodeIds should be overridden to true");
@@ -258,7 +261,7 @@ void builder_shouldAllowOverridingStableBlankNodeIds() {
@Test
@DisplayName("Builder should allow overriding includeContext")
void builder_shouldAllowOverridingIncludeContext() {
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.includeContext(true)
.build();
assertTrue(config.includeContext(), "includeContext should be overridden to true");
diff --git a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TurtleSerializerTest.java b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleSerializerTest.java
similarity index 96%
rename from src/test/java/fr/inria/corese/core/next/impl/common/serialization/TurtleSerializerTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleSerializerTest.java
index 053e111ef..f76700962 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/common/serialization/TurtleSerializerTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/io/serialization/turtle/TurtleSerializerTest.java
@@ -1,12 +1,12 @@
-package fr.inria.corese.core.next.impl.common.serialization;
+package fr.inria.corese.core.next.impl.io.serialization.turtle;
import fr.inria.corese.core.next.api.IRI;
import fr.inria.corese.core.next.api.Model;
import fr.inria.corese.core.next.api.Statement;
import fr.inria.corese.core.next.impl.common.literal.RDF;
-import fr.inria.corese.core.next.impl.common.serialization.config.LiteralDatatypePolicyEnum;
-import fr.inria.corese.core.next.impl.common.serialization.config.TurtleConfig;
-import fr.inria.corese.core.next.impl.common.serialization.util.SerializationConstants;
+import fr.inria.corese.core.next.impl.io.serialization.TestStatementFactory;
+import fr.inria.corese.core.next.impl.io.serialization.option.LiteralDatatypePolicyEnum;
+import fr.inria.corese.core.next.impl.io.serialization.util.SerializationConstants;
import fr.inria.corese.core.next.impl.exception.SerializationException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
@@ -29,13 +29,13 @@
class TurtleSerializerTest {
private Model mockModel;
- private TurtleConfig defaultConfig;
+ private TurtleOption defaultConfig;
private TestStatementFactory factory;
@BeforeEach
void setUp() {
mockModel = mock(Model.class);
- defaultConfig = TurtleConfig.defaultConfig();
+ defaultConfig = TurtleOption.defaultConfig();
factory = new TestStatementFactory();
}
@@ -152,7 +152,7 @@ void testLiteralWithLanguageTag() throws SerializationException, IOException {
StringWriter writer = new StringWriter();
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.MINIMAL)
.useRdfTypeShortcut(true)
.useCollections(true)
@@ -213,7 +213,7 @@ void testLiteralWithExplicitXsdStringType() throws SerializationException, IOExc
StringWriter writer = new StringWriter();
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.literalDatatypePolicy(LiteralDatatypePolicyEnum.ALWAYS_TYPED)
.usePrefixes(true)
.autoDeclarePrefixes(true)
@@ -314,7 +314,7 @@ void testBaseIRI() throws SerializationException, IOException {
StringWriter writer = new StringWriter();
- TurtleConfig configWithBase = new TurtleConfig.Builder()
+ TurtleOption configWithBase = new TurtleOption.Builder()
.baseIRI("http://example.org/base/")
.usePrefixes(true)
.autoDeclarePrefixes(true)
@@ -398,7 +398,7 @@ void testStrictModeInvalidLiteral() throws SerializationException {
StringWriter writer = new StringWriter();
- TurtleConfig strictConfig = new TurtleConfig.Builder().strictMode(true).build();
+ TurtleOption strictConfig = new TurtleOption.Builder().strictMode(true).build();
TurtleSerializer turtleSerializer = new TurtleSerializer(mockModel, strictConfig);
@@ -434,7 +434,7 @@ void testStrictModeInvalidIRICharacters() throws SerializationException {
StringWriter writer = new StringWriter();
- TurtleConfig strictConfig = new TurtleConfig.Builder().strictMode(true).validateURIs(true).build();
+ TurtleOption strictConfig = new TurtleOption.Builder().strictMode(true).validateURIs(true).build();
TurtleSerializer turtleSerializer = new TurtleSerializer(mockModel, strictConfig);
@@ -470,7 +470,7 @@ void testMultilineLiteralSerialization() throws SerializationException, IOExcept
.thenReturn(Stream.of(mockStatement));
StringWriter writer = new StringWriter();
- TurtleConfig config = new TurtleConfig.Builder()
+ TurtleOption config = new TurtleOption.Builder()
.useMultilineLiterals(true)
.prettyPrint(true)
.autoDeclarePrefixes(true)
diff --git a/src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypeTest.java b/src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypedTest.java
similarity index 98%
rename from src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypeTest.java
rename to src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypedTest.java
index 24dba5a3a..f2fc2d23f 100644
--- a/src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypeTest.java
+++ b/src/test/java/fr/inria/corese/core/next/impl/temp/literal/CoreseTypedTest.java
@@ -7,14 +7,13 @@
import fr.inria.corese.core.next.api.literal.CoreDatatype;
import fr.inria.corese.core.next.impl.temp.CoreseIRI;
import fr.inria.corese.core.sparql.api.IDatatype;
-import fr.inria.corese.core.sparql.datatype.CoreseLiteral;
import fr.inria.corese.core.sparql.datatype.CoreseString;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
-public class CoreseTypeTest {
+public class CoreseTypedTest {
private String testValue;
private IRI testDatatypeIRI;
private CoreDatatype testCoreDatatype;
diff --git a/src/test/java/fr/inria/corese/core/shex/TestShex.java b/src/test/java/fr/inria/corese/core/shex/TestShex.java
deleted file mode 100644
index e69de29bb..000000000