[topicmapmail] topicmapmail Digest, Vol 47, Issue 1

Lars Heuer heuer at semagia.com
Mon Jan 4 03:56:31 EST 2010


Hi Bujii,

[...]
> My problem is if everything is a topic do i need to specify the type
> of it or not while creation of that topic.

A topic does not necessarily have a type.

Example (CTM):

    google isa company.

Here, the topic "company" has no type, while "company" is the type of
"google". So "google" is an instance of "company".

How to express this within an API is another question. You may want to
look at the Topic Maps API (TMAPI) [1]
In TMAPI you'd do the following (Locator creation omitted and replaced
by Strings):

   Topic google =
tm.createTopicByItemIdentifier("http://www.example.org/#google");
   Topic company =
tm.createTopicByItemIdentifier("http://www.example.org/#company");
   google.addType(company);


> generally when i create a topic i want to specify its type.(i feel its
> for uniqueness)

For uniqueness you use either subject identifiers or subject locators,
or item identifiers. You should prefer subject identifiers and subject
locators over item identifiers, though, see TMDM [2] for details.

>  so as per my understanding when a write api even when i create a
> association-type or association-role i need to create it as a topic
> first.

Again, a TMAPI example how to create an association:

    Topic memberOf =
tm.createTopicBySubjectIdentifier("http://psi.example.org/member-of");
    Topic member =
tm.createTopicBySubjectIdentifier("http://psi.example.org/member");
    Topic group =
tm.createTopicBySubjectIdentifier("http://psi.example.org/group");
    Topic john =
tm.createTopicBySubjectIdentifier("http://psi.example.org/john");
    Topic beatles =
tm.createTopicBySubjectIdentifier("http://psi.example.org/beatles");
    Association assoc = tm.createAssociation(memberOf);
    assoc.createRole(member, john);
    assoc.createRole(group, beatles);


The code above is equivalent to the following CTM fragment:

    %prefix ex http://psi.example.org/

    ex:member-of(ex:member: ex:john, ex:group: ex:beatles)

[1] <http://www.tmapi.org/2.0/>
[2] <http://www.isotopicmaps.org/sam/sam-model/>

Best regards,
Lars
-- 
Semagia
<http://www.semagia.com/>


More information about the topicmapmail mailing list