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 | - |
CTX_THES.DROP_RELATION('TEST_THES','CARD','BT','COMPUTER');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.
ORA-20000: Oracle Text error: DRG-11704: phrase CARD does not exist
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.
No comments:
Post a Comment