Module: Java::OrgTmapiCore::Construct

Extends:
Superiseable
Includes:
RTM::Construct
Defined in:
rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb,
rtm-javatmapi/lib/rtm/javatmapi/aliases.rb

Overview

Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. License: Apache License, Version 2.0

Instance Method Summary

Methods included from Superiseable

method_added, register_java_implementation, superised, superising

Instance Method Details

- (Object) add_item_identifier(identifier) Also known as: item_identifiers=, add_ii

Adds an item identifier to this construct. Identifier may be a String or Locator.

:call-seq:

  item_identifiers=(identifier)


50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 50

def add_item_identifier(identifier)
  # TODO Spec
  begin
    if identifier.is_a? Java::OrgTmapiCore::Locator
      addItemIdentifier(identifier)
    else
      addItemIdentifier(topic_map.create_locator(identifier))
    end
  rescue Java::OrgTmapiCore::IdentityConstraintException => ice
    # TODO add condition to switch off automerge
    self.mergeIn(self.topic_map.get(identifier))
  end
end

- (Object) id

Returns the identifier of this construct. This property has no representation in the Topic Maps - Data Model. The ID can be anything, so long as no other Construct in the same topic map has the same ID.

:call_spec:

  id -> String


88
89
90
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 88

def id
  getId
end

- (Object) item_identifiers Also known as: ii

Returns the item identifiers assigned to the current construct.

:call-seq:

  item_identifiers -> Set of Locators


39
40
41
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 39

def item_identifiers
  getItemIdentifiers
end

- (Object) parent Also known as: p

Returns the parent construct this construct belongs to.

:call-seq:

  parent -> a construct (TopicMap, Topic, Association or Name)


23
24
25
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 23

def parent
  getParent
end

- (Object) remove_item_identifier(identifier) Also known as: remove_ii

Removes an item identifer from this construct, if present.

Identifier may be a String or Locator.

:call-seq:

  remove_item_identifier(identifier)


75
76
77
78
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 75

def remove_item_identifier(identifier)
  identifier = topic_map.create_locator(identifier) if identifier.is_a? String 
  removeItemIdentifier(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
end

- (Object) topic_map

Returns the TopicMap instance this Construct belongs to.

:call-seq:

  topic_map -> TopicMap


14
15
16
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 14

def topic_map
  getTopicMap
end

- (Boolean) valid?

Returns true if the construct fulfills all constraints defined in the TMDM

Returns:

  • (Boolean)


28
29
30
31
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/construct.rb', line 28

def valid?
  # This is defined in RTM::AR and we test it. I guess from the API perspective, in TMAPI the validness of an object is guaranteed.
  true
end unless self.method_defined?(:valid?)