[topicmapmail] Could <instanceOf> in a <Topic> element be duplicate to used?

Murray Altheim m.altheim@open.ac.uk
Thu, 21 Aug 2003 04:19:20 +0100


?? wrote:
 > To whom it may concern:
 > Could <instanceOf> in a <Topic> element be duplicate to used? like code
 > below:
 > <topic id="???">
 >  <instanceOf>
 >    <topicRef xlink:href="#??" />
 >  </instanceOf>
 >  <instanceOf>
 >    <topicRef xlink:href="#???" />
 >  </instanceOf>
 >  <baseName>
 >    <baseNameString>???</baseNameString>
 >  </baseName>
 >  <baseName>
 >   <scope><topicRef xlink:href="#English Name" /></scope>
 >   <baseNameString>Vince Chen</baseNameString>
 >  </baseName>
 > </topic>
 >
 > I have studyied XTM specification for this, and it show a part of
 > code in XTM DTD like this :
 >
 > <! ELEMENT topic
 >  (instanceOf*, subjectIdentity?, (baseName | occurrence)*)
 >
 > Is it mean I can use many <instanceOf> elment in a <topic> elment?

Vince,

You're correct. In DTD notation

   a "?" means "once, optionally"
   a "+" means "one or more"
   a "*" means "zero or more"

So yes, the way to have a topic be an instance of more than one other
topic is to use multiple <instanceOf> elements as in your example.

I do note one error though: The 'xlink:href' value of "#English Name"
is incorrect, as the attribute value must be a URI, and URIs can't
have whitespace. And topic IDs (which I'm assuming "#English Name"
refers to) must be XML Names, which also can't have whitespace. Perhaps
you could use an underscore, as in

    <topic id="English_Name">

     ...

        xlink:href="#English_Name"

One other thing to be careful of, is that you probably should make
sure your XML declaration has the correct character encoding, since
you're putting Chinese characters into the topic map.

    <?xml version="1.0" encoding="XXX"?>

where "XXX" is the encoding you're using. I'm not sure what you have
but it *might* be Big5 (traditional Chinese). Your email says

    "Content-Type: text/plain; charset=big5"

so you would likely (if you're using the same encoding in your topic
maps as your emails) use this XML declaration:

    <?xml version="1.0" encoding="Big5"?>

There's an article on XML character encodings at O'Reilly which you
might find helpful

     Character Encodings in XML and Perl
     by Michel Rodriguez, April 26, 2000
     http://www.xml.com/pub/a/2000/04/26/encodings/index.html?page=1

You also can find a good list of encoding name values at:

   http://xml.apache.org/xerces-j/apiDocs/org/apache/xerces/readers/MIME2Java.html

Murray

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

    "There have been ongoing problems with cockroaches getting on the
     floor... they can wreak havoc with 350,000 dominoes." -- Brian Kim
     http://www.guardian.co.uk/silly/story/0,10821,1017133,00.html