Re: Turtle support for Multiple Graphs, suggestion

On 01/04/11 17:10, Nathan wrote:
> Hi All,
>
> Just a quick, mini proposal wrt supporting multiple "named graphs" in
> turtle.

Personally, I have a preference for TriG[1] because it already exists. 
A disadvantage,  which your design supports, is that a valid Turtle file 
isn't a valid TriG file.  Not is an N-Quads file a valid TriG file.

The optional use of = for naming in TriG can be left to TF-Graphs :-)

>
> We could add a new keyword and directive, @graph (or @namespace), who's
> value was an IRI. This would be a minimal change to the grammar, for
> example:
>
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix dc: <http://purl.org/dc/elements/1.1/> .
> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
>
> # default graph
> <http://example.org/bob> dc:publisher "Bob" .
> <http://example.org/alice> dc:publisher "Alice" .
>
> @graph <http://example.org/bob> .
> _:a foaf:name "Bob" .
> _:a foaf:mbox <mailto:bob@oldcorp.example.org> .
>
> @graph <http://example.org/alice> .
> _:a foaf:name "Alice" .
> _:a foaf:mbox <mailto:alice@work.example.org> .
>
> I believe it's pretty self explanatory, so will spare getting in to any
> heavy details, other than a couple of basic questions:

Presumably, the file can go back to

@graph <http://example.org/bob> .

after another @graph.

But you can't go back to the default graph in this design.

TriG has an ambiguity when it says:
"""
Two additional rules apply:
     * Graph names must be unique within a TriG document.
     * There must be at most one unnamed graph in a TriG document.
"""

as to whether that's one block per graph or whether block for the same 
name get concatenated.  Allowing graphs to be split is my preference, 
which makes file concatenation of TriG files work.

How about TriG + allow un-{} triples for the default graph.

And quads for N-Quads?

> - What would the scope of @prefix and @base declarations be?
> (either no change / file wide, or with a scope of the nearest "@graph")
>
> - Would the value be an IRI, or an absolute-IRI?
> (my own preference would be the latter).

Same rules as IRIs in the rest of the document, including prefixed names.

@graph my:graph123 .


	Andy

>
> Best,
>
> Nathan
>

Aside: do we really need @everydirective? (except for compatibility of 
course - have "base" and "@base").

Any word with a colon is safe and @ is language tag which is why the 
grammar special cases all directives

[76s] <LANGTAG> ::=
     	BASE | PREFIX | "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*

to allow them as language tags.  (It's still an implementation pain for 
the tokenization/parser in some toolkits.)


[1] http://www4.wiwiss.fu-berlin.de/bizer/TriG/

Received on Friday, 1 April 2011 16:41:40 UTC