repoze.urispace TODOs
=====================

Features
--------

- [x] Implement predicates which test URI elements.

      * Scheme elements.

      * Nethost ('<host>' or '<host>:<port>' elements.

      * Path elements.

      * Query elements.

- [x] Implement selectors which hold predicates and operators.

      * Always true (e.g., for the root of the URISpace).

      * Always false (e.g., to "comment out" some part of the tree)

      * Scheme elements.

      * Nethost ('<host>' or '<host>:<port>' elements.

      * Indiviual path elements.

      * Nested path elements.

      * Query elements.

- [x] Work out scheme for accumulating operators as selectors are
      matched.

- [x] Implement library functions for appliying operators to a set of
      asserted values.

      * 'replace'

      * 'clear'

      * 'union'

      * 'intersection'

      * 'difference'

      * 'rev-difference'

      * 'prepend'

      * 'append'

- [x] Implement parser.

      * Convert ET elements to selectors via tagname.

      * Convert ET elements to operators via tagname and 'urispace:op'.

      * Parse XML to ET and walk, building selector tree with operator
        leaves.

- [x] Implement command-line test application, taking a spec file and a
      URI and emitting assertions.

- [x] Implement middleware, which applies pre-parsed ruleset to the
      current request's URI and stashes asserted values under the
      magic key.

- [x] Implement a library function allowing downstream applications to
      retrieve values from the environment, as set by the middleware.


Bugs
----

- [_] Spec says that nethost selectors can take space-delimited alternates,
      but we don't allow it.  E.g.,::
      
       <urispace:host match="foo.com bar.com">...</urispace:host>

      should create a selector whose predicate is true for either host.

- [_] Constructing set operators (union, intersection, etc.) from XML
      needs support for rdf:Bag / rdf:List to be useful.  The parsing
      machinery notes this by raising NotImplementedError if a set operation
      node is present.


Notes on the Parser
-------------------

- The root node of a URISpace is not required to be any particular element,
  nor even in the URISpace namespace (see the first example in "Appendix C",
  for instance).  It should map to a TrueSelector, for regularity.

- Create selectors for nodes based on their QNames, using a dictionary.
  Create predicates for the selectors (where required) from the
  'urispace:match' attribute.

- Any node whose QName does not map to a selector type should be treated as
  an operator.  The default operator type is 'replace', with overrides
  coming from an attribute whose QName maps to an operator type.

- The QName of an operator element is used to look up a converter, which
  is then passed the entire element (including children), and must return
  a (key, value) pair.

- The default converter, used if no other is registered for the operator
  node's QName, return the QName as 'key', and the node's text as 'value'.

