Showing posts with label Thesaurus. Show all posts
Showing posts with label Thesaurus. Show all posts

Thursday, April 19, 2007

DRG-11729/DRG-11728: phrase does not have any narrower/broader terms of this type

One more note regarding CTX_THES.DROP_RELATION

CTX_THES.DROP_RELATION('TEST_THES', 'COMPUTER', 'NT');

When you omit parameter relphrase (the 4th) and there are no associated narrower or broader terms associated with parameter phrase (the 2nd), the procedure will return either of the following two error messages:

ORA-20000: Oracle Text error:
DRG-11729: phrase does not have any narrower terms of this type
DRG-11728: phrase does not have any broader terms of this type

depending on the value of rel (the 3rd, NT in the example above).
Again, if you get either of these two errors it means that phrase is in the thesaurus, otherwise you would get DRG-11704.

Click on the Oracle Text label below to see all postings regarding this class of errors.

DRG-11730: relation does not exist

Just a quick note today about the following error:

ORA-20000: Oracle Text error: DRG-11730: relation does not exist

As explained in my previous posting, the lack of the qualifier associated to either phrase in the relation may cause the error above.

Yet it's interesting to note that if you receive this error, it means implicitly that the term(s) specified in the CTX_THES.DROP_RELATION call are actually existing, what is not existing is the relation between them because if either of the term(s) wouldn't exist in the specified thesaurus, you'd get DRG-11704.

The reason why i wrote term(s), with an optional plural is due to the fact that you can omit the related phrase in CTX_THES.DROP_RELATION, which means that you can drop all narrower or broader terms related to the primary phrase with a single call.

Wednesday, April 18, 2007

DRG-11704: phrase CARD does not exist

Today i finally found time for some outstanding issues i had with one application i developed on top of Oracle Text, in particular i wanted to understand well how phrase qualifiers were used in text queries.

If i look up the term qualifier in the Oracle 10G ultrasearch engine, there are just 5 hits under the category Oracle Text.

This qualifier thing appears in the definition of the hierarchical operators like BT and NT, where it says that you can append this qualifier to the term inside round parentheses as follows:

BT(CARD(PC), 2, TEST_THES)
It appears also in the view definition of CTX_THES_PHRASES.

But how do i enter a term with a qualifier?

In the Oracle Text reference, in the chapter dedicated to package CTX_THES, section CREATE_RELATION, there is another reference to such qualifier (why didn't show up earlier in the search?), where it says that such qualifier is required if you have two homographs.

Translated into english :-), it means that if you have a word with two distinct meanings, depending on the context, you had better to specify which one you are interested in by means of this qualifier.

For instance, say we have this CARD phrase.
We want to create a BT relation with COMPUTER and STATIONERY.
Clearly computer cards have little to do with paper cards, but let's see what happens if i create these two relations without qualifiers.

CREATE_RELATION('TEST_THES','CARD','BT','COMPUTER');
CREATE_RELATION('TEST_THES','CARD','BT','STATIONERY');

Now, supposing you run a CONTAINS query looking for broader terms of the word CARD, but meaning a COMPUTER card, you would get also the STATIONERY broader term.
This can be less than desirable if you are using the returned broader terms for selecting their narrower terms, because you start looking for computer cards and you end up with paper cards.

Here is where such qualifiers come into play. By specifying the qualifier in the BT query, you can prevent the wrong match to happen.

It's worth noting however that the manual doesn't provide us with any additional information or example as to how such qualifier can be entered.
Fortunately it didn't take me more than 10 seconds to figure out the correct syntax, basing on the previous information regarding BT and NT.

Let's start from scratch.
CTX_THES.DROP_PHRASE('TEST_THES','CARD');

This will drop automatically all existing relations as well as the word CARD.

Then let's create the new qualified relation:

CREATE_RELATION('TEST_THES','CARD(PC)','BT','COMPUTER');

I picked the word PC as qualifier, but there is no constraint on it, you can pick XYZ if you like, it's up to you to specify such qualifier in a meaningful way. Actually i think that one should consider very carefully the choosing of this qualifier, but this is an entirely different subject.

Now, if you look at CTX_THES_PHRASES, you will see that there is
one record matching the word card:

select * from CTX_THES_PHRASES
where thp_phrase = 'CARD';

THP_THESAURUS THP_PHRASE THP_QUALIFIER THP_SCOPE_NOTE
TEST_THES
CARD PC
-




Suppose that you want to drop the newly created qualified relation and by mistake you execute:

CTX_THES.DROP_RELATION('TEST_THES','CARD','BT','COMPUTER');

ORA-20000: Oracle Text error: DRG-11704: phrase CARD does not exist
You can get confused by the fact that looking at the view CTX_THES_PHRASES the word CARD actually exists, but there is also the PC qualifier in the next column.

In order to drop it, you'll have to specify the qualifier as follows:
CTX_THES.DROP_RELATION('TEST_THES','CARD(PC)','BT','COMPUTER');
The bottom line is that there is no way of dropping a qualified phrase unless you specify its qualifier and even if it shows up in the view CTX_THES_PHRASES as a simple phrase, you won't be able to drop it unless you manually append the qualifier embedded in round parentheses.

And this ends the quirk of the day.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles