Towards a second generation Topic Maps engine
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Towards a second generation Topic Maps engine

  • 1,840 views
Uploaded on

The core of the second generation Topic Maps standards (TMDM, XTM2.0) has been finalized, yet the uptake is still slow. In this paper, we highlight engineering considerations for a novel backend for ...

The core of the second generation Topic Maps standards (TMDM, XTM2.0) has been finalized, yet the uptake is still slow. In this paper, we highlight engineering considerations for a novel backend for the TM4J open source topic maps engine, which is currently in development, but already usable for some purposes. As the name suggests, the “TMDM” backend is designed to reflect the TMDM specification closely. In fact, it is much closer to the TMDM than to the internal legacy TM4J data model (which is based on the XTM 1.0 data model). This motivates a bridging layer between the TMDM and the XTM 1.0 data model. We emphasize how merging is implemented in the “TMDM” backend and conclude with some synthetic merging benchmarks of the current “TMDM” backend prototype.

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,840
On Slideshare
1,839
From Embeds
1
Number of Embeds
1

Actions

Shares
Downloads
16
Comments
0
Likes
0

Embeds 1

http://www.slideshare.net 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Towards a second generation Topic Maps Engine Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 1 of 27
  • 2. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Overview technical talk API design multiple layers event handling merging done slowly or fastly Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 2 of 27
  • 3. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Objectives need a Java TM engine with TMDM support semantically syntactically (names of methods match TMDM) with instant merging with dynamic (reversable) merging with support for modern Java 1.5 features (generics, etc.) which can act as backend for TM4J1 applications with persistence support Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 3 of 27
  • 4. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Idea develop a new backend for TM4J Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 4 of 27
  • 5. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 „TMDM“ backend is layered is (currently) RAM-only can do topic merging fast Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 5 of 27
  • 6. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Layers what? layer ≈ coverage of all TMDM item types under a particular concern why? separation of concerns: do one thing, and do it well modularity of architecture: replace a layer implementation by another layer implementation Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 6 of 27
  • 7. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Layers how? layer ≈ set of classes and interfaces in one Java package communication between layers by method calls event listeners (later) Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 7 of 27
  • 8. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Layers which? one layer for accessing a topic map one layer for just reading a topic map one layer for storing a topic map one layer for merging a topic map one layer for compatibility with TM4J1 Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 8 of 27
  • 9. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TMDM read-write interfaces layer Concern: accessing a topic map set of interfaces in package org.tm4j.topicmap.tmdm: TopicMap extends Reifiable Topic extends TopicMapConstruct TopicName extends Scopeable Variant extends Scopeable Occurrence extends Scopeable Association extends Scopeable AssociationRole extends Reifiable Scopeable extends Reifiable Scope Reifiable extends TopicMapConstruct TopicMapConstruct Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 9 of 27
  • 10. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Example: AssociationRole public interface AssociationRole extends Reifiable, ReadableAssociationRole { public ReadableTopic getType(); public ReadableTopic getPlayer(); public Association getParent(); public void setType(Topic type); public void setPlayer(Topic player); } note: no setter for parent. Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 10 of 27
  • 11. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TMDM read-only interfaces layer Concern: just reading a topic map set of interfaces in package org.tm4j.topicmap.tmdm: ReadableTopicMap ReadableTopic ReadableTopicName ReadableVariant ReadableOccurrence ReadableAssociation ReadableAssociationRole ReadableScopeable ReadableScope ReadableReifiable ReadableTopicMapConstruct Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 11 of 27
  • 12. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Example: ReadableOccurence public interface ReadableOccurrence extends ReadableScopeable { public ReadableTopic getType(); public Locator getDatatype(); public String getValue(); public ReadableTopic getParent(); } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 12 of 27
  • 13. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TMDM Basic implementation layer Concern: storing a topic map set of classes in package org.tm4j.topicmap.tmdm.basic: BasicTopicMap BasicTopic BasicTopicName BasicVariant BasicOccurrence BasicAssociation BasicAssociationRole BasicScopeable BasicScope BasicReifiable BasicTopicMapConstruct Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 13 of 27
  • 14. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Example: BasicAssociation public class BasicAssociation extends BasicScopeable implements Association { BasicTopicMap parent; BasicTopic type; Set<BasicAssociationRole> toles; protected BasicAssociation(BasicTopicMap parent, BasicTopic type,BasicScope scope) public BasicTopicMap getParent() public void setType(Topic type) public void setType(BasicTopic type) public BasicTopic getType() public BasicAssociationRole createRole(Topic type,Topic player) public BasicAssociationRole createRole(BasicTopic type, BasicTopic player) public Set<BasicAssociationRole> getRoles() } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 14 of 27
  • 15. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TMDM Merged implementation layer Concern: merging a topic map set of classes in package org.tm4j.topicmap.tmdm.merged: MergedTopicMap MergedTopic MergedTopicName MergedVariant MergedOccurrence MergedAssociation MergedAssociationRole MergedScopeable MergedScope MergedReifiable MergedTopicMapConstruct MergedTopicMapView Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 15 of 27
  • 16. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 MergedTopicMapConstruct public abstract class MergedTopicMapConstruct<I extends ReadableTopicMapConstruct> extends TMDMObject implements ReadableTopicMapConstruct { protected List<I> components; protected MergedTopicMapView container; protected MergedTopicMapConstruct(MergedTopicMapView container) protected MergedTopicMapConstruct(MergedTopicMapView container,I firstComponent) protected MergedTopicMapView getContainer() public boolean containsComponent(I component) protected void addComponent(I component) protected void removeComponent(I component) public Collection<I> getComponents() public I getRandomComponent() public Set<Locator> getItemIdentifiers() protected Collection<Set<Locator>> getItemIdentifiersSetCollection() public Set<Locator> getItemIdentifiersSet() public Collection<Locator> getItemIdentifiersCollection() protected boolean containsItemIdentifier(Locator itemIdentifier) } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 16 of 27
  • 17. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Example: MergedAssociationRole public class MergedAssociationRole extends MergedReifiable<ReadableAssociationRole,MergedAssociationRoleKey> implements ReadableAssociationRole { protected MergedAssociationRole(MergedTopicMapView container, MergedAssociationRoleKey key, ReadableAssociationRole firstComponent) { super(container,key,firstComponent); } public MergedTopic getType() { return getContainer().getMergedTopic(getRandomComponent().getType()); } public MergedTopic getPlayer() { return getContainer().getMergedTopic(getRandomComponent().getPlayer()); } public MergedAssociation getParent() { return getContainer().getMergedAssociation(getRandomComponent().getParent()); } } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 17 of 27
  • 18. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TM4J1 compatibility layer Concern: exposing a TMDM layer topic map using the TM4J1 API set of classes in package org.tm4j.topicmap.tmdm.tm4j1: TopicMapImpl TopicImpl BaseNameImpl VariantImpl OccurrenceImpl AssociationImpl MemberImpl ScopedObjectImpl TopicMapObjectImpl Wrap around TMDM to provide TM4J1 (=XTM1) semantics Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 18 of 27
  • 19. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TopicMapObjectImpl public abstract class TopicMapObjectImpl< I extends org.tm4j.topicmap.tmdm.TopicMapConstruct, V extends org.tm4j.topicmap.tmdm.ReadableTopicMapConstruct> implements org.tm4j.topicmap.TopicMapObject { protected I representedObject; protected TopicMapImpl container; } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 19 of 27
  • 20. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Event Handling Basic idea: make event firing just a method call Thus: all event parameters are method call parameters default implementation: empty method Rationale keep it small and simple (let the JVM) optimize away unnecessary method calls Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 20 of 27
  • 21. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 TopicMapEventListener public interface TopicMapEventListener<TM extends ReadableTopicMap, T extends ReadableTopic, A extends ReadableAssociation, O extends ReadableOccurrence, TMC extends ReadableTopicMapConstruct, TN extends ReadableTopicName, V extends ReadableVariant, AR extends ReadableAssociationRole> { public void notifyTopicCreated(TM topicMap,T topic); public void notifyTopicRemoved(TM topicMap,T topic); public void notifySubjectIdentifierAdded (TM topicMap,T topic,Locator sid); public void notifySubjectIdentifierRemoved(TM topicMap,T topic,Locator sid); public void notifySubjectLocatorAdded (TM topicMap,T topic,Locator sid); public void notifySubjectLocatorRemoved (TM topicMap,T topic,Locator sid); public void notifyItemIdentifierAdded (TM topicMap,TMC topicMapConstruct, Locator itemIdentifier) throws DuplicateItemIdentifierException; public void notifyItemIdentifierRemoved (TM topicMap,TMC topicMapConstruct, Locator itemIdentifier); } Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 21 of 27
  • 22. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Peculiarities Scope is a first-class class replace the set of all themes by a pointer # of distinct scopes is small, thus # of distinct Scope objects is small Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 22 of 27
  • 23. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Bigger picture TM4J1 compatibility layer container container TopicImpl TopicImpl TopicMapImpl representedObject representedObject parent parent BasicTopic BasicTopic BasicTopicMap Basic layer components components Merged layer MergedTopic MergedTopicMap container container topicToMergedTopic mergedTopicMap MergedTopicMapView eventListener TopicMapEventListener Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 23 of 27
  • 24. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Merging „A merge B = C“ is slow O(n²) „A merge B = B“ is fast O(n·log(n)) if A is smaller than B Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 24 of 27
  • 25. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Merging Benchmark processing time 900 825,49 800 processing time in seconds 700 “memory” backend 600 “TMDM” backend (no merging optimization) “TMDM” backend (with merging optimization) 500 458,97 400 300 200 100 21,51 0 0 40000 80000 120000 # TopicMapConstructs Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 25 of 27
  • 26. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 What to do? instantaneous unmerging computationally expensive Should we support it? What to do if not? implement some methods autogenerate engine (Domain Specific Languages) late merging vs. early merging Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 26 of 27
  • 27. TMRA 2008: Towards a second generation Topic Maps engine 2008-10-17 Thank you Questions? Xuân Baldauf <xuan--tm4j2--2008--tmra.de@baldauf.org>, Robert Amor <trebor@cs.auckland.ac.nz> 27 of 27