Re: Implementation Report for Ruby LD Patch implementation

Another piece of feedback on the grammar: The spec uses the @prefix notation from Turtle, but does not also allow the PREFIX form, inherited from SPARQL. This was added to make copy and paste between Turtle and SPARQL documents simpler, and the same rational might apply for LD Patch. Suggested grammar change would be:

[2] prologue ::= (prefixID | sparqlPrefix)*
[6s] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF

My own grammar for Turtle uses the following:

[4] prefixID ::= PREFIX PNAME_NS IRIREF "."?
[28t] PREFIX ::= "@"?[Pp][Rr][Ee][Ff][Ii][Xx]

which is more permissive, but reduces complexity.

Of course, not including it might be intentional, but I’d consider adding it for simpler compatibility with both SPARQL and Turtle in the future.

Gregg

> On Aug 23, 2015, at 10:35 PM, Gregg Kellogg <gregg@greggkellogg.net> wrote:
> 
> I’ve completed an implementation of a Linked Data Patch Format processor in Ruby, compatible with the RDF.rb suite.
> 
> github: https://github.com/ruby-rdf/ld-patch
> gem: https://rubygems.org/gems/ld-patch
> earl report: https://raw.githubusercontent.com/ruby-rdf/ld-patch/develop/etc/earl.ttl
> earl report (as HTML+RDFa): https://htmlpreview.github.com/?https://github.com/ruby-rdf/ld-patch/blob/develop/etc/earl.html
> 
> As noted in the README on GitHub, this implementation uses a small variation on the EBNF Grammar:
> 
> * The INDEX terminal was removed in favor of using INTEGER. As both INDEX and INTEGER can match the same terminals, it lead to an ambiguity that my LL(1) processor could not handle properly.
> * The graph production is changed as follows:
> 
> [18] graph ::= triples ('.' triples?)*
> 
> This has the advantage of being context free, although does allow for repeated ‘.’ at the end of a graph, which certain tests ported from Turtle check for.
> 
> The original production:
> 
> [18] graph ::= triples ( '.' triples )* '.’?
> 
> is not context free, as ‘.’ is in the FIRST of two different productions; I think it should be replaced in the version I used for the grammar to be context free.
> 
> This is a stand-alone processor, and needs to be integrated with an LDP server to be useful, such as https://github.com/ruby-rdf/rdf-ldp.
> 
> Gregg Kellogg
> gregg@greggkellogg.net
> 

Received on Tuesday, 25 August 2015 22:55:12 UTC