W3C home > Mailing lists > Public > public-cwm-bugs@w3.org > May 2004

qnames with - in cwm

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Tue, 4 May 2004 10:39:34 +0100
To: public-cwm-bugs@w3.org
Message-Id: <20040504103934.1f962a3b@hoth.ilrt.bris.ac.uk>

I was not sure where to send this, since I consider it more a Notation3
bug than a CWM bug. http://www.w3.org/DesignIssues/Notation3 doesn't say
to send to any particular list.  Maybe not here but public-cwm-talk?

I noticed you've switched the definition of Notation3's specification in
April, more about this in other messages.

http://www.w3.org/DesignIssues/Notation3 says:
[[
Identifier munging

This syntax does not allow minus signs in identifiers, whereas the
XML encoding for RDF does.
]]

The reference implementation of N3, cwm has been more generous
(in a checked out dev.w3.org/2000/10/swap):

$ grep -i A-Z *|grep -i qname
rdfn3.g:    token QNAME:    r'([a-zA-Z][a-zA-Z0-9_-]*)?:[a-zA-Z0-9_-]+'
rdfn3_yapps.py:            ('QNAME', '([a-zA-Z][a-zA-Z0-9_-]*)?:[a-zA-Z0-9_-]+'),
relaxNG.g:    token QName : r'[a-zA-Z0-9_-]+:[a-zA-Z0-9_-]+' # @@???

and in notation3.py:
  _notQNameChars = "\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~"  # Assume anything else valid qname :-/
(as used in 'def qname' later)

All of these would allow foo:bar-baz

Trivial test:

$ cat > t.n3
@prefix foo: <http://example.org/> .
foo:bar foo:baz foo:bar-baz .
$ cwm t.n3
#Processed by Id: cwm.py,v 1.148 2004/03/21 04:24:32 timbl Exp
        #    using base file:/home/cmdjb/w3c/2000/10/swap/t.n3
         
#  Notation3 generation by
#       notation3.py,v 1.153 2004/03/21 04:24:35 timbl Exp
 
#   Base was: file:/home/cmdjb/w3c/2000/10/swap/t.n3
     
    <http://example.org/bar>     <http://example.org/baz> <http://example.org/bar-baz> .
     
#ENDS
  

The newer http://www.w3.org/2000/10/swap/grammar/n3.n3
CVS 1.9 2003/10/30 22:41:34 says
  qname bnf:matches "(([a-zA-Z_][a-zA-Z0-9_]*)?:)?([a-zA-Z_][a-zA-Z0-9_]*)?";

I think it would be a good idea to allow - inside qnames.  You can other
uses by whitespace and let people avoid CamelCase inside names if they
don't like that.

I think some people have already been using - in names, relying on cwm
accepting it.  (I had a quick look and, for example, Jena's N3 parser
accepts it).  I'm tempted to add it to Turtle to match what people are
using and want to use.

Dave
Received on Tuesday, 4 May 2004 05:40:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:51:59 UTC