Re: Is <> a legal way to self-reference a named graph in a dataset in TriG?

Hi Pierre-Antoine,

> Am 17.09.2022 um 18:52 schrieb Pierre-Antoine Champin <pierre-antoine@w3.org>:
> 
> Hi Thomas,
> 
> (NB: I changed the order of your text to make my answers more structured and, hopefully, easier to follow)
> 
> On 17/09/2022 06:59, Thomas Lörtsch wrote:
>> Dear list,
>> 
>> another question, and the last one for today, promise!
>> 
>> 
>> I’m under the impression that in N3-ish RDF serializations the pair of pointy brackets <> refers to the current document, i.e. [0]
>> 
>>    <> :type :eMail
> To be more precise, <> resolves to the current base IRI, which defaults to the IRI of the current documebut can be overridden (e.g. using @base in Turtle / TriG).
>> And is this all just convention (and up for debate) or is it defined somewhere? The syntax doesn’t seem to be part of SPARQL, Turtle or TriG.
> 
> Of course it is! This is just a special case of the IRIREF production in Turtle and friends:
> 
>   [18]     IRIREF     ::=     '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'
> 
> where the content of the pointy brackets is allowed to be empty (the empty string is a valid relative IRI).
> 
>> And what about TriX, RDF/XML even, JSON-LD? Do they provide a means to self-reference the current graph itself?
> in TriX: <uri></uri>
> in RDF/XML: rdf:about=""
> in JSON-LD: @id=""
>> But what about named graphs in RDF 1.1? In a named graph, contained in a dataset, does '<>' refer to the named graph itself, or to the enclosing dataset?
> 
> This question does not really make sense, because it mixes elements of the abstract syntax (named graph, dataset) and elements of the concrete syntax (the empty relative IRI).

That may very well be so, and I will have to study the difference between abstract and concrete syntax before I can properly understand your answer.

> Remember that in the abstract syntax, all IRIs are absolute. Relative IRIs must be resolved to absolute IRIs when parsing the concrete synytax. I hope that my explanations above make it clearer.
> 
> Following this,  the following TriG file located at http://ex.co/test.trig
> 
>   PREFIX s: <http://schema.org/>
>   GRAPH <#foo> {
>       <> s:name "Bar".
>   }
> 
> would produce the same dataset as the following N-quad:
> 
>   <http://ex.co/test.trig> <http://schema.org/name> "Bar" <http://ex.co/test.trig#foo>.

Thank you very much, that answered one part of my question exhaustively! But it doesn’t solve my problem: how would I refer to a named graph in a dataset from inside that named graph without knowing its name? It now seems to me that that’s simply not possible.


Thomas


> best
> 
>> 
>> Best,
>> Thomas
>> 
>> 
>> 
>> [0] The example glosses over the fact that the rest of this document is not valid RDF. A similar example can be found in the heading of <http://infomesh.net/2002/notation3/>
> <OpenPGP_0x9D1EDAEEEF98D438.asc>

Received on Saturday, 17 September 2022 17:53:39 UTC