Question

I'm having some trouble with Sesame 2.7. Suppose I have the following RDF document:

<rdf:RDF xmlns:arq="http://example.com/vocab.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

<arq:Photo rdf:about="http://example.com/photo_2230.rdf">
    <arq:photoName rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">Testing</arq:photoName>
    <!-- More properties -->
    ...
</arq:Photo>

When I submit it to Sesame, the following error appears:

'Testing' was not recognised, and could not be verified, with datatype http://www.w3.org/2000/01/rdf-schema#Literal

It was working fine with the previous Sesame version (version 2.6.9). But now, after the update, Sesame 2.7 does not recognize it and I am not finding why. Could someone have a guess of what is going on?

Thanks!

Was it helpful?

Solution

In older versions of Sesame, the parser only gave a warning when it encountered unrecognized datatypes. In Sesame 2.7, by default, the parser actually stops with an error (though we are considering relaxing this a bit again in the next update). So even in older versions of Sesame, this was not recognized and you would have seen an warning in the logs when you tried to load this data.

The reason this is an unrecognized datatype is that "http://www.w3.org/2000/01/rdf-schema#Literal" is not a datatype identifier at all. Instead, it is the identifier of the class of literals (so an entirely different thing). You should remove this datatype from your RDF, as it is an incorrect usage of the datatype mechanism.

To spell it out, change this line:

<arq:photoName rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">Testing</arq:photoName>

to:

<arq:photoName>Testing</arq:photoName>

Apart from fixing your data, you can of course also configure Sesame's parser to not immediately fail on invalid datatypes. Programmatically, this is easily done by adapting the ParserConfig used in your connection's parser.

 RepositoryConnection conn;  // your repository connection

 // set the parser used in the connection to report datatype 
 // verification errors but not fail on them.
 conn.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top