You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "Shaw, Ryan" <ry...@unc.edu> on 2021/09/10 18:23:37 UTC

Validation of XSD 1.1 datatypes (was Re: Using Xerces2 2.12.1 with Jena)

>> On 09/09/2021 23:32, Shaw, Ryan wrote:
>> 
>> riot gives me the warning “Lexical form '0000' not valid for datatype XSD gYear”. But according to XSD 1.1 Part 2, 0000 is a permitted value for gYear, representing 1 BCE.

> On Sep 10, 2021, at 6:25 AM, Andy Seaborne <an...@apache.org> wrote:
> 
> Command line riot?

I am using riot --validate as a final QA check on some RDF generated by other (non-Jena) code.

> It is just a warning the triple and it's object literal is still output from the parser. From the command line "--nocheck" turns off the checking.

The output is fine, but since I’m using riot specifically for validation I don’t want to turn off checking.

> Now logged as
> https://issues.apache.org/jira/browse/JENA-2158

Thanks, I will watch this issue.

> There is a constant to turn on XSD 1.1 schema mode for checking. It affects year 0000, including the value of negative years, and some duration detection.

Where is this constant? Does this mean I could write my own CLI tool to do validation with this flag set? (Or submit a PR for setting this constant via a riot command line option)?

I wonder if this flag should be on by default, since RDF 1.1 Concepts and Abstract Syntax says [1]:

> IRIs of the form http://www.w3.org/2001/XMLSchema#xxx, where xxx is the name of a datatype, denote the built-in datatypes defined in XML Schema 1.1 Part 2: Datatypes. 

Thanks,
Ryan

[1] https://www.w3.org/TR/rdf11-concepts/#xsd-datatypes



Re: Validation of XSD 1.1 datatypes (was Re: Using Xerces2 2.12.1 with Jena)

Posted by Andy Seaborne <an...@apache.org>.

On 10/09/2021 19:23, Shaw, Ryan wrote:
> 
>>> On 09/09/2021 23:32, Shaw, Ryan wrote:
>>>
>>> riot gives me the warning “Lexical form '0000' not valid for datatype XSD gYear”. But according to XSD 1.1 Part 2, 0000 is a permitted value for gYear, representing 1 BCE.
> 
>> On Sep 10, 2021, at 6:25 AM, Andy Seaborne <an...@apache.org> wrote:
>>
>> Command line riot?
> 
> I am using riot --validate as a final QA check on some RDF generated by other (non-Jena) code.
> 
>> It is just a warning the triple and it's object literal is still output from the parser. From the command line "--nocheck" turns off the checking.
> 
> The output is fine, but since I’m using riot specifically for validation I don’t want to turn off checking.
> 
Workaround:

"grep -v" of stderr will remove it

>> Now logged as
>> https://issues.apache.org/jira/browse/JENA-2158
> 
> Thanks, I will watch this issue.
> 
>> There is a constant to turn on XSD 1.1 schema mode for checking. It affects year 0000, including the value of negative years, and some duration detection.
> 
> Where is this constant? Does this mean I could write my own CLI tool to do validation with this flag set? (Or submit a PR for setting this constant via a riot command line option)?

The constant is in org.apache.jena.ext.xerces.impl.Constants

(also need to change 
org.apache.jena.ext.xerces.jaxp.datatype/XMLGregorianCalendarImpl.java)

There's a PR#1069 in-progress.

It does not mean all arithmetic involving 0000 and indeed BCE dates will 
work. Xerces does not support XSD 1.1 "0000" year in its arithmetic 
support nor does the JDK in my testing.

(And to everyone that points to java.time.* : useful for parsing to 
TemporalAccessors but it has a different concept of duration)


> I wonder if this flag should be on by default, since RDF 1.1 Concepts and Abstract Syntax says [1]:
> 
>> IRIs of the form http://www.w3.org/2001/XMLSchema#xxx, where xxx is the name of a datatype, denote the built-in datatypes defined in XML Schema 1.1 Part 2: Datatypes.

That text is saying that XSD IRIs can't be redefined. The section above 
says  "Any datatype definition that conforms to this abstraction MAY be 
used in RDF" -- so not a requirement.

     Andy

> 
> Thanks,
> Ryan
> 
> [1] https://www.w3.org/TR/rdf11-concepts/#xsd-datatypes
> 
>