afs commented on issue #2619:
URL: https://github.com/apache/jena/issues/2619#issuecomment-2267650165

   jena4 doesn't seem to write it as an RDF XMLLiteral - it's using 
`rdf:datatype` not `rdf:parseType="Literal"`
   
   I suspect it is because the implementation of the datatype has changed. It's 
an illegal RDF XMLLIteral in RDF 1.0
   
   If namespaces are set it work as a `rdf:parseType="Literal"` in jena5
   
   I suspect it is because Jena 5.1.0 has the RDF 1.1 definition of RDF XML 
Literal.
   
   Jena 4.10 had the RDF 1.0 definition.
   
   Try this, then change the literal to "<ns:text>ABC" -  not handling an 
illegal rdf:XMLliteral properly.
   
   ```java
       public static void main(String... args) {
           String literal = "<ns:text>ABC</ns:text>";
           var m = ModelFactory.createDefaultModel();//createOntologyModel();
           m.createResource().addProperty(RDFS.comment, 
m.createTypedLiteral(literal, RDF.dtXMLLiteral));
           m.setNsPrefix("ns",  "http://example/";);
   
           System.out.println("---- Lang.TTL");
           RDFWriter.source(m).lang(Lang.TTL).output(System.out);
           System.out.println("---- model - rdf/xml");
           m.write(System.out, "rdf/xml");
           System.out.println("---- RDFFormat.RDFXML_ABBREV");
           
RDFWriter.source(m).format(RDFFormat.RDFXML_ABBREV).output(System.out);
           System.out.println("---- RDFFormat.RDFXML_PLAIN");
           
RDFWriter.source(m).format(RDFFormat.RDFXML_PLAIN).output(System.out);
           System.out.println("----");
   
           StringWriter sw = new StringWriter();
           m.write(sw, "rdf/xml");
           System.out.println(sw);
           StringReader sr = new StringReader(sw.toString());
           ModelFactory.createDefaultModel().read(sr, null, "rdf/xml");
           System.out.println("---- done");
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to