Specify data types with rdflib.js

Hi guys,

I’m wondering how to specify a data type for properties with rdflib.js.

I.e. I’d like to define the current year as xsd:gYear.

Currently the statements are serialized as:

:validPeriod a time:DateTimeDescription; time:year 2019 .

But I like to serialize them like

:validPeriod a time:DateTimeDescription; time:year "2019"^^xsd:gYear .

as described in the owl-time docs.

Any hints?

1 Like

Does the following work?

x = $rdf.literal('2019', undefined, XSD('gYear'))

(source)

1 Like

This runs without error, but the type is not serialized. The property is a string now:

:validPeriod a time:DateTimeDescription; time:year "2019".

The documentation on

regarding this is wrong: