473,809 Members | 2,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3465
"Marc" <sp**@maju.nl > wrote in message
news:44******** *************@n ews.kabelfoon.n l...
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******** *************@n ews.kabelfoon.n l...
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.databas e.mysql "Bill
Karwin" <bi**@karwin.co m>
<dv*********@en ews1.newsguy.co m> wrote:
| "Marc" <sp**@maju.nl > wrote in message
| news:44******** *************@n ews.kabelfoon.n l...
| > 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******@yourpa ntsyahoo.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
1475
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 software, so that it will take the absolute minimum of time and effort to write a computer program for it and bring it up to the demo level in order to shop the project around. I've created a Yahoo Group for the project over here: ...
3
1590
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
1966
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
1884
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 suffcient previllage to access the COM Component any help!!!!
2
1931
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 when I tried instantiate an object from any class in the COM component. Please if you have any recommendations tell me.
0
910
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 server uses the *.en-gb.resx file to find a string for a label. This string is "Click here to see your basket". However, some users prefer the word "cart" to "basket" and others prefer
3
1523
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 good ideas? -- moondaddy@noemail.noemail
8
7858
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 dictionary of synonyms) that implements the IThesaurus interface Interface IThesaurus
0
1299
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 opinion! I am interesting! http://techblog.ironfroggy.com/
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10639
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7661
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.