rtm 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/README +38 -3
  2. data/lib/rtm.rb +25 -47
  3. data/lib/rtm/axes.rb +7 -4
  4. data/lib/rtm/axes/association.rb +1 -1
  5. data/lib/rtm/axes/associations.rb +1 -1
  6. data/lib/rtm/axes/characteristic.rb +1 -1
  7. data/lib/rtm/axes/characteristics.rb +1 -1
  8. data/lib/rtm/axes/topic.rb +3 -3
  9. data/lib/rtm/axes/topics.rb +3 -3
  10. data/lib/rtm/engine.rb +48 -5
  11. data/lib/rtm/extensions.rb +58 -8
  12. data/lib/rtm/io.rb +2 -1
  13. data/lib/rtm/io/tmapix_from.rb +155 -0
  14. data/lib/rtm/io/tmapix_to.rb +223 -0
  15. data/lib/rtm/io/to_hash.rb +79 -41
  16. data/lib/rtm/io/to_jtm.rb +1 -1
  17. data/lib/rtm/io/to_rdf.rb +20 -5
  18. data/lib/rtm/io/to_string.rb +13 -2
  19. data/lib/rtm/io/to_yaml.rb +39 -11
  20. data/lib/rtm/navigation.rb +1 -15
  21. data/lib/rtm/navigation/association/players.rb +1 -1
  22. data/lib/rtm/navigation/name/characteristics.rb +1 -1
  23. data/lib/rtm/navigation/occurrence/characteristics.rb +1 -1
  24. data/lib/rtm/navigation/topic/characteristics.rb +1 -1
  25. data/lib/rtm/navigation/topic/players.rb +1 -1
  26. data/lib/rtm/navigation/topic/supertypes.rb +21 -17
  27. data/lib/rtm/navigation/topic/traverse.rb +1 -1
  28. data/lib/rtm/navigation/topic/types.rb +6 -4
  29. data/lib/rtm/psi.rb +6 -0
  30. data/lib/rtm/sugar.rb +42 -29
  31. data/lib/rtm/sugar/association/hash_access.rb +3 -3
  32. data/lib/rtm/sugar/occurrence/dynamic_value.rb +39 -56
  33. data/lib/rtm/sugar/occurrence/external.rb +53 -0
  34. data/lib/rtm/sugar/reifiable/reifier.rb +21 -0
  35. data/lib/rtm/sugar/role/counterparts.rb +12 -6
  36. data/lib/rtm/sugar/topic/best_name.rb +74 -0
  37. data/lib/rtm/sugar/topic/characteristics.rb +10 -10
  38. data/lib/rtm/sugar/topic/counterparts.rb +131 -119
  39. data/lib/rtm/sugar/topic/scoped.rb +102 -53
  40. data/lib/rtm/sugar/topic/topic_ref.rb +63 -12
  41. data/lib/rtm/sugar/topic/typed.rb +50 -2
  42. data/lib/rtm/sugar/topic_map/query_cache.rb +66 -0
  43. data/lib/rtm/sugar/topic_map/themes.rb +53 -0
  44. data/lib/rtm/sugar/typed/types.rb +1 -1
  45. data/lib/rtm/validation.rb +2 -2
  46. data/lib/rtm/version.rb +18 -6
  47. data/spec/rtm/axes/string_spec.rb +7 -7
  48. data/spec/rtm/axes/strings_spec.rb +10 -10
  49. data/spec/rtm/io/tmapix_from_spec.rb +76 -0
  50. data/spec/rtm/io/tmapix_to_spec.rb +159 -0
  51. data/spec/rtm/io/to_hash_spec.rb +90 -0
  52. data/spec/rtm/io/to_rdf_spec.rb +37 -0
  53. data/spec/rtm/io/to_string_spec.rb +122 -0
  54. data/spec/rtm/io/to_yaml_spec.rb +89 -0
  55. data/spec/rtm/sugar/occurrence/dynamic_value_spec.rb +156 -1
  56. data/spec/rtm/sugar/occurrence/external_spec.rb +129 -0
  57. data/spec/rtm/sugar/reifiable/reifier_spec.rb +41 -0
  58. data/spec/rtm/sugar/role/counterparts_spec.rb +174 -172
  59. data/spec/rtm/sugar/topic/best_name_spec.rb +25 -0
  60. data/spec/rtm/sugar/topic/characteristics_spec.rb +20 -5
  61. data/spec/rtm/sugar/topic/counterparts_spec.rb +41 -1
  62. data/spec/rtm/sugar/topic/hash_access_spec.rb +1 -1
  63. data/spec/rtm/sugar/topic/scoped_spec.rb +178 -114
  64. data/spec/rtm/sugar/topic/topic_ref_spec.rb +10 -10
  65. data/spec/rtm/sugar/topic/typed_spec.rb +196 -134
  66. data/spec/rtm/sugar/topic_map/themes_spec.rb +67 -0
  67. data/spec/rtm/sugar/typed/types_spec.rb +1 -1
  68. data/spec/rtm/tmapi/core/association_spec.rb +2 -2
  69. data/spec/rtm/tmapi/core/datatype_aware_spec.rb +236 -0
  70. data/spec/rtm/tmapi/core/name_spec.rb +186 -1
  71. data/spec/rtm/tmapi/core/occurrence_spec.rb +24 -67
  72. data/spec/rtm/tmapi/core/reifiable_spec.rb +2 -2
  73. data/spec/rtm/tmapi/core/scoped_spec.rb +40 -2
  74. data/spec/rtm/tmapi/core/topic_map_spec.rb +98 -30
  75. data/spec/rtm/tmapi/core/topic_spec.rb +558 -82
  76. data/spec/rtm/tmapi/core/variant_spec.rb +3 -3
  77. data/spec/rtm_spec.rb +0 -1
  78. data/spec/spec_helper.rb +7 -2
  79. data/test/javalibs/junit-4.5.jar +0 -0
  80. data/test/javalibs/tmapi-2.0-tests.jar +0 -0
  81. data/test/tmapi_tests.rb +25 -0
  82. metadata +66 -11
  83. data/lib/rtm/io/ontopia_io.rb +0 -25
  84. data/lib/rtm/io/tmapix.rb +0 -234
  85. data/lib/rtm/sugar/occurrence/externalize.rb +0 -31
  86. data/spec/rtm/io/tmapix_spec.rb +0 -85
  87. data/test/base_unit_test.rb +0 -161
  88. data/test/base_unit_test_tmapi.rb +0 -165
