|
From: Lars H. <he...@se...> - 2008-06-11 15:07:08
|
Hi Darina,
> Thanks for your idea - it seems good; what do you mean by item
> identifiers/source locators - subjectIdentifier? subjectLocator?
I meant "source locators" which have been renamed into "item
identifiers" in the TMDM.
The "TopicMapObject" base class has the methods
"addSourceLocator(Locator)", "removeSourceLocator(Locator)" and
"getSourceLocators()".
I assume that your code (with topic name merging enabled) looks like
this:
Fragment A:
Topic topicA = tm.createTopic();
TopicName nameA = topic.createTopicName("Foo", null);
// Here some occurrences, assocs etc.
Fragment B:
Topic topicB = tm.createTopic();
TopicName nameB = topic.createTopicName("Foo", null);
Result: The topics "topicA" and "topicB" are merged since they have
the same name "Foo".
The equivalent code using my solution would look like this (topic name
merging NOT enabled!):
Fragment A:
Topic topicA = tm.createTopic();
Locator iidA = tm.createLocator("http://www.example.org/#" +
"Foo");
topicA.addSourceLocator(iidA);
TopicName nameA = topic.createTopicName("Foo", null);
// Here some occurrences, assocs etc.
Fragment B:
Topic topicB = tm.createTopic();
Locator iidB = tm.createLocator("http://www.example.org/#" +
"Foo");
topicB.addSourceLocator(iidB);
Result: The topics "topicA" and "topicB" are merged because they have
the same source locator (<http://www.example.org/#Foo>).
Maybe you have to catch the "TopicMustMergeException" if you add the
source locator to the topics, that depends on your "automerge"
setting. If "automerge" is not enabled, you can catch that exception
and merge the topics manually via Topic#mergeIn(Topic).
> In other orders, how the merge algorithm works in case merge by
> topicName is false?
Merging is done, if two topic have:
* at least one equal locator in their [subject identifiers] properties,
* at least one equal locator in their [source locators] properties,
* at least one equal locator in their [subject locators] properties,
See also: <http://www.isotopicmaps.org/sam/sam-model/#d0e739>
(In TM4J, the [subject locators] property does not exists, since it
can handle max. one subject locator (XTM 1.0 legacy)).
Best regards,
Lars
--
Semagia
<http://www.semagia.com>
|