473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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
Mar 15 '06 #1
3 3430
"Marc" <sp**@maju.nl> wrote in message
news:44*********************@news.kabelfoon.nl...
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..


If you're trying to do a query to get all descendants of a given term, then
this is something hard to do with standard SQL with the schema you've
described. Oracle and some other RDBMS have some proprietary extensions for
doing recursive queries, but MySQL does not.

There are techniques for representing heirarchies in a queryable form, for
instance by recording all the paths in the tree. This requires at least one
more table to record these paths.

You would probably benefit from reading Joe Celko's book "Trees and
Heirarchies in SQL for Smarties".
http://www.amazon.com/gp/product/1558609202/

Regards,
Bill K.
Mar 15 '06 #2
Bill Karwin schreef:
"Marc" <sp**@maju.nl> wrote in message
news:44*********************@news.kabelfoon.nl...
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..

If you're trying to do a query to get all descendants of a given term, then
this is something hard to do with standard SQL with the schema you've
described. Oracle and some other RDBMS have some proprietary extensions for
doing recursive queries, but MySQL does not.

There are techniques for representing heirarchies in a queryable form, for
instance by recording all the paths in the tree. This requires at least one
more table to record these paths.

You would probably benefit from reading Joe Celko's book "Trees and
Heirarchies in SQL for Smarties".
http://www.amazon.com/gp/product/1558609202/

Regards,
Bill K.

Hi Bill,

I've ordered the book. Thank you for your quick response!

Regards,

Marc
Mar 16 '06 #3
On Wed, 15 Mar 2006 15:27:38 -0800, in mailing.database.mysql "Bill
Karwin" <bi**@karwin.com>
<dv*********@enews1.newsguy.com> wrote:
| "Marc" <sp**@maju.nl> wrote in message
| news:44*********************@news.kabelfoon.nl...
| > 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..
|
| If you're trying to do a query to get all descendants of a given term, then
| this is something hard to do with standard SQL with the schema you've
| described. Oracle and some other RDBMS have some proprietary extensions for
| doing recursive queries, but MySQL does not.
|
| There are techniques for representing heirarchies in a queryable form, for
| instance by recording all the paths in the tree. This requires at least one
| more table to record these paths.
|
| You would probably benefit from reading Joe Celko's book "Trees and
| Heirarchies in SQL for Smarties".
| http://www.amazon.com/gp/product/1558609202/


There are also these on-line articles:
http://dev.mysql.com/tech-resources/...ical-data.html
http://www.sitepoint.com/article/hie...-data-database
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Mar 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Melody Droid | last post by:
I recently made some conceptual breakthroughs regarding the interval permutation pre-sorting and the pitch-class-set/scale post-sorting aspects of my envisioned symmetrical melody thesaurus...
3
by: Jason | last post by:
Is it possible to connect and asp page to the Microsoft Office Thesaurus? I would like to be able to pass a word to it and get back all of the synonyms as either a string, array, or collection.
1
by: Hans Malherbe | last post by:
I would like to access the Word thesaurus from a .NET WinForm application if the client has Microsoft Word installed. Is it possible? I could not find anything in the Office XP help.
2
by: hammad | last post by:
I had made a .NET Application that use microsoft Word thesaurus using msword file when i made windows application it works well but when i try web application it make exception that i have no...
2
by: iyhammad | last post by:
Dear Friends, I’ve made windows application that use COM Component in Microsoft word(Word thesaurus) and it worked very well but when I made it web application it raise security permission...
0
by: Griff | last post by:
Hi I understand that the Resource file can handle different languages. However, what is the best way to handle a thesaurus? As a trivial example: A British user access the site and the...
3
by: moondaddy | last post by:
I'm looking for a thesaurus tool I can use in an application. I was hoping it could be a web service where my app could submit a work and get a list of results back which my code could use. any...
8
by: johnerics | last post by:
Hi Everybody! Hoping that every body would be fine at this group. I am learning c sharp. Please, if anybody can make this program, i would be highly obliged. Implement a thesaurus (a...
0
by: Calvin Spealman | last post by:
Sounds like you might want to read up on RDF On Tue, Aug 12, 2008 at 10:41 AM, Benjamin Michiels <benjamin.michiels@gmail.comwrote: -- Read my blog! I depend on your acceptance of my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.