Hi
I'm currently implementing the XML:DB API as a layer on top of JDBC. The
XML files are stored as blobs. Indexing is done by evaluating several
predefined XPath statements where the results get written in to
additional columns on the table. Currently I don't have an
XPathQueryService but created an SQLSelectQueryService which accepts
queries in the form of the WHERE-part of an SQL query.
An example:
sqlservice.query("orderid >= 123 AND orderid <= 146");
as an equivalent of:
xpathservice.query("//order[id >= 123 and id <= 146]");
My experiences:
1. It would be nice to have some kind of abstract string-based query
service so it is easier to switch query languages. I don't have XPath
right now so I'm starting with SQL. But later I'd like to switch query
languages. My proposal is pretty simple:
public interface QueryService extends Service {
ResourceIterator query(String query) throws XMLDBException;
}
public interface XPathQueryService extends QueryService {
}
public interface SQLSelectQueryService extends QueryService {
}
Having this I could write:
String srvtype = "SQLSelectQueryService";
String myquery = "country = 'fr'";
QueryService service = (QueryService) coll.getService(srvtype, "1.0");
ResourceIterator results = service.query(myquery);
2. It's not so easy to understand why Collection.getResources() returns
a String[] of IDs and XPathQueryService.query() returns a
ResourceIterator. In both cases it might be good to have both
possibilities, first to iterate through the resources and second to get
a list of resource IDs. My priority lies on the ResourceIterator.
3. Just an idea: What about a convenience method on QueryService to
delete resources without having to fetch them in the first place?
public interface QueryService extends Service {
ResourceIterator query(String query) throws XMLDBException;
void delete(String query) throws XMLDBException;
}
4. Wouldn't it be nice to have a set of conformance tests for XML:DB so
we can improve exchangability between drivers and faciliate and speed up
the development of drivers? For the Java world this could consist of a
package of JUnit tests, for example.
The XML:DB API, so far, is exactly what I need. So I guess the project
is on the right track.
I'm looking forward to your comments.
Jeremias M�rki
mailto:[EMAIL PROTECTED]
OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch
----------------------------------------------------------------------
Post a message: mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]
Contact adminstrator: mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------