/**
 - $Id: TODO,v 1.10 2003/08/23 18:47:32 myui Exp $
 */


Add partial XQuery syntax support
==================================
[priority ***]

	-- select by specified document
		ex). document(*)/site/open_auctions
			 document(top.xml)/site/auctions

	-- user defined function support in predicate expression
		ex). /map/geo[near(point,'1.1.5')]

		I want to create gis extention like, g-xml. opengis(postgis).


Refactor marshalling funcion
============================
[priprity ***]

 Firstly, XPath is not obliged to return XML in the specification.
 XPath is a language for addressing parts of an XML document.
 http://www.w3.org/TR/xpath.html

 * Use cursor in the function internal for large result.
 * Replace function with stack base in composing xml, freed from
  lib2xml dependence.
  
 The reason why marshalling is slow in XpSQL is a dynamic updatable system.
 It is easy to extract (xml) document from entire document with 
 range offset or ddo, when system have static structure.
 
 Although it is not impossible to say sure, generally reorganizing 
 the whole document dynamically has high load.
 
 XpSQL is suitable for use of a Data-Centric XML and Data-Centic usage.
 My first purposes is that process the inquiry result against XML, 
 and obtain by relation.
 
 See this article which I sympathized.

	XML for Data: Native XML databases: a bad idea for data?(Developerworks)
	 http://www-106.ibm.com/developerworks/xml/library/x-xdnat.html [en]
	 http://www-6.ibm.com/jp/developerworks/xml/020201/j_x-xdnat.html [ja]
 
support Limitting result
========================
[priority *]

select count(*) from xpath_eval('//edge')
result
------
10000

select count(*) from xpath_evalmt('//edge',10)
result
------
10


Support Validation
==================
[priority **]

Before storing XML documents to set of relations with the bulkloader,
validate xml. support xml-scheme or relax-ng ?
 

Lighten node table
==================
[priority ***]

 Separate column "xmlnode.value" to another table
 to save disk-read time of node table, and bind by nodeid.

  ------------------------------------
	create table "xml_nodeval" (
		"id" INTEGER PRIMARY KEY,
		"value" VARCHAR
	);

	select
		xv.value
	from
		xml_node xn,
		xml_nodeval xv
	where
		xn.id = xv.id and
		...
  ------------------------------------

  From a viewpoint of the importance, next node will be
 removed in the future. In XPath, next column is never used.

  Node table must be lightweight, cos node table calls often.
 fitting in a buffer is expected.


Automate encoding between file-encoding and db-encoding
========================================================
[priority **]

Libxml2 DOM API needs UTF-8(that ascii compatible) input.
so, we have to consider encoding between db and input-xmlfile
at pgxload and marshalling function.

http://www.xmlsoft.org/encoding.html

example).

         ====== <BULKLOAD> ==========> 

--------                            ----------
| file |  <----->  LIBXML <------>  |   DB   |
--------                            ----------
 EUC-JP            UTF-8               EUC-JP

--------                            ----------
| file |  <----->  LIBXML <------>  |   DB   |
--------                            ----------
 SHIFT_JIS         UTF-8   convert    EUC-JP

	 <========== <MARSHALL> =====


yet planning...

### GET DB ENCODING ###

select getdatabaseencoding();
--
getdatabaseencoding
EUC_JP

COVER DIFERRENCE BITWEEN ICONV AND POSTGRES
--
int xmlAddEncodingAlias(const char *name, const char *alias);
xmlAddEncodingAlias("EUC_JP","EUC-JP")

$iconv -l | egrep -in "EUC.*JP"
--
398:EUC-JP
402:EUCJP

### GET {INPUT|OUT} FILE ENCODING ###

Use Libxml2 xmlSwitchEncoding function...?
--
<?xml version="1.0" encoding="EUC-JP"?>
                              ~~~~~~
         search encoding and set it (default value might be set to UTF-8)
         
  -> encoding infomation should be store in column "xml_document.header"

or read one line and detect encoding.

reading heading few bytes not sufficient.
consider.. 'aaa'


Support update function like XUpdate
====================================
[priority *]

 In the present, to execute DML by xpath result.

 update
 	xn.value = "postgres"
 from
 	xml_node xn,
 	xpath_eval('/oracle/boracle') res
 where
 	xn.id = res.id;

 insert into test(id)
 	select id from xpath_eval('/creative/commons/');

 delete from xml_node where id = (select id from xpath_eval('/anti/pattern'));


Refactoring DOM *like* functions
================================
[priority **]

 Suppoert DOM Level2 subset more strictly. 
 current error handling is poor.
 
 Replace DOM conformity functions according to DOM specification.


Support Remote Query
====================
[priority *]

 Adding SOAP or some remote massaging service (JMS, RM4GS?) support.
 provide service for xml quering.


Improve Namespace Handling
==========================
[priority **]

 need real support of namespace.
 current namespace declation is just like attribute and
 prefix is added to nodename prefix.


Relate XML Namespace with DB scheme.
===================================
[priority *]

 In edge oriented (IOW, node oriented) approach, node table tends to be too big.
 thereupon, namespace concept can be appried.
 now under consideration, yet.

 bind xml namespace and database namespace.
 
 as follows, just a scribble memo..
 
 | create schema "mycollection";
 | create initialize db with setting "set search_path=mycollection".
 |
 | // import a group of documents.
 | select into mycollection.xml_node * from xml_node where docid in (3,4,5);
 |
 | this might become some sort of collection at XMLDB. 
 | a solution against large node table.
 |
 | select * from xpath_eval('xcollection("mycollection")/aaa/bbb');
 | query the documents with setting search_path to mycolletion.


Alter dewey expression more efficiently
========================================
[priority *]

 The realization of ddo(dewey decimal order) with arrays is improved
 and a better means is invented.

 An efficient alternative way that already exists is use UTF-8 encoding
 for expression of ddo.

 On the other hand, I think current realization with intarray is not so bad.
 In case data-size is large, postgres intarray is compressed,
 and stored in another domain.

 Cost of storing, and cost of updating...umm...
 

Library
=======
[priority **]

 We need useful library for Java, PHP, Python, Ruby etc.


INSTALL
=======
[priority **]

use autoconf, automake for building the package.


Improve performance (-: and fix BUGS!! >-;
========================================
[priority ?]

 to appear...


ETC, floating..
===============

* support function for get node infomation like 
 exist_node_to_str function appears in eXist.