How to set up query for Thesaurus

Hi everyone,

I'm trying to build a Thesaurus. In my thesaurus i've created the
following tables: terms, btnt (broader terms/narrower terms), rt
(related terms)

The structures of the tables are like this:

--------------------------------
| table: terms |
--------------------------------
| term_id | name |
--------------------------------
1 Europe
2 Holland
3 Amsterdam
4 England
5 London


-------------------------------------------
| table: btnt
-------------------------------------------
| btnt_id | bt | nt |
-------------------------------------------
1 Europe(1) Holland(2)
2 Holland(2) Amsterdam(3)
-------------------------------------------


-------------------------------------------
| table: rt
-------------------------------------------
| btnt_id | rt1 | rt2 |
-------------------------------------------
1 Holland(1) England(3)
2 Amsterdam(2) London(4)
-------------------------------------------

As you can see, with a thesaurus you can make an hierarchy relations
(btnt table) between terms as well as vertical relations (RT table).

I have a search query which will give me a term_id from the table terms.
With this term_id I have a query which will search and collect in the
table btnt for the nt with bt as term_id. But as you can see the nt is
also a bt. I want in the same query a loop so I can query it again with
the new query_results. This will be a contineous proces..

I hope you understand what i've written here, and I hope someone can
help me with this query...

Thanks in advance marc
marc [ Mi, 15 März 2006 22:11 ] [ ID #1230838 ]

Re: How to set up query for Thesaurus

Is the structure you've employed standard for this kind of thing?

There's a product called Tematres which apparently provides a thesaurus
type structure for php mysql. It's written in Spanish but appears to be
open source so you might be able to study it and adapt it to your
needs. See www.r020.com.ar/tematres/index.en.html#indice.

Sounds like an interesting project you've set yourself. Good luck!
zac.carey [ Fr, 17 März 2006 19:11 ] [ ID #1234336 ]

Re: How to set up query for Thesaurus

strawberry schreef:
> Is the structure you've employed standard for this kind of thing?
>
> There's a product called Tematres which apparently provides a thesaurus
> type structure for php mysql. It's written in Spanish but appears to be
> open source so you might be able to study it and adapt it to your
> needs. See www.r020.com.ar/tematres/index.en.html#indice.
>
> Sounds like an interesting project you've set yourself. Good luck!
>

Hi, the thesaurus structure is standard.

I've studied the software from tematres and it does the same as software
what I've created.

I link the thesaurus terms to a foto table so when I'm searching for a
record with the term Holland. I want in my search results also the foto
records with the narrower term of Holland -> Amsterdam.

And as well in my software as in the software from tematres, it is not
possible to do that in one query...

So i'm looking for a way to create a contineous loop in the query..

By the way, I really like the Tematres software, so I'm writing a dutch
language support..
marc [ Sa, 18 März 2006 14:09 ] [ ID #1235412 ]
PHP » alt.php.sql » How to set up query for Thesaurus

Vorheriges Thema: transaction error invalid field state
Nächstes Thema: please Help me out with this