sszuev opened a new issue, #2473:
URL: https://github.com/apache/jena/issues/2473

   ### Version
   
   5.0.0
   
   ### What happened?
   
   The following code works fine in Jena 4.10.0, but fails in Jena 5.0.0
   ```java
           String xml = "<rdf:RDF \n" +
                   "    
xml:base=\"http://iec.ch/TC57/2014/CIM-schema-cim16#\"\n"; +
                   "    
xmlns:dm=\"http://iec.ch/2002/schema/CIM_difference_model#\"; \n" +
                   "    
xmlns:md=\"http://iec.ch/TC57/61970-552/ModelDescription/1#\"\n"; +
                   "    
xmlns:cim=\"http://iec.ch/TC57/2014/CIM-schema-cim16#\"\n"; +
                   "    
xmlns:meta=\"http://iec.ch/TC57/2014/CIM-schema-cim16#\"\n"; +
                   "    
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\";>\n" +
                   "<dm:DifferenceModel 
rdf:about=\"#_248c809d-1d7b-397c-830f-6928007ae6d9\">                \n" +
                   "<md:Model.version>1715589426</md:Model.version>\n" +
                   
"<md:Model.created>2024-05-13T08:37:06.830Z</md:Model.created>\n" +
                   
"<md:Model.scenarioTime>2024-05-13T08:37:06.830Z</md:Model.scenarioTime>\n" +
                   "<md:Model.profile>http://profile/</md:Model.profile>\n" +
                   
"<md:Model.modelingAuthoritySet>unknown</md:Model.modelingAuthoritySet>\n" +
                   
"<meta:Model.modelVersionIri>http://ontology.adms.ru/UIP/md/2021-1</meta:Model.modelVersionIri>\n"
 +
                   
"<meta:Model.differenceFrom>2024-04-01T07:55:06.779475Z</meta:Model.differenceFrom>\n"
 +
                   
"<meta:Model.differenceTo>2027-10-01T08:37:06.779475Z</meta:Model.differenceTo>\n"
 +
                   "<dm:forwardDifferences parseType=\"Statements\">\n" +
                   "<cim:A rdf:about=\"#_individual-A-1\">\n" +
                   "<cim:A-2-B rdf:resource=\"#_individual-B-1\"/>\n" +
                   "</cim:A>\n" +
                   "<cim:B rdf:about=\"#_individual-B-1\"/>\n" +
                   "<cim:D rdf:about=\"#_individual-D-1\"/>\n" +
                   "</dm:forwardDifferences>\n" +
                   "<dm:reverseDifferences parseType=\"Statements\">\n" +
                   "</dm:reverseDifferences>\n" +
                   "</dm:DifferenceModel>\n" +
                   "</rdf:RDF> ";
   
   
           Model res = ModelFactory.createDefaultModel();
           RDFParserBuilder
                   .create()
                   .fromString(xml)
                   .forceLang(Lang.RDFXML)
                   .build()
                   .parse(res);
   
           res.write(System.out, "ttl");
   
           // dm:forwardDifferences & dm:reverseDifferences expected to be 
rdf:XMLLiteral literals
           Literal literal = res.listStatements(
                   null,
                   
ResourceFactory.createProperty("http://iec.ch/2002/schema/CIM_difference_model#forwardDifferences";),
                   (RDFNode) null
           ).mapWith(Statement::getLiteral).toList().get(0);
   
           System.out.println(literal.getLexicalForm());
   ```
   
   Is there any workaround? This issue blocks upgrading Jena version.
   
   ### Relevant output and stacktrace
   
   ```shell
   Exception in thread "main" 
org.apache.jena.rdf.model.LiteralRequiredException: 
http://iec.ch/TC57/2014/CIM-schema-cim16#_individual-A-1
        at 
org.apache.jena.rdf.model.impl.StatementImpl.getLiteral(StatementImpl.java:101)
        at 
org.apache.jena.util.iterator.Map1Iterator.lambda$forEachRemaining$0(Map1Iterator.java:55)
        at 
org.apache.jena.util.iterator.Map1Iterator.lambda$forEachRemaining$0(Map1Iterator.java:55)
        at 
org.apache.jena.mem.ArrayBunch$2.forEachRemaining(ArrayBunch.java:129)
        at 
org.apache.jena.util.iterator.WrappedIterator.forEachRemaining(WrappedIterator.java:113)
        at 
org.apache.jena.mem.TrackingTripleIterator.forEachRemaining(TrackingTripleIterator.java:58)
        at 
org.apache.jena.util.iterator.Map1Iterator.forEachRemaining(Map1Iterator.java:54)
        at 
org.apache.jena.util.iterator.WrappedIterator.forEachRemaining(WrappedIterator.java:113)
        at 
org.apache.jena.util.iterator.Map1Iterator.forEachRemaining(Map1Iterator.java:54)
        at 
org.apache.jena.util.iterator.NiceIterator.asList(NiceIterator.java:241)
        at 
org.apache.jena.util.iterator.NiceIterator.toList(NiceIterator.java:214)
        at com.gitlab.sszuev.Main.main(Main.java:59)
   ```
   ```
   
   
   ### Are you interested in making a pull request?
   
   None


-- 
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