RDF datatype specification violation

As stated by the RDF specification:

A literal in an RDF graph consists of two or three elements:
...

  • a datatype IRI, being an IRI identifying a datatype that determines how the lexical form maps to a literal value

where IRI is defined as:

An IRI (Internationalized Resource Identifier) within an RDF graph is a Unicode string [UNICODE] that conforms to the syntax defined in RFC 3987 [RFC3987].

Up until Stardog 5.3.6, this seemed to be supported properly, version 6.1.0 however doesn't.

This can be reproduced with the following simple queries:

  • This query works
INSERT DATA { GRAPH <urn:example:g> {<urn:example:s> <urn:example:p> 'typed literal'^^xsd:token}}
  • this query doesn't work
    • error message: update operation could not be parsed: 'typed literal' was not recognised, and could not be verified, with datatype urn:example:datatype
INSERT DATA { GRAPH <urn:example:g> {<urn:example:s> <urn:example:p> 'typed literal'^^<urn:example:datatype>}}

In version 6 strict mode in Stardog got a little stricter to flag non-standard datatypes in addition to invalid literals. If you set strict.parsing=false this error should go away. But this option can only be set at database creation time and cannot be changed afterwards. We will revisit this change in strict mode and think about bringing back the old behavior.

Best,
Evren

Hi Evren,

regarding this:

a little stricter to flag non-standard datatypes

you should rather talk about xsd datatypes, not "standard" datatypes (since the standard explicitly allows any IRI).

In this regard, I think using a separate configuration option (something in the lines parsing.literals.allowXsdTypesOnly) would be more adequate.

Thank you for your feedback!

Hi Ruben,

We've made a change in the upcoming 6.1.1 release (scheduled for end of this week) to allow custom datatypes in the strict parsing mode too. The behaviour thus will be consistent with 5.x

Thanks for bringing this up,
Pavel

1 Like

Nice, thanks Pavel!
Looking forward to it :slight_smile:

Would this also affect the use of rdfs:Literal and rdf:PlainLiteral? I am getting errors with strings typed as those datatypes.

Andrea

Hi Andrea,

Could you provide details on the kind of errors that you see?

Thanks,
Pavel

Sure ... I got this error:
There was a fatal failure during preparation of 55451516-e45c-436c-bf30-307e8890cefd com.stardog.stark.io.InvalidRDF: 'author' was not recognised, and could not be verified, with datatype http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral [L21142]

I got the same error with datatype http://www.w3.org/2000/01/rdf-schema#Literal.

I got no error with a datatype of XML Schema.

Andrea

I am running 6.1.0.
Andrea

Correct, it's the same issue. These are not a part of RDF 1.1 and were not validated in the strict parsing mode prior to 6.1.1.

Best,
Pavel

So, will the 6.1.1 allow it? I know that the spec says that you don't have to recognize PlainLiteral, but you can.

Andrea

Yes, 6.1.1 should parse literals with rdf:PlainLiteral datatype.

Best,
Pavel