W3C home > Mailing lists > Public > semantic-web@w3.org > July 2015

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

From: Mark Wallace <mwallace@modusoperandi.com>
Date: Tue, 21 Jul 2015 16:29:56 +0000
To: Andy Seaborne <andy@seaborne.org>, "semantic-web@w3.org" <semantic-web@w3.org>
Message-ID: <BY1PR08MB121273766DEAD1CC6EB42352C3840@BY1PR08MB1212.namprd08.prod.outlook.com>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 08:45:43 UTC