N3 syntax and parser

I've been playing with N3 and the Python parser linked from 
http:/www.w3.org/DesignIssues/Notation3.

I find myself puzzled by the motivation for the ':-' option, and note a 
discrepancy between the given syntax and behaviour of the Python program:

...

The syntax:

property-list
      void ( to allow [...]. )
      verb object-list
      verb object-list ; property-list
      :- anonnode
         (to allow two anonymous forms to be given eg [ a :Truth; :- { :sky 
:color :blue } ] )
      :- anonnode ; property-list

Suggests that the following should be allowed:

     @prefix default <#>.
     [ a :Truth;  ] .
     :foo a :thing ; :- { :sky :color :blue } ; a :other .

But the program gives the following result and syntax error:

     <STDIN>     <http://www.w3.org/2000/10/swap/log.n3#forSome> :_g0 .

     :_g0     a :Truth .

     :foo     a :thing .

     :sky     :color :blueTraceback (most recent call last):
   File "notati~2.py", line 1645, in ?
     doCommand()
   File "notati~2.py", line 1629, in doCommand
     p.load("")
   File "notati~2.py", line 185, in load
     self.feed(sys.stdin.read())     # May be big - buffered in memory!
   File "notati~2.py", line 200, in feed
     i = self.directiveOrStatement(str,j)
   File "notati~2.py", line 214, in directiveOrStatement
     if j>=0: return self.checkDot(str,j)
   File "notati~2.py", line 475, in checkDot
     raise BadSyntax(str, i, "expected '.' or '}' or ']' at end of statement")
__main__.BadSyntax: bad syntax (expected '.' or '}' or ']' at end of statement)
at: "...ing ; :- { :sky :color :blue }^ ; a :other .
"

...

Regarding the purpose of ":-".

As far as I can tell, the effect of

    s1 p1 o1 ; :- { s2 p2 o2 } .

is identical to:

    s1 p1 o1.
    s2 p2 o2.

I don't see the motivation for allowing this form.

...

And a final observation:  the Notation3.py source code contains a mix of 
tab and space characters that results in invalid Python syntax when the 
tabs are converted to anything other than 8 spaces.  For public 
distribution, I think it would be safer to convert all tabs in Python 
source code to spaces.

...

#g


------------
Graham Klyne
(GK@ACM.ORG)

Received on Sunday, 18 March 2001 20:35:02 UTC