[topicmapmail] Generating TMs out of relational Databases / How To?

Alexander Johannesen Alexander Johannesen <alexander.johannesen@gmail.com>
Tue, 31 May 2005 10:44:09 +1000


Hi there,

On 5/30/05, Andreas Fleck <AndreasFleck@gmx.net> wrote:
> but how do I handle the columns? I=B4ve read a paper from ontopia,
> which says that columns should be mapped as occurances.

Well, it is "Yet Another Way Of Doing It" (TM). Within Topic Maps
there is no one set way of doing these kinda things.

> But i got a problem in figuring out how to do this exactely. I mean If i
> would have a column entitled "name" in a table called "address", it isn=
=B4t
> what i would map as an occurance within a topic map, as "name", to me is =
a
> seperate topic to me, not an occurance (which is mostly a website or pict=
ure
> in the papers i=B4ve read through).

Again, it depends. :) I'm sorry the answer to these things isn't "do
X". The very first thing you need to sort out is your ontology,
meaning "what are the things you want to talk about". Here's perhaps
an example of such (basic types), so create a topic for each "type" ;

* Person, * Tool, * Project

and perhaps some occurrence types ;

* Address, * Phone, etc

Next up is defining the relationships in your map. You've got these in
one of your tables, so for each of them, create a topic from them;

* works-on, * belongs-to, * does-X, * performs-Y, * handles-Z ... and so on

Now you can simply do;

SELECT * FROM Person

And with this result, do for every row depending on what each column is ;

Topic "{$name}"=20
   instanceOf #person
   occurrence type #address "{$address}"
   occurrence type #phone "{$phone}"

and so on. The same for each other table.

> > Here's my normal process ; map everything that matches a given
> > ontology to an intermediate XML, then use XML tools to normalise,
> > group and sort it into an XTM file, and then import this XTM file into
> > your TM engine of choice.
>=20
> Oh, sorry to ask. But what do you exactly mean by mapping it to an
> "intermediate XML"? What is this?

Well, when you export all your tables into a topic map or anything,
depending on what sort of topics you want to create when the topics
aren't something you've typed in your ontology, then you need a way to
create new types. I do this through an intermediate XML, a temporary
XML file, basically. Say you have two different columns in your DB
that represents something you want to create types from; you export
out topic types from both, but perhaps there are overlaps? Then you
need a way to sort out and group these topics, a kind of a normalised
merge.

> What can i understand exactly about the process of "normalising", "groupi=
ng"
> and "sorting" it into an XTM file?

It depends on your process for creating the Topic Map. If you're using
Java and JDBC and TM4J, I guess you can normalise (meaning; filter
your data, get rid of crap, keep the good stuff) your DB objects
directly. I personally use a lot of XML tools for this, so I create
some XML files that represent raw data, the do grouping and sorting on
them to create XTM files which I then import into whatever.

...

> i=B4ve posted a more specific describtion of my problem and scenario as a=
n
> anxwer to Murray=B4s kind post and i=B4m pretty glad, having found a list=
 like
> this, since none of the guys here at my place has a clue of topic maps ;-=
)

Hehe, clues about Topic Maps are far and wide apart, no matter where
you look. :)


Alexander
--=20
"Ultimately, all things are known because you want to believe you know."
                                                         - Frank Herbert
__ http://shelter.nu/ __________________________________________________