[tmql-wg] Hello and proposal

Stefan Lischke lischke@ivs.tu-berlin.de
Tue, 23 Mar 2004 17:59:21 +0100

Hello TMQL Community,

My Name is Stefan Lischke, i'm interested in TopicMaps, artificial 
intelligence and XML stuff.
I'm involved in the OpenSource projects:
XTM4XMLDB(TMAPI impl with native XML:DB backend)
tinyTIM(small in memory TMAPI impl)
TMAPI(Topic Map Api)

I just want to say hello to this Community, cause i'm also interested in 
a TopicMap Query Language.

I want to tell you about my experience with sorts of query languages i used:

Writing xtm4xmldb gave me the opportunity to use XPath as a Query 
languages on the TopicMaps, cause i used a native XML:DB (OpenSource 
project eXist) as backend. [for faster access i split up topicmaps into 
small XTM pieces, so once a TopicMap is imported there are all Topics 
and all Associations in small XML snippets].
Using XPath on this TopicMap is now very fast.
I don't know if you are involved with the TMAPI IndexAPI, thats an API 
to have fast access for example to all Occurrences of a Type, or fast 
access to BaseNames by BaseNameString.
I implemented these Indexes with XPath and with eXist retrieval is 
really fast also when there are Millions of Topics.

Since this year eXist also offers XQuery to Query the DB with more 
inbuilt logic. with xtm4xmldb i'm now able to use XQuery to retrieve 
TopicMap Fragments.

I have played a little bit with that and also used XSLT's alot ontop of XTM.

My experience shows me, that working with XPath ontop of XTM is pain in 
the a**, cause you only have the TopicID as reference. so if you want to 
have a Topic of a special Type, you have to know the XML TopicID of this 


thats not very topicmapish,. We should specify the Typing Topic for 
example by its subject locator not with its id, which varies for example 
in the OKS. with XPath it would look like:

/topic[substring-after(instanceOf/topicRef/@xlink:href,'#') = 

Is everybody convinced now, that pure XPath should not be used to Query 

I propose the following:

We should create shortcuts that can be expanded to those above.
If we have shortcuts, we could use them in XQuery too, but we also have 
to create shortcuts for XQuery for example for creating Topics.

Here is an Example thats pure XQuery from

for $city in /mondial//city[name&='tre*']

I just make a pseudo TopicMap Example from it using some XPath shortcuts 
which i proposed above:

for $topic1 in $topicmap.topic.type='typeURI'
    for $topic2 in $topicmap.topic.subjectLocator='somethingURI'
          <topicRef @xlink:href="#someAssoc"/>
          <topicRef  xlink:href=$topic1.id/>
          <topicRef  xlink:href=$topic2.id/>

Now we have to create XQuery shortcuts to create the Association:

for $topic1 in $topicmap.topic.type='typeURI'
    for $topic2 in $topicmap.topic.subjectLocator='somethingURI'
    association($topicmap.topic.subjectLocator='someAssocURI',  $topic1, 

With that we could have a TMQL ontop of XPath and XQuery. We could use 
sinful function from XPath and XQuery like substring, count and so on 
and we don't have to write a TMQL engine by ourself, we just have to 
expand the "shortcuts" and use XPath and XQuery impl.

Hope that helps,

I apologies if something like this has gone through the Mailinglist before.

yours Stefan