william-vw opened a new issue, #2733:
URL: https://github.com/apache/jena/issues/2733

   ### Version
   
   5.1.0
   
   ### What happened?
   
   Reading rdf-star code into a `Model` and subsequently writing it to an 
output stream using the default format (`RDF/XML`) causes an error. It does not 
cause an error when writing to `TURTLE` or `N-TRIPLES`.
   
   ### Relevant output and stacktrace
   
   ```shell
   Code:
   
   
   Model m = ModelFactory.createDefaultModel();
                
   String rdf = 
        "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n"
        + "@prefix dc: <http://purl.org/dc/terms/> .\n"
        + "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"
        + "@prefix : <http://example.com/> .\n"
        + "\n"
        + "<p1> a :Person ;\n"
        + ":birthDate \"1901\" {| :source <wikidata/p1> |} .";
        
   m.read(new ByteArrayInputStream(rdf.getBytes()), "http://example.com/";, 
"TTL");
        
   // m.write(System.out, "N-TRIPLES");
   m.write(System.out);
   ```
   
   Stack trace:
   
   ```
   Exception in thread "main" java.lang.NullPointerException: Cannot invoke 
"String.length()" because "uri" is null
        at org.apache.jena.util.SplitIRI.splitNamespaceXML10(SplitIRI.java:477)
        at org.apache.jena.util.SplitIRI.splitXML10(SplitIRI.java:286)
        at 
org.apache.jena.rdfxml.xmloutput.impl.SplitRDFXML.splitXML10(SplitRDFXML.java:36)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.getXMLNameSpace(Unparser.java:1183)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.isLocalReference(Unparser.java:1200)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.hasProperties(Unparser.java:1279)
        at 
org.apache.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:57)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.wObjStar(Unparser.java:354)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.wRDF(Unparser.java:340)
        at 
org.apache.jena.rdfxml.xmloutput.impl.Unparser.write(Unparser.java:244)
        at 
org.apache.jena.rdfxml.xmloutput.impl.RDFXML_Abbrev.writeBody(RDFXML_Abbrev.java:127)
        at 
org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:471)
        at 
org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:447)
        at 
org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:434)
        at 
org.apache.jena.riot.adapters.AdapterRDFWriter.write(AdapterRDFWriter.java:64)
        at org.apache.jena.riot.RDFWriter.write$(RDFWriter.java:256)
        at org.apache.jena.riot.RDFWriter.output(RDFWriter.java:215)
        at org.apache.jena.riot.RDFWriter.output(RDFWriter.java:158)
        at 
org.apache.jena.riot.RDFWriterBuilder.output(RDFWriterBuilder.java:207)
        at 
org.apache.jena.riot.adapters.RDFWriterRIOT.write(RDFWriterRIOT.java:87)
        at org.apache.jena.rdf.model.impl.ModelCom.write(ModelCom.java:243)
        at Main.main(Main.java:27)
   
   ```
   ```
   
   
   ### 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