Re: sparlx.rnc in CVS

Kendall Clark wrote:
> Folks,
> 
> This has no status whatever, of course, but I decided to checkin the
> latest RNC schema for SparqlX into CVS, in case others wanted to look
> at or work on it.
> 
> It's valid and improved over the last version I sent to the list. In
> particular, there was a spurious <pattern-group> element that's been
> removed completely. As well as a few other changes, mostly to
> cardinalities of some stuff arising from Andy's comments.

The main part of my comments was about making the XML line up with the rq23 
definitions, especially the version of group-pattern defined recursively. 
That's most easily done by aligning it with the higher levels of the grammar in 
the doc, afetr all the syntactic overlay has been dealt with.

sparqlx.rnc defines something rather different - it does not seem to allow the 
nesting of GRAPH and UNION for example.  Is there a reason for this?  I would 
assume it isn't a restriction due to the protocol - if it is, then it would be 
helpful to me to bring this out as a separate discussion thread.


element query-pattern {
       (element group-pattern
          | element triple-pattern
          | element optional-group { group-pattern }
          | element dataset-constraint {
              (uri | variable), group-pattern
            }
          | element union { group-pattern* }
          | element constraint { ... }
          | element group-pattern
       )*
     }

This allows recursing defintions: e.g. a GRAPH round a UNION:

SELECT *
{
   GRAPH ?g {
     { ?a ?b ?c . FILTER ?c  < 3 } UNION { :x :y :z . :a :b :c }
   }
}

     Group
       Graph
         Group
           Union
             Group
               Triple pattern  ?a ?b ?c
               Constriant ?c < 3
             Group
               Triple pattern  :x :y :z
               Triple pattern  :a :b :c

Roughly - every {} turns into a group, every graph combination operator turns 
into an element.

[[Apologies for any incomprehensible RelaxNG - I haven't quite got round to 
setting up some tools for it yet.]]

> 
> Once someone on Team makes it accessible, it should be available as
> 
>      http://www.w3.org/2001/sw/DataAccess/sparqlx.rnc
> 
> And I'm including it in this message, as well.
> 
> Kendall Clark
> 
> #$Id: sparqlx.rnc,v 1.1 2005/03/23 21:02:32 kclark Exp $
> 
> default namespace = "http://www.w3.org/2001/sw/DataAccess/sparql-xml-syntax/"
> 
> start =
>     element rdf-query {
>         (element ask { empty }
>          | element construct {
>                triple-pattern
>                | element graph-template { triple-pattern+ }
>            }
>          | element describe { variable*, uri? }
>          | element select {
>                attribute distinct { xsd:boolean }?,
>                attribute limit { xsd:int }?,
>                attribute offset { xsd:int }?,
>                variable+
>            }),
>         element query-pattern {
>             triple-pattern*,
>             (group-pattern*
>              | element dataset-constraint { (uri | variable), (group-pattern+ | triple-pattern+) }*
>              | element union { group-pattern+ | group-pattern+ }*)
>         }?
>     }
> variable =
>     element variable {
>         attribute name { xsd:NCName }
>     }
> uri = element uri { xsd:anyURI }
> triple-pattern =
>     element triple-pattern {
>         attribute optional { xsd:boolean }?,
>         element subject { bnode | uri | variable },
>         element predicate { bnode | uri | variable },
>         element object {
>             bnode
>             | uri
>             | variable
>             | element literal {
>                   attribute datatype { xsd:anyURI }?,
>                   attribute lang { xsd:NCName }?,
>                   text
>               }
>         },
>         constraint?
>     }
> group-pattern =
>     element group-pattern {
>         attribute optional { xsd:boolean }?,
>         (group-pattern*, triple-pattern*, constraint?)
>     }
> bnode =
>     element bnode {
>         attribute id { xsd:NCName }
>     }
> # this needs lots of work...
> constraint = element constraint { (text | variable)+ }
> 

Received on Thursday, 24 March 2005 12:25:51 UTC