I thought xml:base has to be enabled in the RDF/XML writer, it's no on
by default.
https://jena.apache.org/documentation/io/rdfxml_howto.html#advanced-rdfxml-output
However, we are wanting to ensure that there is an explicit baseURI present in the resulting serialization.
Out of curiosity, why do you want that?
Using ":" instead of a "base" seems quite common.
Andy
On 23/02/2019 00:42, Martynas Jusevičius wrote:
Sorry, can't run the test case right now.
No I'm thinking RDF/XML :) But the prefixes are only used for
properties, not subject (@rdf:about) or object (@rdf:resource) values.
What would you gain by adding an xml:base? You could shorten
prfx:lcl-name to just lcl-name by setting xml:base to prfx: namespace
URI, but that would only work for a single namespace.
And not sure how much sense it makes to compare RDF/XML with Turtle
because the former builds on XML which has its own namespace
mechanism. But maybe I'm completely misunderstanding what you are
trying to do :)
On Sat, Feb 23, 2019 at 12:18 AM Chris Tomlinson
<chris.j.tomlin...@gmail.com> wrote:
No.
If you run the test case you see that RDF/XML writes out xmlns defns of
prefixes and uses the prefixes in the serialization. Perhaps you are thinking
of n-triples.
Thanks,
Chris
On Feb 22, 2019, at 16:52, Martynas Jusevičius <marty...@atomgraph.com> wrote:
Isn't it so that RDF/XML writer always writes absolute URIs, so
xml:base is unnecessary because it would have no effect anyway?
On Fri, Feb 22, 2019 at 11:20 PM Chris Tomlinson
<chris.j.tomlin...@gmail.com> wrote:
Hello,
We are trying to serve various ontology files in a variety of serializations,
principally RDF/XML and Turtle.
The specs indicate that if the baseURI for an ontology is the URL by which the
ontology is retrieved then it is not required that the producer include an
explicit xml:base or @base or similar in the serialization.
However, we are wanting to ensure that there is an explicit baseURI present in
the resulting serialization.
This is because not all tools respect the injunction to use the URL that was
used to retrieve the ontology as the baseURI if there is not an explicit
xml:base or @base and so on in the serialization.
The question is that Model.write(OutputStream, Language, baseURI) includes an
@base when the language is “TURTLE“ in the serialization but when the language
is “RDF/XML” we do not see an xml:base in the result. (same happens when
OntModel is used and when RDFWriter is used.)
The docs indicate that the baseURI param is to be used to specify what URI
should be used to serialize relative URIs and says nothing about including
xml:base or @base; yet, we see the @base for Turtle and no xml:base for RDF/XML.
This is an issue when a tool requests RDF/XML before Turtle in accept headers
and requires that there be an xml:base in the RDF/XML serialization. Noting
that RDF/XML is the only required serialization.
What procedure should be used to “force” an @base or xml:base uniformly?
Here is a small test case that shows the issue:
https://github.com/buda-base/lds-pdi/blob/master/src/test/java/io/bdrc/ldspdi/test/ModelWriteTest.java
<https://github.com/buda-base/lds-pdi/blob/master/src/test/java/io/bdrc/ldspdi/test/ModelWriteTest.java>
Thank you,
Chris