[topicmapmail] Topic name display priority

Murray Altheim m.altheim@open.ac.uk
Tue, 01 Apr 2003 13:55:15 +0100


Steve Pepper wrote:
> At 11:51 01.04.2003 +0100, Murray Altheim wrote:
> 
>>> Yes. It has to be a two-step process: First select the most
>>> appropriate base name, and then check for variants.
>>
>>
>> ...
>>
>> In TM4J there's a method
>>
>>    org.tm4j.topicmap.TopicMapUtils.getDisplayName(Topic,Scope)
>>
>> which I will simply use rather than writing my own. Its description
>> is thus:
>>
>>    Returns a string which may be used as a display name in the
>>    specified scope. If a variant name with a parameter of
>>    'display' exists in the specified scope, then that variant's
>>    name string is returned. Otherwise a base name in the specified
>>    scope is sought and if found, then the base name string is
>>    returned. Finally a base name in the unconstrained scope is
>>    sought and that name string returned. If all of these searches
>>    fail, null is returned.
>
>  From the description it's unclear whether this method uses the
> two-step process or not. It would be interesting to know the answer.

I was a bit overenthusiastic -- this is an interface method, not
a class method, so I can't check how Kal did it. Since there isn't
yet an implementation of this available, I will in the end be
writing one. If we break down the instructions step-by-step, we get:

   1. If a variant name with a parameter of 'display' exists in the
      specified scope, then that variant's name string is returned.

[I assume 'display' means a topic having a subject identity with the
XTM 'display' PSI.]

   2. Otherwise a base name in the specified scope is sought and if
      found, then the base name string is returned.

   3. Finally a base name in the unconstrained scope is sought and
      that name string returned.

   4. If all of these searches fail, null is returned.

If we for example say that the "specified scope" is English,
then getDisplayName() puts the highest priority on the scope
(given that not until #3 do we find ourselves outside of it),
then on any base name. It sounds like the first pass through
the base names is to locate any within the specified scope,
and second, to then look for 'display' variants. That's in
any case how I'll be writing it.

In my case, #4 won't quite work since I want *some* display
name, so I'll be using the topic ID if everything else fails.

Murray

......................................................................
Murray Altheim                  <http://kmi.open.ac.uk/people/murray/>
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK

    Hunt the Boeing! And test your perceptions!
    http://www.asile.org/citoyens/numero13/pentagone/erreurs_en.htm