@@ -40,11 +40,11 @@ module RTM::Variant
40
40
  @variant2 = @name1.create_variant("Bubi",["endearment"])
41
41
  end
42
42
  it "should remove this Variant from the container (Name)" do
43
- @name1.should have(2).children
43
+ @name1.should have(2).variants
44
44
  @variant1.remove
45
- @name1.should have(1).children
45
+ @name1.should have(1).variants
46
46
  @variant2.remove
47
- @name1.should have(0).children
47
+ @name1.should have(0).variants
48
48
  end
49
49
  end
50
50
 
data/spec/rtm_spec.rb CHANGED
@@ -12,7 +12,6 @@ describe RTM do
12
12
  describe "#connect" do
13
13
  it "should have a TMAPI engine as default backend" do
14
14
  tms_tmapi = RTM.connect(:implementation => implementation_for_spec)
15
- tms_tmapi.should be_a_kind_of RTM::TopicMapSystem
16
15
  tms_tmapi.should be_a_kind_of RTM::JavaTMAPI
17
16
  tms_tmapi.should be_a_kind_of org.tmapi.core.TopicMapSystem
18
17
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
2
  # License: Apache License, Version 2.0
3
3
 
4
- $: << File.join(File.dirname(__FILE__), "/../lib")
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../lib")
5
5
 
6
6
  require 'spec'
7
7
  require 'rtm'
@@ -15,7 +15,12 @@ end
15
15
 
16
16
  def get_used_tm_sys_tm
17
17
  @basis = get_used_tm_sys
18
- @basis.create("http://www.topicmapslab.de/")
18
+ tm = @basis.create("http://www.topicmapslab.de/")
19
+ if (implementation_for_spec == :hatana)
20
+ tm.merge_in(RTM.connect(:implementation => :ontopia).create("http://www.topicmapslab.de/"))
21
+ end
22
+ # tm.enable_query_cache
23
+ return tm
19
24
  end
20
25
 
21
26
  def ar_available?
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ $: << File.join(File.dirname(__FILE__), "/../lib")
5
+
6
+ Dir[File.join(File.dirname(__FILE__), '/javalibs/*.jar')].each {|file| require file }
7
+
8
+ require 'rtm'
9
+
10
+ class TMAPITests
11
+
12
+ def initialize(engine)
13
+ RTM.connect(:implementation => engine)
14
+ run_tests_for_backend
15
+ end
16
+
17
+ def run_tests_for_backend
18
+ Java::OrgTmapi::AllTests.main([].to_java(Java::JavaLang::String))
19
+ end
20
+
21
+ end
22
+
23
+ engine = ENV['RTM_IMPLEMENTATION'] && ENV['RTM_IMPLEMENTATION'].to_sym || :ontopia
24
+
25
+ TMAPITests.new(engine)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Bock
@@ -12,12 +12,52 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2010-02-05 00:00:00 +01:00
15
+ date: 2010-02-21 00:00:00 +01:00
16
16
  default_executable:
17
17
  dependencies: []
18
18
 
19
- description: Ruby Topic Maps is a Topic Maps engine written in Ruby with several backends.
20
- email: "#rtm+rtm-gem-20100205@topicmapslab.de"
19
+ description: |
20
+ ==== Ruby Topic Maps (RTM)
21
+ RTM is a Topic Maps engine written in Ruby. See http://rtm.topicmapslab.de/ for instructions.
22
+ Several backends and extensions are available as separate gems.
23
+
24
+ ==== Overview
25
+ From a developer's perspective, RTM is a schema-less database management system.
26
+ The Topic Maps standard (described below) on which RTM is based provides a way of creating a self-describing schema just by using it.
27
+
28
+ ==== Quickstart
29
+ require 'rtm'
30
+ connection = RTM.connect # uses the default Ontopia in-memory backend
31
+ topic_map = connection.create "http://example.org/my_topic_map/"
32
+ some_topic = topicmap.get!("identifier_of_the_topic")
33
+ some_topic["-"] = "default name for the topic"
34
+ topic_map.to_xtm("my_xtm_file.xtm")
35
+
36
+ ==== Topic Maps
37
+ Topic Maps is an international industry standard (ISO13250) for interchangeably representing information
38
+ about the structure of information resources used to define topics, and the relationships between topics.
39
+ A set of one or more interrelated documents that employs the notation defined by this International Standard is called a topic map.
40
+ A topic map defines a multidimensional topic space - a space in which the locations are topics,
41
+ and in which the distances between topics are measurable in terms of the number of intervening topics
42
+ which must be visited in order to get from one topic to another, and the kinds of relationships that define
43
+ the path from one topic to another, if any, through the intervening topics, if any.
44
+ In addition, information objects can have properties, as well as values for those properties, assigned to them.
45
+ The Topic Maps Data Model which is used in this implementation can be found on http://www.isotopicmaps.org/sam/sam-model/.
46
+
47
+ ==== Backends
48
+ * rtm-ontopia: JRuby only, recommended, uses Ontopia: http://code.google.com/p/ontopia/
49
+ * rtm-tinytim: JRuby only, uses TinyTiM: http://tinytim.sourceforge.net/
50
+ * rtm-activerecord: uses a custom ActiveRecord schema
51
+
52
+ ==== Extensions
53
+ * rtm-tmql: Adds support for the Topic Maps Query Language (TMQL), http://isotopicmaps.org/tmql/
54
+ * rtm-tmcl: Adds support for the Topic Maps Constraint Language (TMCL), http://isotopicmaps.org/tmcl/
55
+
56
+ ==== License
57
+ Copyright 2009 Topic Maps Lab, University of Leipzig.
58
+ Apache License, Version 2.0
59
+
60
+ email: rtm+rtm-gem-20100221@topicmapslab.de
21
61
  executables: []
22
62
 
23
63
  extensions: []
@@ -42,8 +82,8 @@ files:
42
82
  - lib/rtm/helpers/no_output.rb
43
83
  - lib/rtm/helpers/uri.rb
44
84
  - lib/rtm/io/from_xtm2_libxml.rb
45
- - lib/rtm/io/ontopia_io.rb
46
- - lib/rtm/io/tmapix.rb
85
+ - lib/rtm/io/tmapix_from.rb
86
+ - lib/rtm/io/tmapix_to.rb
47
87
  - lib/rtm/io/to_hash.rb
48
88
  - lib/rtm/io/to_jtm.rb
49
89
  - lib/rtm/io/to_rdf.rb
@@ -69,14 +109,18 @@ files:
69
109
  - lib/rtm/psi.rb
70
110
  - lib/rtm/sugar/association/hash_access.rb
71
111
  - lib/rtm/sugar/occurrence/dynamic_value.rb
72
- - lib/rtm/sugar/occurrence/externalize.rb
112
+ - lib/rtm/sugar/occurrence/external.rb
113
+ - lib/rtm/sugar/reifiable/reifier.rb
73
114
  - lib/rtm/sugar/role/counterparts.rb
115
+ - lib/rtm/sugar/topic/best_name.rb
74
116
  - lib/rtm/sugar/topic/characteristics.rb
75
117
  - lib/rtm/sugar/topic/counterparts.rb
76
118
  - lib/rtm/sugar/topic/hash_access.rb
77
119
  - lib/rtm/sugar/topic/scoped.rb
78
120
  - lib/rtm/sugar/topic/topic_ref.rb
79
121
  - lib/rtm/sugar/topic/typed.rb
122
+ - lib/rtm/sugar/topic_map/query_cache.rb
123
+ - lib/rtm/sugar/topic_map/themes.rb
80
124
  - lib/rtm/sugar/typed/types.rb
81
125
  - lib/rtm/sugar.rb
82
126
  - lib/rtm/validation.rb
@@ -93,7 +137,12 @@ files:
93
137
  - spec/rtm/axes/topic_spec.rb
94
138
  - spec/rtm/axes/topics_spec.rb
95
139
  - spec/rtm/base_spec.rb
96
- - spec/rtm/io/tmapix_spec.rb
140
+ - spec/rtm/io/tmapix_from_spec.rb
141
+ - spec/rtm/io/tmapix_to_spec.rb
142
+ - spec/rtm/io/to_hash_spec.rb
143
+ - spec/rtm/io/to_rdf_spec.rb
144
+ - spec/rtm/io/to_string_spec.rb
145
+ - spec/rtm/io/to_yaml_spec.rb
97
146
  - spec/rtm/navigation/association/players_spec.rb
98
147
  - spec/rtm/navigation/association_spec.rb
99
148
  - spec/rtm/navigation/name/atomify_spec.rb
@@ -115,16 +164,21 @@ files:
115
164
  - spec/rtm/navigation/topic_spec.rb
116
165
  - spec/rtm/sugar/association/hash_access_spec.rb
117
166
  - spec/rtm/sugar/occurrence/dynamic_value_spec.rb
167
+ - spec/rtm/sugar/occurrence/external_spec.rb
168
+ - spec/rtm/sugar/reifiable/reifier_spec.rb
118
169
  - spec/rtm/sugar/role/counterparts_spec.rb
170
+ - spec/rtm/sugar/topic/best_name_spec.rb
119
171
  - spec/rtm/sugar/topic/characteristics_spec.rb
120
172
  - spec/rtm/sugar/topic/counterparts_spec.rb
121
173
  - spec/rtm/sugar/topic/hash_access_spec.rb
122
174
  - spec/rtm/sugar/topic/scoped_spec.rb
123
175
  - spec/rtm/sugar/topic/topic_ref_spec.rb
124
176
  - spec/rtm/sugar/topic/typed_spec.rb
177
+ - spec/rtm/sugar/topic_map/themes_spec.rb
125
178
  - spec/rtm/sugar/typed/types_spec.rb
126
179
  - spec/rtm/tmapi/core/association_spec.rb
127
180
  - spec/rtm/tmapi/core/construct_spec.rb
181
+ - spec/rtm/tmapi/core/datatype_aware_spec.rb
128
182
  - spec/rtm/tmapi/core/name_spec.rb
129
183
  - spec/rtm/tmapi/core/occurrence_spec.rb
130
184
  - spec/rtm/tmapi/core/reifiable_spec.rb
@@ -139,8 +193,9 @@ files:
139
193
  - spec/rtm/utils/sparql_spec.rb
140
194
  - spec/rtm_spec.rb
141
195
  - spec/spec_helper.rb
142
- - test/base_unit_test.rb
143
- - test/base_unit_test_tmapi.rb
196
+ - test/tmapi_tests.rb
197
+ - test/javalibs/junit-4.5.jar
198
+ - test/javalibs/tmapi-2.0-tests.jar
144
199
  - LICENSE
145
200
  - DISCLAIMER
146
201
  - README
@@ -171,6 +226,6 @@ rubyforge_project: rtm
171
226
  rubygems_version: 1.3.5
172
227
  signing_key:
173
228
  specification_version: 3
174
- summary: Ruby Topic Maps is a Topic Maps engine written in Ruby
229
+ summary: Ruby Topic Maps is a Topic Maps engine written in Ruby.
175
230
  test_files: []
176
231
 
@@ -1,25 +0,0 @@
1
- # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
- # License: Apache License, Version 2.0
3
-
4
-
5
- module RTM::IO
6
- # Import and Export of TMAPI Topic Maps
7
- # Utilizing the Ontopia libary http://code.google.com/p/tmapix/
8
- # Consequently the (de-) serializer provided here
9
- # are only Wrapper
10
-
11
- module Ontopia
12
- module TopicMap
13
- def to_cxtm(filename)
14
- raise("Only supported for Ontopia.") unless self.kind_of?(net.ontopia.topicmaps.impl.tmapi2.TopicMapImpl)
15
- out_file = java.io.FileOutputStream.new(filename)
16
- writer = net.ontopia.topicmaps.xml.CanonicalXTMWriter.new(out_file)
17
- writer.write(self.wrapped)
18
- out_file.flush
19
- out_file.close
20
- end
21
- end
22
-
23
- RTM.register_extension(self)
24
- end
25
- end
data/lib/rtm/io/tmapix.rb DELETED
@@ -1,234 +0,0 @@
1
- # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
- # License: Apache License, Version 2.0
3
-
4
- module RTM::IO
5
- # Import and Export of TMAPI Topic Maps
6
- # Utilizing the TMAPIX libary http://code.google.com/p/tmapix/
7
- # Consequently the (de-) serializer provided here
8
- # are only Wrapper
9
-
10
- module TMAPIX
11
- module TopicMap
12
-
13
- # Reads a Topic Map from an LTM File
14
- # whose location is given as String parameter
15
- #
16
- # :call-seq:
17
- # from_ltm(filename)
18
- #
19
- def from_ltm(filename)
20
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
21
- org.tmapix.io.LTMTopicMapReader.new(self, java.io.File.new(filename)).read
22
- end
23
-
24
- # Reads a Topic Map from an CTM File
25
- # whose location is given as String parameter
26
- #
27
- # :call-seq:
28
- # from_ctm(filename)
29
- #
30
- def from_ctm(filename)
31
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
32
- org.tmapix.io.CTMTopicMapReader.new(self, java.io.File.new(filename)).read
33
- end
34
-
35
- # Reads a JSON Topic Maps (JTM) File
36
- # whose location is given as String parameter
37
- #
38
- # :call-seq:
39
- # from_jtm(filename)
40
- #
41
- def from_jtm(filename)
42
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
43
- # seems not to acceped all files that are found to be valid by the JTM validator
44
- org.tmapix.io.JTMTopicMapReader.new(self, java.io.File.new(filename)).read
45
- end
46
-
47
- # Reads a Friendly Topic Maps XML (TM/XML) File
48
- # independent of the version
49
- # whose location is given as String parameter
50
- #
51
- # :call-seq:
52
- # from_tmxml(filename)
53
- #
54
- def from_tmxml(filename)
55
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
56
- org.tmapix.io.TMXMLTopicMapReader.new(self, java.io.File.new(filename)).read
57
- end
58
-
59
- # Reads a XML Topic Maps (XTM) 1.0 File
60
- # whose location is given as String parameter
61
- #
62
- # :call-seq:
63
- # from_xtm10(filename)
64
- #
65
- def from_xtm10(filename)
66
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
67
- org.tmapix.io.XTM10TopicMapReader.new(self, java.io.File.new(filename)).read
68
- end
69
-
70
- # Reads a XML Topic Maps (XTM) 2.0 File
71
- # whose location is given as String parameter
72
- #
73
- # :call-seq:
74
- # from_xtm20(filename)
75
- #
76
- def from_xtm20(filename)
77
- from_xtm(filename)
78
- end
79
-
80
- # Reads a XML Topic Maps (XTM) File
81
- # independent of the version
82
- # whose location is given as String parameter
83
- #
84
- # :call-seq:
85
- # from_xtm(filename)
86
- #
87
- def from_xtm(filename)
88
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
89
- org.tmapix.io.XTMTopicMapReader.new(self, java.io.File.new(filename)).read
90
- end
91
-
92
- # Reads a Notation3 (N3) File
93
- # whose location is given as String
94
- # a second parameter has to be handed over
95
- # providing the mapping vocabulary.
96
- # The syntax of the vocabulary is guessed.
97
- #
98
- # :call-seq:
99
- # from_n3(source vocabulary)
100
- #
101
- def from_n3(filename, vocab)
102
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
103
- reader = org.tmapix.io.N3TopicMapReader.new self, java.io.File.new(filename)
104
- reader.setMappingSource(java.io.File.new(vocab))
105
- reader.read
106
- end
107
-
108
- # Reads a RDF/XML File
109
- # whose location is given as String
110
- # a second parameter has to be handed over
111
- # providing the mapping vocabulary.
112
- # The syntax of the vocabulary is guessed.
113
- #
114
- # :call-seq:
115
- # from_rdfxml(source vocabulary)
116
- #
117
- def from_rdfxml(filename, vocab)
118
- raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap
119
- reader = org.tmapix.io.RDFXMLTopicMapReader.new self, java.io.File.new(filename)
120
- reader.setMappingSource(java.io.File.new(vocab))
121
- reader.read
122
- end
123
-
124
- # Serializes an RTM::TopicMap to XTM v. 2.0.
125
- #
126
- # The argument filename defines the absolute location of the file that is created.
127
- # The argument base_iri is used to resolve IRIs against.
128
- #
129
- # :call-seq:
130
- # to_xtm20(filename, base_iri)
131
- #
132
- def to_xtm20(filename, base_iri)
133
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
134
- out_file = java.io.FileOutputStream.new(filename)
135
- writer = org.tmapix.io.XTM20TopicMapWriter.new(out_file, base_iri)
136
- writer.write(self)
137
- out_file.flush
138
- out_file.close
139
- end
140
- alias :to_xtm :to_xtm20
141
-
142
- # Serializes an RTM::TopicMap to XTM v. 1.0.
143
- #
144
- # The argument filename defines the absolute location of the file that is created.
145
- # The argument base_iri is used to resolve IRIs against.
146
- # Both arguments have to be Strings.
147
- #
148
- # :call-seq:
149
- # to_xtm10(filename, base_iri)
150
- #
151
- def to_xtm10(filename, base_iri)
152
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
153
- out_file = java.io.FileOutputStream.new(filename)
154
- writer = org.tmapix.io.XTM10TopicMapWriter.new(out_file, base_iri)
155
- writer.write(self)
156
- out_file.flush
157
- out_file.close
158
- end
159
-
160
- # Serializes an RTM::TopicMap to JTM.
161
- #
162
- # The argument filename defines the absolute location of the file that is created.
163
- # The argument base_iri is used to resolve IRIs against.
164
- #
165
- # :call-seq:
166
- # to_jtm(filename, base_iri)
167
- #
168
- def to_jtm(filename, base_iri)
169
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
170
- out_file = java.io.FileOutputStream.new(filename)
171
- writer = org.tmapix.io.JTMTopicMapWriter.new(out_file, base_iri)
172
- writer.write(self)
173
- out_file.flush
174
- out_file.close
175
- end
176
- alias :to_json :to_jtm
177
-
178
- # Serializes an RTM::TopicMap to LTM.
179
- #
180
- # The argument filename defines the absolute location of the file that is created.
181
- # The argument base_iri is used to resolve IRIs against.
182
- #
183
- # :call-seq:
184
- # to_ltm(filename, base_iri)
185
- #
186
- def to_ltm(filename, base_iri)
187
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
188
- out_file = java.io.FileOutputStream.new(filename)
189
- writer = org.tmapix.io.LTMTopicMapWriter.new(out_file, base_iri)
190
- writer.write(self)
191
- out_file.flush
192
- out_file.close
193
- end
194
-
195
- # Serializes an RTM::TopicMap to TM/XML.
196
- #
197
- # The argument filename defines the absolute location of the file that is created.
198
- # The argument base_iri is used to resolve IRIs against.
199
- #
200
- # :call-seq:
201
- # to_tmxml(filename, base_iri)
202
- #
203
- def to_tmxml(filename, base_iri)
204
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
205
- out_file = java.io.FileOutputStream.new(filename)
206
- writer = org.tmapix.io.TMXMLTopicMapWriter.new(out_file, base_iri)
207
- writer.write(self)
208
- out_file.flush
209
- out_file.close
210
- end
211
-
212
- # Serializes an RTM::TopicMap to CTM.
213
- #
214
- # The argument filename defines the absolute location of the file that is created.
215
- # The argument base_iri is used to resolve IRIs against.
216
- #
217
- # :call-seq:
218
- # to_ctm(filename, base_iri)
219
- #
220
- def to_ctm(filename, base_iri)
221
- raise("Only supported for TMAPI backends.") unless self.kind_of?(Java::OrgTmapiCore::TopicMap)
222
- out_file = java.io.FileOutputStream.new(filename)
223
- line = "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"
224
- writer = de.topicmapslab.ctm.writer.core.CTMTopicMapWriter.new(out_file, base_iri, line)
225
- writer.write(self)
226
- out_file.flush
227
- out_file.close
228
- end
229
-
230
- end
231
-
232
- RTM.register_extension(self)
233
- end
234
- end