Specify data types with rdflib.js


#1

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?


#2

Does the following work?

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

(source)


#3

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

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