Skip to content

Commit f769066

Browse files
committed
fixing corese literal generation
1 parent 9a1383a commit f769066

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/main/java/fr/inria/corese/core/next/api/base/model/AbstractIRI.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import fr.inria.corese.core.next.impl.common.util.IRIUtils;
55
import fr.inria.corese.core.next.impl.exception.IncorrectFormatException;
66

7+
import java.io.Serial;
8+
79
/**
810
* Base class for IRI implementations. Includes base functionality for IRI
911
* handling.
1012
*/
1113
public abstract class AbstractIRI implements IRI, Comparable<IRI> {
1214

15+
@Serial
1316
private static final long serialVersionUID = -1005683238501772511L;
1417

1518
private final String namespace;
@@ -44,11 +47,6 @@ protected AbstractIRI(String namespace, String localName) {
4447
this.localName = localName;
4548
}
4649

47-
@Override
48-
public boolean isIRI() {
49-
return true;
50-
}
51-
5250
@Override
5351
public String getNamespace() {
5452
return this.namespace;
@@ -73,7 +71,7 @@ public int compareTo(IRI o) {
7371
public boolean equals(Object o) {
7472
if (this == o)
7573
return true;
76-
if (o == null || getClass() != o.getClass())
74+
if (!(o instanceof IRI))
7775
return false;
7876
AbstractIRI that = (AbstractIRI) o;
7977
return this.stringValue().equals(that.stringValue());

src/test/java/fr/inria/corese/core/next/impl/temp/CoreseAdaptedValueFactoryTest.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package fr.inria.corese.core.next.impl.temp;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
import static org.junit.jupiter.api.Assertions.assertNotNull;
5-
import static org.junit.jupiter.api.Assertions.assertNull;
6-
import static org.junit.jupiter.api.Assertions.assertTrue;
7-
83
import java.time.Duration;
94

5+
import fr.inria.corese.core.next.impl.temp.literal.CoreseDate;
106
import org.junit.jupiter.api.BeforeEach;
117
import org.junit.jupiter.api.Test;
128

@@ -19,6 +15,8 @@
1915
import fr.inria.corese.core.next.impl.temp.literal.CoreseLanguageTaggedStringLiteral;
2016
import fr.inria.corese.core.next.impl.temp.literal.CoreseTyped;
2117

18+
import static org.junit.jupiter.api.Assertions.*;
19+
2220
public class CoreseAdaptedValueFactoryTest extends ValueFactoryTest {
2321

2422
private String stringTestValue;
@@ -135,4 +133,16 @@ public void testCreateFOAFURI() {
135133
assertNotNull(foaf);
136134
assertEquals("http://xmlns.com/foaf/0.1/", foaf.stringValue());
137135
}
136+
137+
@Test
138+
public void testDateCreation() {
139+
IRI xsdDate = valueFactory.createIRI("http://www.w3.org/2001/XMLSchema#date");
140+
String literalStringValue = "2025-11-20";
141+
Literal date = valueFactory.createLiteral(literalStringValue, xsdDate);
142+
143+
assertNotNull(date);
144+
assertEquals(fr.inria.corese.core.next.impl.common.vocabulary.XSD.xsdDate.getIRI().stringValue(), date.getDatatype().stringValue());
145+
assertEquals(literalStringValue, date.getLabel());
146+
assertInstanceOf(fr.inria.corese.core.sparql.datatype.CoreseDate.class, ((CoreseNodeAdapter) date).getCoreseNode());
147+
}
138148
}

0 commit comments

Comments
 (0)