eclipse / lyo

Eclipse Lyo, a Java SDK for OSLC-based tool integration
https://oslc.github.io/developing-oslc-applications/eclipse_lyo/eclipse-lyo.html
Eclipse Public License 2.0
13 stars 15 forks source link

Jena warnings when marshelling rdf/xml resources, where the property is XMLLiteral #211

Open jad-elkhoury opened 2 years ago

jad-elkhoury commented 2 years ago

Apache Jena produces a warning when it tries to read a XMLLiteral Property.

org.apache.jena.riot - Lexical form 'some text with strange & unstrange stuff' not valid for datatype XSD XMLLiteral

To reproduce this probem, run the rm-adaptor from https://github.com/OSLC/lyo-adaptor-sample-modelling/tree/Bug_XmlLiterals

a GET request on http://localhost:8083/adaptor-rm/services/requirements/3, with accept application/rdf+xml returns the content below. No warnings are produces.

Now try to do a PUT on the same URL, with content-type application/rdf+xml. Jena produces the warning above. This warning is produced in JMH, when one tries to read the model from the input stream. (before any Oslc-specific code is run).

The relevant property to focus on is oslc_rm:testProperty

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc_data="http://open-services.net/ns/servicemanagement/1.0/"
    xmlns:oslc="http://open-services.net/ns/core#"
    xmlns:oslc_rm="http://open-services.net/ns/rm#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <oslc_rm:Requirement rdf:about="http://localhost:8083/adaptor-rm/services/requirements/3">
        <oslc_rm:testProperty rdf:datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"
    >some text with strange &amp; unstrange stuff</oslc_rm:testProperty>
        <dcterms:title>aTitle with id:3</dcterms:title>
        <dcterms:identifier>3</dcterms:identifier>
        <dcterms:description>A sample Requirement with id:3</dcterms:description>
    </oslc_rm:Requirement>
</rdf:RDF>
jad-elkhoury commented 2 years ago

@berezovskyi !

I thought we ought to fix this problem since the problem occurs when Lyo tries to read input that Lyo produces. So we have no one else to blame :-)

dhakehurst commented 2 months ago

Its been a couple of years? anyone able to fix this...I'm hitting the same issue

berezovskyi commented 2 months ago

@dhakehurst you are right, it's been quite some time. I think https://github.com/eclipse/lyo/pull/214 is the fix for this but we have been a bit reluctant to merge it without broader testing given the potential regression surface.

Would you be able to check if that PR resolves the problem for you without introducing any undesirable side effects, please?

dhakehurst commented 1 month ago

Sorry, I'm unable to build a version with that PR, to test against, at present.