Skip to content

datatype of constant literal is ignored (same for language tag) #251

@pchampin

Description

@pchampin

When a literal is used as the value of rr:constant, its datatype is ignored and it is rendered as a string instead.
Example:
data.json

[ { "id": "0", "foo": "bar"  } ] 

map.ttl

@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .

 [
    a rr:TriplesMap;
    rml:logicalSource [
      rml:source "data.json" ;
      rml:referenceFormulation ql:JSONPath ;
      rml:iterator "$[*]";
    ];
    rr:subjectMap [
      rr:template "https://example.org/instances/{id}";
    ];
    rr:predicateObjectMap [
      rr:predicate <http://example.org/ns/p> ;
      rr:object true ;         # <-- the constant is an xsd:boolean
    ];
  ] .

The result is

<https://example.org/instances/0> <http://example.org/ns/p> "true" .

(note that the object is a string)

I would have expected this:

<https://example.org/instances/0> <http://example.org/ns/p> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .

I can work around this issue by replacing rr:object true with

rr:objectMap [ rr:constant "true"; rr:datatype xsd:boolean ]

but that should not be necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions