Module: RTM::Majortom::Sugar::TopicMap

Defined in:
lib/rtm/majortom/sugar/topic_map.rb

Instance Method Summary collapse

Instance Method Details

#all_revisionsObject

Returns all revisions in the revision_index starting with the last one



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 14

def all_revisions
  all_revisions = []
  revision = self.revision_index.last_revision
  if revision
    all_revisions << revision
    while revision = revision.past
      all_revisions << revision
    end
  end
  return all_revisions
end

#disable_revision_managementObject



70
71
72
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 70

def disable_revision_management
  self.store.enable_revision_management(false)
end

#enable_revision_managementObject



66
67
68
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 66

def enable_revision_management
  self.store.enable_revision_management(true)
end

#latest_revision_idObject



7
8
9
10
11
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 7

def latest_revision_id
  raise("not supported") if self.read_only?
  return 0 unless last_revision = revision_index.last_revision
  last_revision.getId
end

#register_tmql_environment_map(topic_map) ⇒ Object Also known as: registerTMQLEnvironmentMap



47
48
49
50
51
52
53
54
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 47

def register_tmql_environment_map(topic_map)
  raise("topic_map must be a topic map") unless topic_map.is_a?(RTM::TopicMap)
  if self.store.is_read_only
    self.store.registerTMQLEnvironmentMap(topic_map)
  else
    raise("Method only working on read-only topic maps.")
  end
end

#revision_indexObject

Calls and loads the RevisionIndex managed by MaJorToM.



27
28
29
30
31
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 27

def revision_index
  index = getIndex(Java::DeTopicmapslabMajortomModelIndex::IRevisionIndex.java_class)
  index.open unless index.is_open
  return index
end

#supertype_subtype_indexObject

Calls and loads the SupertypeSubtypeIndex managed by MaJorToM.



34
35
36
37
38
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 34

def supertype_subtype_index
  index = getIndex(Java::DeTopicmapslabMajortomModelIndex::ISupertypeSubtypeIndex.java_class)
  index.open unless index.is_open
  return index
end

#tmql_environment_mapObject Also known as: getTMQLEnvironmentMap



57
58
59
60
61
62
63
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 57

def tmql_environment_map
  if self.store.is_read_only
    self.store.getTMQLEnvironmentMap
  else
    raise("Method only working on read-only topic maps.")
  end
end

#transitive_type_instance_indexObject

Calls and loads the TransitiveTypeInstanceIndex managed by MaJorToM.



41
42
43
44
45
# File 'lib/rtm/majortom/sugar/topic_map.rb', line 41

def transitive_type_instance_index
  index = getIndex(Java::DeTopicmapslabMajortomModelIndex::ITransitiveTypeInstanceIndex.java_class)
  index.open unless index.is_open
  return index
end