OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xdi message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [xdi] ABNF pattern question - maybe for Joseph?


Joseph! You da man!

I tried it and it works like a charm. It makes total sense - force the parser to "chew" the sequence one subgraph at a time recursively, until it finds that the last subgraph is the correct terminal subgraph.

I have updated the ABNF I posted to https://wiki.oasis-open.org/xdi/XdiAbnf/Discussion to include this pattern, and now everything parses fine in http://www.coasttocoastresearch.com/interactiveapg.

And get this: it works fine without changing the "specific" rule:
specific                = "$" [ xdi-literal ]
In other words, with this revised ABNF, the parser seems to recognize attribute singletons just fine without requiring the "specific" rule to include an xdi-literal.

If that issue is closed, that means our final question revolves around the proposed literal reference statement that Markus is investigating.
literal-ref             = [ peer ] literal-context "/!/()"                 ; NEW
If the JSON serialization of this statement has an empty JSON object as the contents of the array -- and if in visual diagrams this is shown as a literal node box without a value -- then I believe it's all clean.

Once we have a decision about this, I think we're ready to put the ABNF into last call. Are there any other issues with it?

=Drummond 




On Mon, Mar 4, 2013 at 2:21 AM, Joseph Boyle <planetwork@josephboyle.net> wrote:



How about these rewrites?

ID = DIGIT ID / ALPHA ID / DIGIT
collection-context = singleton collection-context / collection collection-context / collection member collection-context / collection
literal-context    = singleton    literal-context / collection    literal-context / collection member    literal-context / collection attribute-member / attribute-singleton

The [ peer ] that was at the beginning has to be moved off to another rule though.

On Mar 3, 2013, at 11:32 PM, Drummond Reed <drummond.reed@xdi.org> wrote:

I'm posing this question of everyone on the TC but hoping Joseph might have some time to dig into it. 

When I completed my action item from last Fridays's telecon to shorten the Ful Graph ABNF by condensing some of the rules (see the 2013-03-02 post to https://wiki.oasis-open.org/xdi/XdiAbnf/Discussion), I also update it with Markus' simpler version of the collection-context and literal-context rules. See the bolded lines below (these most likely wrap in this email).
literal                 = literal-value / literal-ref
literal-value           = literal-context "/!/" data-xref
literal-ref             = literal-context "/!/()"                                                              <== NEW

context                 = peer / peer-relative-context / relative-context
peer                    = 1*xref
peer-relative-context   = peer relative-context
relative-context        = 1*( singleton / ( collection [ member ] ) )

collection-context      = [ peer ] *( singleton / ( collection [ member ] ) ) collection

member-context          = member [ relative-context ]

literal-context         = [ peer ] *( singleton / ( collection [ member ] ) ) ( attribute-singleton / collection attribute-member )   
The problem is that, as Markus noted, these don't actually work with the Interactive APG parser. I did a little testing this weekend and found it's because the "tail matching" pattern itself doesn't work. For example, I created this very simple test of an ABNF _expression_ that would match a string containing any combination of letters and digits as long as it ended it a digit:

ID        =  *( DIGIT / ALPHA ) DIGIT
ALPHA     =  %x41-5A / %x61-7A   ; A-Z / a-z
DIGIT     =  %x30-39     ; 0-9

As I suspected, it doesn't work. As Markus detected last week, the greedy algorithm "sucks up" all the letters and digits in the *( DIGIT / ALPHA )rule and doesn't leave any to match the final DIGIT rule. 

So, here's my question to Joseph (or anyone else who's deep enough into ABNF to answer it): is there an ABNF pattern I'm missing that's able to match the tail token in a sequence of tokens?

That's what we need for the collection-context and literal-context rules in the Full Graph ABNF.

Thanks,

=Drummond  








[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]