Hi Tim,
It's not to do with blank nodes.
On 05/10/13 02:05, Tim Harsch wrote:
The following gist:
https://gist.github.com/harschware/6835202
shows what I think may be a bug in the RDF/XML serializer. If I'm not mistaken
the output should look like something like this:
<rdf:Description rdf:nodeID="b0">
<ns0:p xmlns:ns0="http://" rdf:resource="http://o"/>
</rdf:Description>
That would be:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<rdf:Description rdf:nodeID="b0">
<ns0:p xmlns:ns0="http://" rdf:resource="http://o"/>
</rdf:Description>
</rdf:RDF>
(I don't do "something like this"!)
I can file a bug if there isn't one already.
Thanks,
Tim
[[
Exception in thread "main" com.hp.hpl.jena.shared.BadURIException: Only
well-formed absolute URIrefs can be included in RDF/XML output:
<http://> Code: 57/REQUIRED_COMPONENT_MISSING in HOST: A component that
is required by the scheme is missing.
]]
In Turtle etc, prefix names are defined by string concatenation.
XML has namespace rules. They are different.
http://www.w3.org/TR/REC-xml-names/#sec-namespaces
[[
Definition: An XML namespace is identified by a URI reference [RFC3986];
element and attribute names may be placed in an XML namespace using the
mechanisms described in this specification.
]]
so the namespace name must be a URI.
http://p is a legal URI but to create the property in RDF/XML you need a
qname.
The local part of a qname can't be the empty string (this is a gotcha if
you think Turtle).
Hence you thinking of "http://" but that's not a valid URI.
It would have been better if the code had not tried http:// in the first
place (e.g. http://example/123 gives "InvalidPropertyURIException")
The writer has stopped you creating illegal XML. Some XML parsers will
reject it; there are some very strict parsers. Xerces is a bit more
forgiving.
Jena parses the form above with a warning:
"""
WARN {W124} toAscii failed for namespace URI: <http://>. Bad
Internationalized Domain Name: String index out of range: 0
"""
so
"Be strict in what you output, be generous in what you accept."
Andy