You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Norman Walsh <nd...@nwalsh.com> on 2013/08/15 16:39:10 UTC
Leaving URIs relative
Hello world,
If I load this .ttl file with Jena:
<http://example.org/ml/people/John_Smith> <livesIn> "London" .
Jena helpfully makes the livesIn URI absolute using the file I loaded
or, if I specify a baseURI, absolute with respect to that base URI.
Is there any way to leave it relative? It happens that I'm moving the
data from one place to another and I'd just as soon not bake the
absolute URI of the source document into the model.
Be seeing you,
norm
--
Norman Walsh <nd...@nwalsh.com> | Kinship is healing; we are physicians
http://nwalsh.com/ | to each other.--Oliver Sacks
Re: Leaving URIs relative
Posted by Andy Seaborne <an...@apache.org>.
On 15/08/13 22:29, Dave Reynolds wrote:
> Note that for RDF/XML-ABBREV writer at least you can set your own dummy
> base URI on the read API call, set the same intended base URI on the
> write call and so preserve relative URIs that way.
>
> Not sure if that works with the Turtle writer.
Not exactly.
You can specific the base (not via RDFDataMgr currently, but if you call
the writer directly).
The writer will use that to abbreviate URIs but it will also add a @base
declaration to the front of the file.
If there is sufficient demand (and a contributed patch), then the way to
do this might be to add a option via the associated context. This would
declare the base URI and also instruct the writer not to write it into
the file.
Or call "tail -n +2" on the current output with a base setting.
Andy
>
> Dave
>
> On 15/08/13 22:12, Martynas Jusevičius wrote:
>> Are you getting data with relative URIs? Can't you set base URI
>> programatically?
>>
>> Here's some code that does that:
>> https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/processor/provider/OntologyProvider.java
>>
>>
>> Martynas
>> On Aug 15, 2013 11:34 PM, "Norman Walsh" <nd...@nwalsh.com> wrote:
>>
>>> Martynas Jusevičius <ma...@graphity.org> writes:
>>>> No, URIs are absolute in RDF model, even though they can be relative
>>>> in serializations.
>>>> Why don't you use base URI (@base in Turtle) and/or prefixes so that
>>>> URIs stay stable no matter where you load the file from?
>>>
>>> It's not my data. :-)
>>>
>>> Thanks, though, for confirming what I expected.
>>>
>>> Be seeing you,
>>> norm
>>>
>>> --
>>> Norman Walsh <nd...@nwalsh.com> | Hanging is too good for a man who makes
>>> http://nwalsh.com/ | puns; he should be drawn and
>>> | quoted.--Fred Allen
>>>
>>
>
Re: Leaving URIs relative
Posted by Dave Reynolds <da...@gmail.com>.
Note that for RDF/XML-ABBREV writer at least you can set your own dummy
base URI on the read API call, set the same intended base URI on the
write call and so preserve relative URIs that way.
Not sure if that works with the Turtle writer.
Dave
On 15/08/13 22:12, Martynas Jusevičius wrote:
> Are you getting data with relative URIs? Can't you set base URI
> programatically?
>
> Here's some code that does that:
> https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/processor/provider/OntologyProvider.java
>
> Martynas
> On Aug 15, 2013 11:34 PM, "Norman Walsh" <nd...@nwalsh.com> wrote:
>
>> Martynas Jusevičius <ma...@graphity.org> writes:
>>> No, URIs are absolute in RDF model, even though they can be relative
>>> in serializations.
>>> Why don't you use base URI (@base in Turtle) and/or prefixes so that
>>> URIs stay stable no matter where you load the file from?
>>
>> It's not my data. :-)
>>
>> Thanks, though, for confirming what I expected.
>>
>> Be seeing you,
>> norm
>>
>> --
>> Norman Walsh <nd...@nwalsh.com> | Hanging is too good for a man who makes
>> http://nwalsh.com/ | puns; he should be drawn and
>> | quoted.--Fred Allen
>>
>
Re: Leaving URIs relative
Posted by Martynas Jusevičius <ma...@graphity.org>.
Are you getting data with relative URIs? Can't you set base URI
programatically?
Here's some code that does that:
https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/processor/provider/OntologyProvider.java
Martynas
On Aug 15, 2013 11:34 PM, "Norman Walsh" <nd...@nwalsh.com> wrote:
> Martynas Jusevičius <ma...@graphity.org> writes:
> > No, URIs are absolute in RDF model, even though they can be relative
> > in serializations.
> > Why don't you use base URI (@base in Turtle) and/or prefixes so that
> > URIs stay stable no matter where you load the file from?
>
> It's not my data. :-)
>
> Thanks, though, for confirming what I expected.
>
> Be seeing you,
> norm
>
> --
> Norman Walsh <nd...@nwalsh.com> | Hanging is too good for a man who makes
> http://nwalsh.com/ | puns; he should be drawn and
> | quoted.--Fred Allen
>
Re: Leaving URIs relative
Posted by Norman Walsh <nd...@nwalsh.com>.
Martynas Jusevičius <ma...@graphity.org> writes:
> No, URIs are absolute in RDF model, even though they can be relative
> in serializations.
> Why don't you use base URI (@base in Turtle) and/or prefixes so that
> URIs stay stable no matter where you load the file from?
It's not my data. :-)
Thanks, though, for confirming what I expected.
Be seeing you,
norm
--
Norman Walsh <nd...@nwalsh.com> | Hanging is too good for a man who makes
http://nwalsh.com/ | puns; he should be drawn and
| quoted.--Fred Allen
Re: Leaving URIs relative
Posted by Martynas Jusevičius <ma...@graphity.org>.
No, URIs are absolute in RDF model, even though they can be relative
in serializations.
Why don't you use base URI (@base in Turtle) and/or prefixes so that
URIs stay stable no matter where you load the file from?
Martynas
On Thu, Aug 15, 2013 at 5:39 PM, Norman Walsh <nd...@nwalsh.com> wrote:
> Hello world,
>
> If I load this .ttl file with Jena:
>
> <http://example.org/ml/people/John_Smith> <livesIn> "London" .
>
> Jena helpfully makes the livesIn URI absolute using the file I loaded
> or, if I specify a baseURI, absolute with respect to that base URI.
>
> Is there any way to leave it relative? It happens that I'm moving the
> data from one place to another and I'd just as soon not bake the
> absolute URI of the source document into the model.
>
> Be seeing you,
> norm
>
> --
> Norman Walsh <nd...@nwalsh.com> | Kinship is healing; we are physicians
> http://nwalsh.com/ | to each other.--Oliver Sacks