Module: RTM::IO::TmapiXTo::TopicMap

Defined in:
lib/rtm/io/tmapix_to.rb

Instance Method Summary collapse

Instance Method Details

#to_ctm(*args) ⇒ Object

Serializes an RTM::TopicMap to CTM.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

A property-Hash may be given to set properties of the writer.

:call-seq:

to_ctm(properties={})
to_ctm(file, properties={})
to_ctm(file, base_iri, properties={})


233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/rtm/io/tmapix_to.rb', line 233

def to_ctm(*args)
  # set default params
  default_params = {
    "writer.features.export.itemidentifier" => false,
    "writer.features.prefixDetection.enabled" => false,
    "writer.features.templateDetection.enabled" => false,
    "writer.features.templateDetection.topicTemplates" => false,
    "writer.features.templateDetection.associationTemplates" => false,
    "writer.features.templateMerger.enabled" => false
  }
  # enhance the args with the default params
  if args.last.is_a?(Hash)
    args.push(default_params.merge(args.pop))
  else
    args.push(default_params)
  end
  to_anything(Java::DeTopicmapslabCtmWriterCore::CTMTopicMapWriter, *args)
end

#to_jtm(*args) ⇒ Object Also known as: to_json

Serializes an RTM::TopicMap to JTM.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_jtm
to_jtm(file)
to_jtm(file, base_iri)


173
174
175
# File 'lib/rtm/io/tmapix_to.rb', line 173

def to_jtm(*args)
  to_anything(Java::OrgTmapixIo::JTMTopicMapWriter, *args)
end

#to_ltm(*args) ⇒ Object

Serializes an RTM::TopicMap to LTM.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_ltm
to_ltm(file)
to_ltm(file, base_iri)


193
194
195
# File 'lib/rtm/io/tmapix_to.rb', line 193

def to_ltm(*args)
  to_anything(Java::OrgTmapixIo::LTMTopicMapWriter, *args)
end

#to_tmxml(*args) ⇒ Object

Serializes an RTM::TopicMap to TM/XML.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_tmxml
to_tmxml(file)
to_tmxml(file, base_iri)


212
213
214
# File 'lib/rtm/io/tmapix_to.rb', line 212

def to_tmxml(*args)
  to_anything(Java::OrgTmapixIo::TMXMLTopicMapWriter, *args)
end

#to_xtm10(*args) ⇒ Object Also known as: to_xtm1

Serializes an RTM::TopicMap to XTM v. 1.0.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_xtm10
to_xtm10(file)
to_xtm10(file, base_iri)


153
154
155
# File 'lib/rtm/io/tmapix_to.rb', line 153

def to_xtm10(*args)
  to_anything(Java::OrgTmapixIo::XTM10TopicMapWriter, *args)
end

#to_xtm20(*args) ⇒ Object Also known as: to_xtm2

Serializes an RTM::TopicMap to XTM v. 2.0.

If no argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_xtm21
to_xtm21(file)
to_xtm21(file, base_iri)


131
132
133
134
135
# File 'lib/rtm/io/tmapix_to.rb', line 131

def to_xtm20(*args)
  args.push({}) unless args.last.is_a?(Hash)
  args.last[:xtm_version] = Java::OrgTmapixIo::XTMVersion::XTM_2_0
  to_anything(Java::OrgTmapixIo::XTM2TopicMapWriter, *args)
end

#to_xtm21(*args) ⇒ Object Also known as: to_xtm

Serializes an RTM::TopicMap to XTM v. 2.1.

If no file argument is given, a String is returned.

The argument file can be provided as a String (which is then interpreted as a filename) or as a java.io.OutputStream.

The argument base_iri may be used to define a new base_iri, if not, the current one is used. Base_iri may be a String.

:call-seq:

to_xtm21
to_xtm21(file)
to_xtm21(file, base_iri)


109
110
111
112
113
# File 'lib/rtm/io/tmapix_to.rb', line 109

def to_xtm21(*args)
  args.push({}) unless args.last.is_a?(Hash)
  args.last[:xtm_version] = Java::OrgTmapixIo::XTMVersion::XTM_2_1
  to_anything(Java::OrgTmapixIo::XTM2TopicMapWriter, *args)
end