ontopia-topicmaps 0.0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +663 -0
- data/ChangeLog +7 -0
- data/README +46 -0
- data/Rakefile +21 -0
- data/lib/ontopia/topicmaps/packages.rb +49 -0
- data/lib/ontopia/topicmaps/stringifiers.rb +42 -0
- data/lib/ontopia/topicmaps/topicmap.rb +127 -0
- data/lib/ontopia/topicmaps/version.rb +52 -0
- data/lib/ontopia/topicmaps.rb +114 -0
- data/lib/ontopia-topicmaps.rb +1 -0
- data/spec/data/ItalianOpera.ltm +8813 -0
- data/spec/data/JillsMusic.xtm +16014 -0
- data/spec/data/ghn.xtm +11087 -0
- data/spec/ontopia/topicmaps_spec.rb +96 -0
- data/spec/spec_helper.rb +15 -0
- metadata +71 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
describe Ontopia::Topicmaps do
|
2
|
+
|
3
|
+
describe 'JillsMusic' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@otm = otm('JillsMusic.xtm')
|
7
|
+
end
|
8
|
+
|
9
|
+
example { @otm.count.should == 274 }
|
10
|
+
|
11
|
+
example { @otm.count('select count($TOPIC) from not(topic($TOPIC))?').should be_zero }
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'ItalianOpera' do
|
16
|
+
|
17
|
+
example { otm('ItalianOpera.ltm').count.should == 2011 }
|
18
|
+
|
19
|
+
example { otm('ItalianOpera.ltm').topics.size.should == 2011 }
|
20
|
+
|
21
|
+
example { Ontopia::Topicmaps.count(data('ItalianOpera.ltm')).should == 2011 }
|
22
|
+
|
23
|
+
example { Ontopia::Topicmaps.topics(data('ItalianOpera.ltm')).size.should == 2011 }
|
24
|
+
|
25
|
+
example do
|
26
|
+
Ontopia::Topicmaps.query(data('ItalianOpera.ltm'),
|
27
|
+
'{ $TOPIC = puccini | $TOPIC = puccini-study-centre }?'
|
28
|
+
).sort.should == ['Centro studi Giacomo Puccini', 'Puccini, Giacomo']
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'GHN' do
|
34
|
+
|
35
|
+
before :all do
|
36
|
+
@otm = otm('ghn.xtm')
|
37
|
+
@dec = <<-EOT
|
38
|
+
direct-narrower-term($A, $B) :-
|
39
|
+
HierarchicalRelation($A : broaderTermMember,
|
40
|
+
$B : narrowerTermMember).
|
41
|
+
|
42
|
+
narrower-term($A, $B) :- {
|
43
|
+
direct-narrower-term($A, $B) |
|
44
|
+
direct-narrower-term($A, $C), narrower-term($C, $B)
|
45
|
+
}.
|
46
|
+
|
47
|
+
narrower-or-equal-term($A, $B) :- {
|
48
|
+
$A = $B | narrower-term($A, $B)
|
49
|
+
}.
|
50
|
+
|
51
|
+
direct-broader-term($A, $B) :-
|
52
|
+
direct-narrower-term($B, $A).
|
53
|
+
|
54
|
+
broader-term($A, $B) :-
|
55
|
+
narrower-term($B, $A).
|
56
|
+
|
57
|
+
broader-or-equal-term($A, $B) :-
|
58
|
+
narrower-or-equal-term($B, $A).
|
59
|
+
EOT
|
60
|
+
end
|
61
|
+
|
62
|
+
example do
|
63
|
+
@otm.query(<<-EOT, @dec).should == %w[indexing]
|
64
|
+
select $TOPIC from
|
65
|
+
Production($TOPIC : isProducing, $PRODUCT : isProductOf),
|
66
|
+
broader-term(subject_indexes, $PRODUCT),
|
67
|
+
broader-term(author_indexes, $PRODUCT),
|
68
|
+
Usage($TOPIC : isUsing, classification_schemes : isInstrumentOf)?
|
69
|
+
EOT
|
70
|
+
end
|
71
|
+
|
72
|
+
example do
|
73
|
+
@otm.query(<<-EOT).should == %w[indexing]
|
74
|
+
import "http://psi.ontopia.net/tolog/string/" as s
|
75
|
+
#{@dec}
|
76
|
+
select $TOPIC from Production($TOPIC : isProducing, $PRODUCT : isProductOf),
|
77
|
+
broader-term(subject_indexes, $PRODUCT),
|
78
|
+
broader-term(author_indexes, $PRODUCT),
|
79
|
+
Usage($TOPIC : isUsing, classification_schemes : isInstrumentOf)?
|
80
|
+
EOT
|
81
|
+
end
|
82
|
+
|
83
|
+
example do
|
84
|
+
@otm.query(<<-EOT, nil, :id).sort.should == %w[current_awareness_services information_services]
|
85
|
+
import "http://psi.ontopia.net/tolog/string/" as s
|
86
|
+
|
87
|
+
select $TOPIC from Production($_ : isProducing, $TOPIC : isProductOf),
|
88
|
+
topic-name($TOPIC, $PRODUCTNAME),
|
89
|
+
value($PRODUCTNAME, $PRODUCTSTRING),
|
90
|
+
s:contains($PRODUCTSTRING, "service")?
|
91
|
+
EOT
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.unshift('lib') unless $:.first == 'lib'
|
2
|
+
|
3
|
+
require 'ontopia/topicmaps'
|
4
|
+
|
5
|
+
RSpec.configure { |config|
|
6
|
+
config.include(Module.new {
|
7
|
+
def data(file)
|
8
|
+
File.join(File.dirname(__FILE__), 'data', file)
|
9
|
+
end
|
10
|
+
|
11
|
+
def otm(file)
|
12
|
+
Ontopia::Topicmaps::Topicmap.new(data(file))
|
13
|
+
end
|
14
|
+
})
|
15
|
+
}
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ontopia-topicmaps
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Jens Wille
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Query topic maps with Ontopia.
|
15
|
+
email: jens.wille@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README
|
20
|
+
- COPYING
|
21
|
+
- ChangeLog
|
22
|
+
files:
|
23
|
+
- lib/ontopia-topicmaps.rb
|
24
|
+
- lib/ontopia/topicmaps.rb
|
25
|
+
- lib/ontopia/topicmaps/packages.rb
|
26
|
+
- lib/ontopia/topicmaps/stringifiers.rb
|
27
|
+
- lib/ontopia/topicmaps/topicmap.rb
|
28
|
+
- lib/ontopia/topicmaps/version.rb
|
29
|
+
- COPYING
|
30
|
+
- ChangeLog
|
31
|
+
- README
|
32
|
+
- Rakefile
|
33
|
+
- spec/data/ItalianOpera.ltm
|
34
|
+
- spec/data/JillsMusic.xtm
|
35
|
+
- spec/data/ghn.xtm
|
36
|
+
- spec/ontopia/topicmaps_spec.rb
|
37
|
+
- spec/spec_helper.rb
|
38
|
+
homepage: http://github.com/blackwinter/ontopia-topicmaps
|
39
|
+
licenses:
|
40
|
+
- AGPL
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options:
|
43
|
+
- --charset
|
44
|
+
- UTF-8
|
45
|
+
- --line-numbers
|
46
|
+
- --all
|
47
|
+
- --title
|
48
|
+
- ontopia-topicmaps Application documentation (v0.0.1)
|
49
|
+
- --main
|
50
|
+
- README
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
none: false
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
none: false
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.8.24
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Query topic maps with Ontopia.
|
71
|
+
test_files: []
|