Skip to content

Commit 2a0c2e0

Browse files
MappingFactory: respect datatype for constants
Constants in the mapping have sometimes their own datatype already specified, use it.
1 parent fc155e6 commit 2a0c2e0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Fixed
1111
- Better handle unsupported reference formulation (See [issue 247](https://github.com/RMLio/rmlmapper-java/issues/247))
1212
- Graph Maps with default graph must not be ignored (See [issue 252](https://github.com/RMLio/rmlmapper-java/issues/252))
13+
- Honor datatypes for constants (See [issue 251](https://github.com/RMLio/rmlmapper-java/issues/251))
1314

1415
## [7.3.2] - 2025-03-04
1516

src/main/java/be/ugent/rml/MappingFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ private void parseObjectMapsAndShortcutsWithCallback(Term termMap, BiConsumer<Ma
202202
SingleRecordFunctionExecutor fn = new ConstantExtractor(o.getValue());
203203

204204
if (o instanceof Literal) {
205-
gen = new LiteralGenerator(fn);
205+
Term datatype = new NamedNode(((Literal) o).getDatatype().toString());
206+
gen = new LiteralGenerator(fn, datatype);
206207
} else {
207208
gen = new NamedNodeGenerator(fn, baseIRI, strictMode);
208209
}

0 commit comments

Comments
 (0)