Re: default prefix without using base/BASE in turtle document

I concur with Andy (of course).

Here's a quick sample:

Initial file contents of 'demo.ttl':

     prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
     prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
     prefix :  <http://demo.org/>
     
     :bob a :Person .
     :bob :knows :bill .
     
     <> rdfs:comment "What does this do?" .
     <me> rdfs:comment "and this, w/o hash?".
     <#me> rdfs:comment "and this?" .
     
After I ran it through Jena's rdfcat tool:
     
     @prefix :      <http://demo.org/> .
     @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
     @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
     
     <file:///C:/home/mwallace/me>
             rdfs:comment  "and this, w/o hash?" .
     
     :bob    a       :Person ;
             :knows  :bill .
     
     <file:///C:/home/mwallace/demo.ttl#me>
             rdfs:comment  "and this?" .
     
     <file:///C:/home/mwallace/demo.ttl>
             rdfs:comment  "What does this do?" .

Note the URLs produced from the Turtle constructs '<>', '<me>', and '<#me>', with no @base statement used to explicitly set a base. 

--
Mark Wallace
PRINCIPAL ENGINEER, SEMANTIC APPLICATIONS
MODUS OPERANDI, INC.
________________________________________
From: Andy Seaborne <andy.seaborne@gmail.com> on behalf of Andy Seaborne <andy@seaborne.org>
Sent: Monday, July 20, 2015 1:22 PM
To: semantic-web@w3.org
Subject: Re: default prefix without using base/BASE in turtle document

On 20/07/15 17:57, Satrajit Ghosh wrote:
> hi,
>
> is there a way to write a turtle document that uses its own location as
> the base prefix?
>
> say on the server i have:
>
> <base_url>/doc.ttl
> <base_url>/some_file
>
> is there a specification in the language that allows the following
> statement in the doc.ttl file

RFC 3986 (section 5.1) - it covers establishing the base.

>
> :id :location <some_file>
>
> to expand to:
>
> :id :location <base_url>/some_file

It should do that.

>
> without having the *base* keyword in the document.
>
> basically i'm looking for a way to use relative IRIs such that doc.ttl
> and some_file can be moved to any server and still be linked to each
> other through the graph.
>
> according to this:
>
> http://www.w3.org/TR/turtle/#relative-iri
>
> it looks like the specification of base is mandatory.

There is always a base URI - it may come from BASE but that is only one
way to set the base URI.

It comes from the location (HTTP address) the file is read from (RFC
3986) up until the point BASE occurs (it need not be at the start of the
file nor be only used once).

        Andy

>
> cheers,
>
> satra

Received on Tuesday, 21 July 2015 16:30:29 UTC