You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Damien Cram <da...@gmail.com> on 2010/12/29 16:11:51 UTC
Base URI in turtle output
Hi all,
I can't manage to produce Turtle output with a base URI from a Jena model.
The following piece of code...
---
Model model = ModelFactory.createDefaultModel();
model.add(
model.getResource("http://mydomain/resource1/"),
model.getProperty("http://mydomain/property1"),
model.getResource("http://mydomain/resource2/")
);
model.getWriter("TURTLE").write(model, System.out, "http://mydomain/");
---
produces :
---
<http://mydomain/resource1/>
<http://mydomain/property1>
<http://mydomain/resource2/> .
---
while I expected :
---
<resource1/>
<property1>
<resource2/> .
---
Any idea how I could produce the above output ?
Many thanks in advance,
Damien
Re: Base URI in turtle output
Posted by Andy Seaborne <an...@epimorphics.com>.
Hi Damien,
The Turtle writer does not use the base when writing. It could do, and
write a @base declaration, but it doesn't.
It does use prefixes, where possible.
Andy
On 29/12/10 15:11, Damien Cram wrote:
> Hi all,
>
> I can't manage to produce Turtle output with a base URI from a Jena model.
> The following piece of code...
>
> ---
> Model model = ModelFactory.createDefaultModel();
> model.add(
> model.getResource("http://mydomain/resource1/"),
> model.getProperty("http://mydomain/property1"),
> model.getResource("http://mydomain/resource2/")
> );
> model.getWriter("TURTLE").write(model, System.out, "http://mydomain/");
or just
model.write(System.out, "TURTLE");
> ---
>
> produces :
>
> ---
> <http://mydomain/resource1/>
> <http://mydomain/property1>
> <http://mydomain/resource2/> .
> ---
>
> while I expected :
>
> ---
> <resource1/>
> <property1>
> <resource2/> .
> ---
>
> Any idea how I could produce the above output ?
>
> Many thanks in advance,
>
> Damien
>