Menu

Define an 'InstanceOf' and get 3 new topics!!

tm4j-users
2002-08-23
2002-08-23
  • Ioannis Tsampoulatidis

    I think that the following cannot be considered as bug, but I will appreciate it, if someone could explain "why, when you define an InstanceOf" three topics with subjectIndicatorRef xlink:href "points" to the "http://www.topicmaps.org/xtm/1.0/index.html#psi-at-class-xxx" are being created ?

    To be more specific, here is a simple code:

    public static void main(String[] args) {
        TopicMapFactoryImpl tmfi = null;
        TopicMap tm = null;
        tmfi = new TopicMapFactoryImpl();
        tm = tmfi.createTopicMap();
        try {
          Topic t = tmfi.createTopic("myTopic01");
          Topic t2 = tmfi.createTopic("myTopicID2");
          //create instanceOf
          t2.addType(t);
        }
    }

    Check this out, it you'll understand what I mean.

    Thanks in advance
    Ioannis

     
    • Kal Ahmed

      Kal Ahmed - 2002-08-23

      Hi Ioannis,

      The three new topics are created to type an association between the topic which defines the type (the class) and the topic which is typed (the instance). This is the XTM-defined way of asserting the class-instance relationship (the <instanceOf> tag is actually just a short-cut for creating the association).

      In TM4J, all type relationships between topics result in the automatic creation of an association as well. This means that if you were to do t2.getRolesPlayed() or t1.getRolesPlayed() at the end of your example code, you should find that the resulting collection is not empty.

      Kal

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.