Skip to content

Commit a86e44a

Browse files
{Executor, MappingFactory}: support language tags for constants
1 parent 2a0c2e0 commit a86e44a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
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))
1313
- Honor datatypes for constants (See [issue 251](https://github.com/RMLio/rmlmapper-java/issues/251))
14+
- Honor language tags for constants (See [issue 251](https://github.com/RMLio/rmlmapper-java/issues/251))
1415

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private List<PredicateObjectGraph> combineMultiplePOGs(List<ProvenancedTerm> pre
373373
p -> objects.forEach(
374374
o -> graphs.forEach(
375375
g -> {
376-
if (g.getTerm().equals(new NamedNode(NAMESPACES.RML2 + "defaultGraph"))) {
376+
if (g != null && g.getTerm().equals(new NamedNode(NAMESPACES.RML2 + "defaultGraph"))) {
377377
results.add(new PredicateObjectGraph(p, o, null));
378378
} else {
379379
results.add(new PredicateObjectGraph(p, o, g));

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

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

204204
if (o instanceof Literal) {
205-
Term datatype = new NamedNode(((Literal) o).getDatatype().toString());
206-
gen = new LiteralGenerator(fn, datatype);
205+
if (((Literal) o).getDatatype() != null) {
206+
Term datatype = new NamedNode(((Literal) o).getDatatype().toString());
207+
gen = new LiteralGenerator(fn, datatype);
208+
} else if (((Literal) o).getLanguage().isPresent()) {
209+
SingleRecordFunctionExecutor executor = new ConstantExtractor(((Literal) o).getLanguage().get());
210+
gen = new LiteralGenerator(fn, executor);
211+
} else {
212+
gen = new LiteralGenerator(fn);
213+
}
214+
207215
} else {
208216
gen = new NamedNodeGenerator(fn, baseIRI, strictMode);
209217
}

0 commit comments

Comments
 (0)