Module: Ontopia::Topicmaps
- Defined in:
- lib/ontopia/topicmaps.rb,
lib/ontopia/topicmaps/version.rb,
lib/ontopia/topicmaps/packages.rb,
lib/ontopia/topicmaps/topicmap.rb,
lib/ontopia/topicmaps/stringifiers.rb
Defined Under Namespace
Modules: Packages, Version
Classes: AnyNameStringifier, IdStringifier, Topicmap
Constant Summary
collapse
- DEFAULT_JARS =
ENV['OTM_JARS'] || 'log4j-*:slf4j-log4j*:ontopia-engine-*'
- DEFAULT_BASE =
ENV['OTM_BASE'] || '/usr/local/ontopia'
- VERSION =
Version.to_s
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.base ⇒ Object
Returns the value of attribute base.
44
45
46
|
# File 'lib/ontopia/topicmaps.rb', line 44
def base
@base
end
|
Class Method Details
.count(file, *args) ⇒ Object
66
67
68
|
# File 'lib/ontopia/topicmaps.rb', line 66
def count(file, *args)
file(file).count(*args)
end
|
.default_stringifier ⇒ Object
50
51
52
|
# File 'lib/ontopia/topicmaps.rb', line 50
def default_stringifier
@default_stringifier ||= name_stringifier
end
|
.default_stringifier=(str) ⇒ Object
46
47
48
|
# File 'lib/ontopia/topicmaps.rb', line 46
def default_stringifier=(str)
@default_stringifier = stringifier(str)
end
|
.file(file) ⇒ Object
62
63
64
|
# File 'lib/ontopia/topicmaps.rb', line 62
def file(file)
Topicmap.new(file)
end
|
.query(file, *args, &block) ⇒ Object
70
71
72
|
# File 'lib/ontopia/topicmaps.rb', line 70
def query(file, *args, &block)
file(file).query(*args, &block)
end
|
.query_maps(file, *args) ⇒ Object
74
75
76
|
# File 'lib/ontopia/topicmaps.rb', line 74
def query_maps(file, *args)
file(file).query_maps(*args)
end
|
.setup_classpath(base = nil, jars = nil) ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/ontopia/topicmaps.rb', line 86
def setup_classpath(base = nil, jars = nil)
if @base
return unless base
raise "#{self}: $CLASSPATH already set up: #{@base}"
end
@base = base ||= DEFAULT_BASE
Array(jars || DEFAULT_JARS).join(':').split(':').each { |jar|
(path = Dir[File.join(base, 'lib', "#{jar}.jar")].sort.last) ?
$CLASSPATH << path : raise("JAR not found: #{jar} (#{base})")
}
init.each { |klass, (modules, block)|
klass.send :include, Packages, *modules.map { |m| const_get(m) }
klass.class_eval(&block) if block
}.clear
end
|
.stringifier(str) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/ontopia/topicmaps.rb', line 54
def stringifier(str)
case str
when self::StringifierIF then str.method(:to_string)
when Symbol then send("#{str}_stringifier")
else str
end
end
|
.topics(file, *args) ⇒ Object
78
79
80
|
# File 'lib/ontopia/topicmaps.rb', line 78
def topics(file, *args)
file(file).topics(*args)
end
|