Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-25 Thread Andy Seaborne




On 25/04/2024 07:58, Thomas Francart wrote:

Hello Andy

Le lun. 22 avr. 2024 à 21:03, Andy Seaborne  a écrit :



On 22/04/2024 08:02, Thomas Francart wrote:

Hello

This is 3.17.0. Pretty old, due to other dependency with TopQuadrant

SHACL

API.


It's not perfect in 5.0.0 either.

TopQuadrant SHACL is now 4.10.0. It would be good to upgrade because of
XML security issue fixes around Jena 4.3.2.


It is being rejected because it is not legal RDF 1.0. At 1.0, the
lexical space had restrictions (XML exclusive canonicalization) where
 is not allowed. It has to be  -- there are
various other rules as well.



Thank you, I wasn't aware of this.


Nor was I until I checked!

The RDF 1.0 rules are quite confusing and this comes up from time to 
time. At the time there was a DOM so no way to have a defined value 
space other than strings and restrict the lexical form by exclusive 
canonicalization.


(The DOM wasn't standardized at the time of RDF 1.0 IIRC)

The definition of rdf:XMLLiteral changed at RDF 1.1 to one where any XML
document fragment string is valid.

Seems not all places got updated. Partially, that is because it was
depending on the specific implementation of the Jena RDF/XML parser.

https://github.com/apache/jena/issues/2430


Do you happen to have the SPARQL queries? That part of your report is
related to the value space of RDF XML Literals.



Yes, the query is using the "=" operator :


OK - that will get fixed with

https://github.com/apache/jena/issues/2430



ask {
   ?uri a  .
   ?uri  ?x, ?y.
   filter (?x != ?y)
}


This false because use in the filter requires the value and the value is 
undefined.




But then using the sameTerm function we don't get the error:

ask {
   ?uri a  .
   ?uri  ?x, ?y.
   FILTER ( !sameTerm(?x, ?y) )
}




A proper update to RDF 1.1 may change the value object class (it is
"string" for RDF 1.0, it is, by the spec, DocumentFragment for RDF 1.1;
it could be kept at document fragment toString() in jena. I'd like to
understand the usage to see which change is best).

  Andy

BTW It's rdf:parseType="Literal" -- Jena 5.0.0 is not tolerant of lower
case "literal"


And that can be put back to be tolerant on input.





Thanks !

Thomas


Andy


Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-25 Thread Thomas Francart
Hello Andy

Le lun. 22 avr. 2024 à 21:03, Andy Seaborne  a écrit :

>
> On 22/04/2024 08:02, Thomas Francart wrote:
> > Hello
> >
> > This is 3.17.0. Pretty old, due to other dependency with TopQuadrant
> SHACL
> > API.
>
> It's not perfect in 5.0.0 either.
>
> TopQuadrant SHACL is now 4.10.0. It would be good to upgrade because of
> XML security issue fixes around Jena 4.3.2.
>
>
> It is being rejected because it is not legal RDF 1.0. At 1.0, the
> lexical space had restrictions (XML exclusive canonicalization) where
>  is not allowed. It has to be  -- there are
> various other rules as well.
>

Thank you, I wasn't aware of this.


>
> (The DOM wasn't standardized at the time of RDF 1.0 IIRC)
>
> The definition of rdf:XMLLiteral changed at RDF 1.1 to one where any XML
> document fragment string is valid.
>
> Seems not all places got updated. Partially, that is because it was
> depending on the specific implementation of the Jena RDF/XML parser.
>
> https://github.com/apache/jena/issues/2430
>
>
> Do you happen to have the SPARQL queries? That part of your report is
> related to the value space of RDF XML Literals.
>

Yes, the query is using the "=" operator :

ask {
  ?uri a  .
  ?uri  ?x, ?y.
  filter (?x != ?y)
}

But then using the sameTerm function we don't get the error:

ask {
  ?uri a  .
  ?uri  ?x, ?y.
  FILTER ( !sameTerm(?x, ?y) )
}


>
> A proper update to RDF 1.1 may change the value object class (it is
> "string" for RDF 1.0, it is, by the spec, DocumentFragment for RDF 1.1;
> it could be kept at document fragment toString() in jena. I'd like to
> understand the usage to see which change is best).
>
>  Andy
>
> BTW It's rdf:parseType="Literal" -- Jena 5.0.0 is not tolerant of lower
> case "literal"
>

Thanks !

Thomas


>
> >
> > Thomas
> >
> > Le sam. 20 avr. 2024 à 18:06, Andy Seaborne  a écrit :
> >
> >> Hi Thomas,
> >>
> >> Which version of Jena is this?
> >>
> >>   Andy
> >>
> >> On 19/04/2024 17:18, Thomas Francart wrote:
> >>> Hello
> >>>
> >>> The RDF/XML parsing of the following succeeds:
> >>>
> >>> 
> >>>
> >>>  >> href="
> >>> https://xx.xx.xx/PC"/>
> >>>
> >>> 
> >>>
> >>> while the RDF/XML parsing of this gives an error : in that case the XML
> >> has
> >>> simply be encoded with , and  and the rdf:datatype has been
> >>> explicitly set to XMLLiteral :
> >>>
> >>> 
> >>>
> >>> http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral
> >> ">amreferencesymbol
> >>> href="https://xx.xx.xx/PC
> >>> "//reference/am
> >>>
> >>> 
> >>>
> >>>
> >>> The error is
> >>>
> >>> 13:08:04.742 WARN  org.apache.jena.riot - Lexical form
> >>> 'https://xx.xx.xx/PC"/>'
> >> not
> >>> valid for datatype XSD XMLLiteral
> >>>
> >>> and then further down in SPARQL queries:
> >>>
> >>> 13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype
> format
> >>> exception: "https://xx.xx.xx/PC\
> >>> "/>"^^rdf:XMLLiteral
> >>>
> >>> The encoded XML is however valid.
> >>>
> >>> Is it possible to explicitely create literals with XMLLiteral datatype
> in
> >>> RDF/XML by setting this datatype explicitely ?
> >>>
> >>> Thanks
> >>> Thomas
> >>>
> >>>
> >>
> >
> >
>


-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas


Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-22 Thread Andy Seaborne



On 22/04/2024 08:02, Thomas Francart wrote:

Hello

This is 3.17.0. Pretty old, due to other dependency with TopQuadrant SHACL
API.


It's not perfect in 5.0.0 either.

TopQuadrant SHACL is now 4.10.0. It would be good to upgrade because of 
XML security issue fixes around Jena 4.3.2.



It is being rejected because it is not legal RDF 1.0. At 1.0, the 
lexical space had restrictions (XML exclusive canonicalization) where 
 is not allowed. It has to be  -- there are 
various other rules as well.


(The DOM wasn't standardized at the time of RDF 1.0 IIRC)

The definition of rdf:XMLLiteral changed at RDF 1.1 to one where any XML 
document fragment string is valid.


Seems not all places got updated. Partially, that is because it was 
depending on the specific implementation of the Jena RDF/XML parser.


https://github.com/apache/jena/issues/2430


Do you happen to have the SPARQL queries? That part of your report is 
related to the value space of RDF XML Literals.


A proper update to RDF 1.1 may change the value object class (it is 
"string" for RDF 1.0, it is, by the spec, DocumentFragment for RDF 1.1; 
it could be kept at document fragment toString() in jena. I'd like to 
understand the usage to see which change is best).


Andy

BTW It's rdf:parseType="Literal" -- Jena 5.0.0 is not tolerant of lower 
case "literal"




Thomas

Le sam. 20 avr. 2024 à 18:06, Andy Seaborne  a écrit :


Hi Thomas,

Which version of Jena is this?

  Andy

On 19/04/2024 17:18, Thomas Francart wrote:

Hello

The RDF/XML parsing of the following succeeds:




href="

https://xx.xx.xx/PC"/>



while the RDF/XML parsing of this gives an error : in that case the XML

has

simply be encoded with , and  and the rdf:datatype has been
explicitly set to XMLLiteral :



http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral

">amreferencesymbol

href="https://xx.xx.xx/PC
"//reference/am




The error is

13:08:04.742 WARN  org.apache.jena.riot - Lexical form
'https://xx.xx.xx/PC"/>'

not

valid for datatype XSD XMLLiteral

and then further down in SPARQL queries:

13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
exception: "https://xx.xx.xx/PC\
"/>"^^rdf:XMLLiteral

The encoded XML is however valid.

Is it possible to explicitely create literals with XMLLiteral datatype in
RDF/XML by setting this datatype explicitely ?

Thanks
Thomas









Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-22 Thread Thomas Francart
Hello

This is 3.17.0. Pretty old, due to other dependency with TopQuadrant SHACL
API.

Thomas

Le sam. 20 avr. 2024 à 18:06, Andy Seaborne  a écrit :

> Hi Thomas,
>
> Which version of Jena is this?
>
>  Andy
>
> On 19/04/2024 17:18, Thomas Francart wrote:
> > Hello
> >
> > The RDF/XML parsing of the following succeeds:
> >
> > 
> >
> >  href="
> > https://xx.xx.xx/PC"/>
> >
> > 
> >
> > while the RDF/XML parsing of this gives an error : in that case the XML
> has
> > simply be encoded with , and  and the rdf:datatype has been
> > explicitly set to XMLLiteral :
> >
> > 
> >
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral
> ">amreferencesymbol
> > href="https://xx.xx.xx/PC
> > "//reference/am
> >
> > 
> >
> >
> > The error is
> >
> > 13:08:04.742 WARN  org.apache.jena.riot - Lexical form
> > 'https://xx.xx.xx/PC"/>'
> not
> > valid for datatype XSD XMLLiteral
> >
> > and then further down in SPARQL queries:
> >
> > 13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
> > exception: "https://xx.xx.xx/PC\
> > "/>"^^rdf:XMLLiteral
> >
> > The encoded XML is however valid.
> >
> > Is it possible to explicitely create literals with XMLLiteral datatype in
> > RDF/XML by setting this datatype explicitely ?
> >
> > Thanks
> > Thomas
> >
> >
>


-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas


Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-20 Thread Andy Seaborne

Hi Thomas,

Which version of Jena is this?

Andy

On 19/04/2024 17:18, Thomas Francart wrote:

Hello

The RDF/XML parsing of the following succeeds:



https://xx.xx.xx/PC"/>



while the RDF/XML parsing of this gives an error : in that case the XML has
simply be encoded with , and  and the rdf:datatype has been
explicitly set to XMLLiteral :



http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral;>amreferencesymbol
href="https://xx.xx.xx/PC
"//reference/am




The error is

13:08:04.742 WARN  org.apache.jena.riot - Lexical form
'https://xx.xx.xx/PC"/>' not
valid for datatype XSD XMLLiteral

and then further down in SPARQL queries:

13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
exception: "https://xx.xx.xx/PC\
"/>"^^rdf:XMLLiteral

The encoded XML is however valid.

Is it possible to explicitely create literals with XMLLiteral datatype in
RDF/XML by setting this datatype explicitely ?

Thanks
Thomas




Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-19 Thread Martynas Jusevičius
*not* rdf:datatype

On Fri, Apr 19, 2024 at 7:10 PM Martynas Jusevičius
 wrote:
>
> AFAIK for XMLLiterals you need to use rdf:parseType="Literal", rdf:datatype:
> https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-XML-literals
>
> On Fri, 19 Apr 2024 at 18.18, Thomas Francart  
> wrote:
>>
>> Hello
>>
>> The RDF/XML parsing of the following succeeds:
>>
>> 
>>
>> https://xx.xx.xx/PC"/>
>>
>> 
>>
>> while the RDF/XML parsing of this gives an error : in that case the XML has
>> simply be encoded with , and  and the rdf:datatype has been
>> explicitly set to XMLLiteral :
>>
>> 
>>
>> http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral;>amreferencesymbol
>> href="https://xx.xx.xx/PC
>> "//reference/am
>>
>> 
>>
>>
>> The error is
>>
>> 13:08:04.742 WARN  org.apache.jena.riot - Lexical form
>> 'https://xx.xx.xx/PC"/>' not
>> valid for datatype XSD XMLLiteral
>>
>> and then further down in SPARQL queries:
>>
>> 13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
>> exception: "https://xx.xx.xx/PC\
>> "/>"^^rdf:XMLLiteral
>>
>> The encoded XML is however valid.
>>
>> Is it possible to explicitely create literals with XMLLiteral datatype in
>> RDF/XML by setting this datatype explicitely ?
>>
>> Thanks
>> Thomas
>>
>>
>> --
>>
>> *Thomas Francart* -* SPARNA*
>> Web de *données* | Architecture de l'*information* | Accès aux
>> *connaissances*
>> blog : blog.sparna.fr, site : sparna.fr, linkedin :
>> fr.linkedin.com/in/thomasfrancart
>> tel :  +33 (0)6.71.11.25.97, skype : francartthomas


Re: rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-19 Thread Martynas Jusevičius
AFAIK for XMLLiterals you need to use rdf:parseType="Literal", rdf:datatype:
https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-XML-literals

On Fri, 19 Apr 2024 at 18.18, Thomas Francart 
wrote:

> Hello
>
> The RDF/XML parsing of the following succeeds:
>
> 
>
>  href="
> https://xx.xx.xx/PC"/>
>
> 
>
> while the RDF/XML parsing of this gives an error : in that case the XML has
> simply be encoded with , and  and the rdf:datatype has been
> explicitly set to XMLLiteral :
>
> 
>
> http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral
> ">amreferencesymbol
> href="https://xx.xx.xx/PC
> "//reference/am
>
> 
>
>
> The error is
>
> 13:08:04.742 WARN  org.apache.jena.riot - Lexical form
> 'https://xx.xx.xx/PC"/>' not
> valid for datatype XSD XMLLiteral
>
> and then further down in SPARQL queries:
>
> 13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
> exception: "https://xx.xx.xx/PC\
> "/>"^^rdf:XMLLiteral
>
> The encoded XML is however valid.
>
> Is it possible to explicitely create literals with XMLLiteral datatype in
> RDF/XML by setting this datatype explicitely ?
>
> Thanks
> Thomas
>
>
> --
>
> *Thomas Francart* -* SPARNA*
> Web de *données* | Architecture de l'*information* | Accès aux
> *connaissances*
> blog : blog.sparna.fr, site : sparna.fr, linkedin :
> fr.linkedin.com/in/thomasfrancart
> tel :  +33 (0)6.71.11.25.97, skype : francartthomas
>


rdf:parseType="literal" vs. rdf:datatype="...XMLLiteral"

2024-04-19 Thread Thomas Francart
Hello

The RDF/XML parsing of the following succeeds:



https://xx.xx.xx/PC"/>



while the RDF/XML parsing of this gives an error : in that case the XML has
simply be encoded with , and  and the rdf:datatype has been
explicitly set to XMLLiteral :



http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral;>amreferencesymbol
href="https://xx.xx.xx/PC
"//reference/am




The error is

13:08:04.742 WARN  org.apache.jena.riot - Lexical form
'https://xx.xx.xx/PC"/>' not
valid for datatype XSD XMLLiteral

and then further down in SPARQL queries:

13:08:04.775 WARN  o.apache.jena.sparql.expr.NodeValue - Datatype format
exception: "https://xx.xx.xx/PC\
"/>"^^rdf:XMLLiteral

The encoded XML is however valid.

Is it possible to explicitely create literals with XMLLiteral datatype in
RDF/XML by setting this datatype explicitely ?

Thanks
Thomas


-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas