Module: RTM::IO::TmapiXFrom::TopicMap
- Defined in:
- rtm/lib/rtm/io/tmapix_from.rb,
rtm/spec/rtm/io/tmapix_from_spec.rb
Instance Method Summary
- - (Object) from_anything(reader_class, *args)
-
- (Object) from_ctm(*args)
Reads a Topic Map from an CTM File whose location is given as String parameter.
-
- (Object) from_jtm(*args)
Reads a JSON Topic Maps (JTM) File whose location is given as String parameter.
-
- (Object) from_ltm(*args)
Reads a Topic Map from an LTM File whose location is given as String parameter.
-
- (Object) from_n3(filename, vocab)
Reads a Notation3 (N3) File whose location is given as String .
-
- (Object) from_rdfxml(filename, vocab)
Reads a RDF/XML File whose location is given as String The source vocabulary must provide the mapping vocabulary.
-
- (Object) from_tmxml(*args)
Reads a Friendly Topic Maps XML (TM/XML) File independent of the version whose location is given as String parameter.
-
- (Object) from_xtm(*args)
Reads a XML Topic Maps (XTM) File independent of the version whose location is given as String parameter.
-
- (Object) from_xtm10(*args)
(also: #from_xtm1)
Reads a XML Topic Maps (XTM) 1.0 File whose location is given as String parameter.
-
- (Object) from_xtm20(*args)
(also: #from_xtm2)
Reads a XML Topic Maps (XTM) 2.0 File whose location is given as String parameter.
Instance Method Details
- (Object) from_anything(reader_class, *args)
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 12 def from_anything(reader_class, *args) raise "Only supported for TMAPI backends!!" unless self.kind_of?(Java::OrgTmapiCore::TopicMap) || self.kind_of?(Java::OrgTmapiCore::TopicMapSystem) params = {} # See if we got a params hash. It must be at the end, if it is given. # Take it off, so it won't be unshifted later. params = args.pop if args.last.is_a?(Hash) # Take the source as next (i.e. second after the writer) positional parameter or from hash. # Leave nil if neither found. source = args.shift || params[:source] # Take the base_iri as next (i.e. third after the file) positional parameter or from the hash. # Use the topic maps's base_iri if neither found. base_iri = args.shift || params[:base_iri] unless base_iri if self.kind_of?(RTM::TopicMap) base_iri = self.base_iri else base_iri = "imported:FIXME" end end if self.kind_of?(RTM::TopicMap) topic_map = self else topic_map = create(base_iri) end reader_class.new(topic_map, java.io.File.new(source)).read topic_map end |
- (Object) from_ctm(*args)
Reads a Topic Map from an CTM File whose location is given as String parameter.
:call-seq:
from_ctm(filename)
61 62 63 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 61 def from_ctm(*args) from_anything(Java::OrgTmapixIo::CTMTopicMapReader, *args) end |
- (Object) from_jtm(*args)
Reads a JSON Topic Maps (JTM) File whose location is given as String parameter.
:call-seq:
from_jtm(filename)
71 72 73 74 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 71 def from_jtm(*args) # seems not to acceped all files that are found to be valid by the JTM validator from_anything(Java::OrgTmapixIo::JTMTopicMapReader, *args) end |
- (Object) from_ltm(*args)
Reads a Topic Map from an LTM File whose location is given as String parameter.
:call-seq:
from_ltm(filename)
51 52 53 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 51 def from_ltm(*args) from_anything(Java::OrgTmapixIo::LTMTopicMapReader, *args) end |
- (Object) from_n3(filename, vocab)
Reads a Notation3 (N3) File whose location is given as String . The source vocabulary must provide the mapping vocabulary. The syntax of the vocabulary is guessed.
:call-seq:
from_n3(filename, source vocabulary)
129 130 131 132 133 134 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 129 def from_n3(filename, vocab) raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap reader = Java::OrgTmapixIo::N3TopicMapReader.new self, java.io.File.new(filename) reader.setMappingSource(java.io.File.new(vocab)) reader.read end |
- (Object) from_rdfxml(filename, vocab)
Reads a RDF/XML File whose location is given as String The source vocabulary must provide the mapping vocabulary. The syntax of the vocabulary is guessed.
:call-seq:
from_rdfxml(filename, source vocabulary)
145 146 147 148 149 150 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 145 def from_rdfxml(filename, vocab) raise "Only supported for TMAPI backends!!" unless self.kind_of? Java::OrgTmapiCore::TopicMap reader = Java::OrgTmapixIo::RDFXMLTopicMapReader.new self, java.io.File.new(filename) reader.setMappingSource(java.io.File.new(vocab)) reader.read end |
- (Object) from_tmxml(*args)
Reads a Friendly Topic Maps XML (TM/XML) File independent of the version whose location is given as String parameter.
:call-seq:
from_tmxml(filename)
83 84 85 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 83 def from_tmxml(*args) from_anything(Java::OrgTmapixIo::TMXMLTopicMapReader, *args) end |
- (Object) from_xtm(*args)
Reads a XML Topic Maps (XTM) File independent of the version whose location is given as String parameter.
:call-seq:
from_xtm(filename)
116 117 118 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 116 def from_xtm(*args) from_anything(Java::OrgTmapixIo::XTMTopicMapReader, *args) end |
- (Object) from_xtm10(*args) Also known as: from_xtm1
Reads a XML Topic Maps (XTM) 1.0 File whose location is given as String parameter.
:call-seq:
from_xtm10(filename)
93 94 95 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 93 def from_xtm10(*args) from_anything(Java::OrgTmapixIo::XTM10TopicMapReader, *args) end |
- (Object) from_xtm20(*args) Also known as: from_xtm2
Reads a XML Topic Maps (XTM) 2.0 File whose location is given as String parameter.
:call-seq:
from_xtm20(filename)
104 105 106 |
# File 'rtm/lib/rtm/io/tmapix_from.rb', line 104 def from_xtm20(*args) from_xtm(*args) end |