# RDF datatype specification violation

**URL:** <https://community.stardog.com/t/rdf-datatype-specification-violation/1447>\
**Category:** Bug\
**Created:** [January 24, 2019, 2:14pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447 "2019-01-24T14:14:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rnavarropiris](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rnavarropiris/32/44_2.png) [@rnavarropiris](https://community.stardog.com/u/rnavarropiris)\
**Post date:** [January 24, 2019, 2:14pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/1 "2019-01-24T14:14:24Z")

</div>

As stated by the [RDF specification](https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal):

> A literal in an [RDF graph](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph) consists of two or three elements:  
> ...
> 
> - a datatype IRI, being an [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) identifying a datatype that determines how the lexical form maps to a [literal value](https://www.w3.org/TR/rdf11-concepts/#dfn-literal-value)

where IRI is defined as:

> An IRI (Internationalized Resource Identifier) within an RDF graph is a Unicode string [[UNICODE](https://www.w3.org/TR/rdf11-concepts/#bib-UNICODE)] that conforms to the syntax defined in RFC 3987 [[RFC3987](https://www.w3.org/TR/rdf11-concepts/#bib-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

```sparql
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`

```sparql
INSERT DATA { GRAPH <urn:example:g> {<urn:example:s> <urn:example:p> 'typed literal'^^<urn:example:datatype>}}

```

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [January 24, 2019, 2:51pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/2 "2019-01-24T14:51:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rnavarropiris](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rnavarropiris/32/44_2.png) [@rnavarropiris](https://community.stardog.com/u/rnavarropiris)\
**Post date:** [January 25, 2019, 9:40am UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/3 "2019-01-25T09:40:39Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [February 4, 2019, 9:40am UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/4 "2019-02-04T09:40:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rnavarropiris](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rnavarropiris/32/44_2.png) [@rnavarropiris](https://community.stardog.com/u/rnavarropiris)\
**Post date:** [February 5, 2019, 5:10pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/5 "2019-02-05T17:10:31Z")

</div>

Nice, thanks Pavel!  
Looking forward to it 🙂

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [February 19, 2019, 7:30pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/6 "2019-02-19T19:30:42Z")

</div>

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

Andrea

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [February 19, 2019, 8:01pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/7 "2019-02-19T20:01:16Z")

</div>

Hi Andrea,

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

Thanks,  
Pavel

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [February 19, 2019, 8:15pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/8 "2019-02-19T20:15:43Z")

</div>

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](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](http://www.w3.org/2000/01/rdf-schema#Literal).

I got no error with a datatype of [XML Schema](http://www.w3.org/2001/XMLSchema#string).

Andrea

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [February 19, 2019, 8:15pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/9 "2019-02-19T20:15:58Z")

</div>

I am running 6.1.0.  
Andrea

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [February 19, 2019, 8:21pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/10 "2019-02-19T20:21:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [February 19, 2019, 8:25pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/11 "2019-02-19T20:25:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [February 19, 2019, 8:32pm UTC](https://community.stardog.com/t/rdf-datatype-specification-violation/1447/12 "2019-02-19T20:32:21Z")

</div>

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

Best,  
Pavel
