activerubic 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/active_rubic.rb +63 -34
- data/lib/active_rubic/base.rb +357 -0
- data/lib/active_rubic/cacher.rb +76 -0
- data/lib/active_rubinstein/base.rb +226 -0
- data/lib/active_rubinstein/deprecated/base.rb +208 -0
- data/lib/active_rubinstein/jena_query.rb +175 -0
- data/lib/active_rubinstein/joseki_query.rb +82 -0
- data/lib/active_rubinstein/lucene_searcher.rb +170 -0
- data/lib/active_rubinstein/sparql_formulator.rb +133 -0
- data/lib/objectmanager/namespace.rb +170 -0
- data/lib/objectmanager/owl/class.rb +150 -0
- data/lib/objectmanager/owl/object_property.rb +89 -0
- data/lib/objectmanager/owl/thing.rb +78 -0
- data/lib/objectmanager/rdfs/image.rb +272 -0
- data/lib/objectmanager/rdfs/resource.rb +287 -0
- metadata +35 -23
- data/History.txt +0 -41
- data/Manifest.txt +0 -7
- data/Rakefile +0 -35
- data/bin/active_rubic +0 -0
- data/test/test_active_rubic.rb +0 -305
metadata
CHANGED
@@ -3,16 +3,16 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: activerubic
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.8.
|
7
|
-
date: 2008-01-
|
8
|
-
summary: ActiveRubic is a
|
6
|
+
version: 0.8.1
|
7
|
+
date: 2008-01-16 00:00:00 +02:00
|
8
|
+
summary: ActiveRubic is a connector to semantic data stores, such as Jena and Joseki.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email: mikael.lammentausta
|
12
|
-
homepage: http://
|
11
|
+
email: mikael.lammentausta@gmail.com
|
12
|
+
homepage: http://activerubic.rubyforge.org/
|
13
13
|
rubyforge_project: activerubic
|
14
|
-
description:
|
15
|
-
autorequire:
|
14
|
+
description:
|
15
|
+
autorequire: name
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: true
|
@@ -29,35 +29,47 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Mikael Lammentausta
|
31
31
|
files:
|
32
|
-
- History.txt
|
33
|
-
- Manifest.txt
|
34
|
-
- README.txt
|
35
|
-
- Rakefile
|
36
|
-
- bin/active_rubic
|
37
32
|
- lib/active_rubic.rb
|
38
|
-
-
|
39
|
-
|
40
|
-
-
|
41
|
-
|
42
|
-
-
|
33
|
+
- lib/active_rubic
|
34
|
+
- lib/active_rubic/cacher.rb
|
35
|
+
- lib/active_rubic/base.rb
|
36
|
+
- lib/active_rubinstein
|
37
|
+
- lib/active_rubinstein/deprecated
|
38
|
+
- lib/active_rubinstein/deprecated/base.rb
|
39
|
+
- lib/active_rubinstein/base.rb
|
40
|
+
- lib/active_rubinstein/lucene_searcher.rb
|
41
|
+
- lib/active_rubinstein/jena_query.rb
|
42
|
+
- lib/active_rubinstein/sparql_formulator.rb
|
43
|
+
- lib/active_rubinstein/joseki_query.rb
|
44
|
+
- lib/objectmanager
|
45
|
+
- lib/objectmanager/owl
|
46
|
+
- lib/objectmanager/owl/class.rb
|
47
|
+
- lib/objectmanager/owl/thing.rb
|
48
|
+
- lib/objectmanager/owl/object_property.rb
|
49
|
+
- lib/objectmanager/rdfs
|
50
|
+
- lib/objectmanager/rdfs/resource.rb
|
51
|
+
- lib/objectmanager/rdfs/image.rb
|
52
|
+
- lib/objectmanager/namespace.rb
|
43
53
|
- README.txt
|
54
|
+
test_files: []
|
55
|
+
|
56
|
+
rdoc_options: []
|
57
|
+
|
44
58
|
extra_rdoc_files:
|
45
|
-
- History.txt
|
46
|
-
- Manifest.txt
|
47
59
|
- README.txt
|
48
|
-
executables:
|
49
|
-
|
60
|
+
executables: []
|
61
|
+
|
50
62
|
extensions: []
|
51
63
|
|
52
64
|
requirements: []
|
53
65
|
|
54
66
|
dependencies:
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
68
|
+
name: activerdf
|
57
69
|
version_requirement:
|
58
70
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
59
71
|
requirements:
|
60
72
|
- - ">="
|
61
73
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
74
|
+
version: 1.6.8
|
63
75
|
version:
|
data/History.txt
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
== 0.8.0 / 2007-12-31
|
2
|
-
|
3
|
-
* This release supports Jena ja Lucene and operates with Rubinstein-0.88. Joseki support has been working reliably, but due to poor performance the model is left unmaintained.
|
4
|
-
|
5
|
-
* Only Ruby-1.8.6 and Rails-1.2.6 have been tested.
|
6
|
-
* See Rubinstein README for notes on JRuby versions.
|
7
|
-
|
8
|
-
== Earlier history:
|
9
|
-
0.78 changed library loading paths, rake is successful
|
10
|
-
0.77 raise errors when connection is not established
|
11
|
-
0.76 removed methods that contained schema data from objectmanager
|
12
|
-
0.75 compatibility with ActiveRDF-1.6.8; including the Namespace patch
|
13
|
-
0.74 cleanup and bug fixes
|
14
|
-
0.73 switch to RDFS::Resource model from sandbox wrapper RdfAbout
|
15
|
-
0.72 cleanup and bug fixes
|
16
|
-
0.71 including enhanced ActiveRubic children models.
|
17
|
-
0.70 major changes; introduction of method_missing, which deprecates
|
18
|
-
around 50% of the existing code while making it more efficient.
|
19
|
-
the code is now cleaner and easier to understand.
|
20
|
-
introduction of ActiveRubinstein::JenaQuery, ::JosekiQuery and
|
21
|
-
::LuceneSearcher with ActiveRubic::Cacher
|
22
|
-
0.60 getNearbyTargets to Lucene methods
|
23
|
-
0.59 getInverse method for properties
|
24
|
-
0.58 start ActiveRubinstein only in client mode
|
25
|
-
0.57 include MysqlCache + some bug fixes
|
26
|
-
0.56 model cleanup
|
27
|
-
0.55 fixed a major bug in Rubic; returned a Hash with an empty resultset.
|
28
|
-
the return value should be an empty Array in this case.
|
29
|
-
0.54 dropped the connection dependency if it is not within RUBIC_DATASTORES
|
30
|
-
0.53 markers from Jena honor the :limit parameter, but Jena cannot handle
|
31
|
-
limit in SPARQL. is this a bug in Jena or EVO from our side?
|
32
|
-
0.52 languages are read correctly from Jena
|
33
|
-
0.51 more coherent structure, rubic-debug is working. logging is improved.
|
34
|
-
0.50 much tweaking to get Jena working properly :)
|
35
|
-
0.43 basic jena-joseki connectivity in Rails
|
36
|
-
0.42 initial work to integrate into Rails. not working yet.
|
37
|
-
0.41 reading selectively from jena, joseki and mysql.
|
38
|
-
0.40 Molding app/models/rubic.rb into ActiveRubic and ActiveRubinstein
|
39
|
-
0.30 Relatively stable version -- sparql and graph handling, no proper logging
|
40
|
-
0.20 Rubic model
|
41
|
-
0.10 ActiveRubinstein model
|
data/Manifest.txt
DELETED
data/Rakefile
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
|
-
require './lib/active_rubic.rb'
|
6
|
-
|
7
|
-
Hoe.new('ActiveRubic', ActiveRubic::VERSION) do |p|
|
8
|
-
p.rubyforge_name = 'activerubic'
|
9
|
-
# p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
10
|
-
# p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
11
|
-
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
12
|
-
|
13
|
-
p.name = "activerubic"
|
14
|
-
p.version = "0.8.0"
|
15
|
-
p.author = "Mikael Lammentausta"
|
16
|
-
p.email = "mikael.lammentausta( at )gmail.com"
|
17
|
-
#p.homepage = "http://openlab.savonia-amk.fi/wiki/index.php/ActiveRubic"
|
18
|
-
#p.rubyforge_project = "activerubic"
|
19
|
-
#p.platform = Gem::Platform::RUBY
|
20
|
-
p.summary = "ActiveRubic is a C/JRuby connector to semantic data stores, such as Jena and Joseki, using ActiveRDF."
|
21
|
-
#p.add_dependency("activerdf", ">= 1.6.8")
|
22
|
-
|
23
|
-
#p.files = FileList["lib/**/*"].to_a
|
24
|
-
#p.require_path = "lib"
|
25
|
-
#p.autorequire = "name"
|
26
|
-
p.test_files = FileList["{test}/**/*test.rb"].to_a
|
27
|
-
|
28
|
-
#p.has_rdoc = true
|
29
|
-
#p.extra_rdoc_files = ["README.txt"]
|
30
|
-
p.remote_rdoc_dir = '' # Release to root
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
# vim: syntax=Ruby
|
data/bin/active_rubic
DELETED
File without changes
|
data/test/test_active_rubic.rb
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
# Author:: Mikael Lammentausta
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'active_rdf'
|
5
|
-
|
6
|
-
RUBINSTEIN_HOME = "/home/mikael/sematorio/trunk/Seamfora/Rubinstein"
|
7
|
-
RUBIC_HOME = "#{File.dirname(__FILE__)}/../lib/"
|
8
|
-
LOGDIR = "#{File.dirname(__FILE__)}/log/"
|
9
|
-
|
10
|
-
JDRB_SERVER = '192.168.0.11'
|
11
|
-
JDRB_PORT = '2002'
|
12
|
-
|
13
|
-
GEOLUCENE_SERVER = '192.168.0.11'
|
14
|
-
GEOLUCENE_PORT = '2003'
|
15
|
-
|
16
|
-
RUBIC_DATASTORES = :jena
|
17
|
-
|
18
|
-
require RUBINSTEIN_HOME + '/config/namespaces'
|
19
|
-
require RUBIC_HOME + 'active_rubic'
|
20
|
-
|
21
|
-
@@log.level = INFO
|
22
|
-
|
23
|
-
|
24
|
-
# require "/common"
|
25
|
-
# require 'federation/federation_manager'
|
26
|
-
# require 'queryengine/query'
|
27
|
-
# require "#{File.dirname(__FILE__)}/common"
|
28
|
-
|
29
|
-
class TestConnection < Test::Unit::TestCase
|
30
|
-
def test_jena
|
31
|
-
greeting = ActiveRubinstein::JenaQuery.hello
|
32
|
-
assert greeting.is_a?( String )
|
33
|
-
end
|
34
|
-
def test_truth
|
35
|
-
assert true
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class TestModels < Test::Unit::TestCase
|
40
|
-
@@resources = [
|
41
|
-
KUOPIO::kuopion_museo,
|
42
|
-
TOIMIJAT::snellman_j_v
|
43
|
-
]
|
44
|
-
@@classes = [
|
45
|
-
OWL::Class.new( KUOPIO::museot ),
|
46
|
-
# OWL::Class.new( KUOPIO::rakennukset ),
|
47
|
-
OWL::Class.new( KUOPIO::rautatieasemat ),
|
48
|
-
OWL::Class.new( KUOPIO::kulkuvaylat ),
|
49
|
-
OWL::Class.new( KUOPIO::leikkipaikat )
|
50
|
-
]
|
51
|
-
|
52
|
-
# def test_uri
|
53
|
-
# ( @@resources + @@classes ).each do |resource|
|
54
|
-
# assert !resource.uri.nil?
|
55
|
-
# assert resource.uri.is_a?( String )
|
56
|
-
# end
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# def test_label
|
60
|
-
# ( @@resources + @@classes ).flatten.each do |resource|
|
61
|
-
# assert resource.label.is_a?( Array )
|
62
|
-
# assert resource.labelize.is_a?( String )
|
63
|
-
# end
|
64
|
-
# end
|
65
|
-
#
|
66
|
-
# def test_types
|
67
|
-
# @@resources.each do |resource|
|
68
|
-
# assert !resource.is_class?
|
69
|
-
# assert !resource.is_property?
|
70
|
-
# types = resource.types
|
71
|
-
# assert types.is_a?( Array )
|
72
|
-
# types.each do |type|
|
73
|
-
# assert type.is_a?( RDFS::Resource )
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
# @@classes.each do |resource|
|
77
|
-
# assert resource.is_class?
|
78
|
-
# assert !resource.is_property?
|
79
|
-
# end
|
80
|
-
# end
|
81
|
-
#
|
82
|
-
# def test_properties
|
83
|
-
# ( @@resources + @@classes ).each do |resource|
|
84
|
-
# properties = resource.properties
|
85
|
-
# assert properties.is_a?( Array )
|
86
|
-
#
|
87
|
-
# # test a specific instance
|
88
|
-
# properties << KUOPIO::kuopion_museo.properties
|
89
|
-
# properties.flatten!
|
90
|
-
# assert !properties.empty?
|
91
|
-
#
|
92
|
-
# properties.each do |property|
|
93
|
-
# assert !property.uri.nil?
|
94
|
-
# assert property.is_a?( OWL::ObjectProperty )
|
95
|
-
#
|
96
|
-
# # test inverse
|
97
|
-
# inverse = property.inverse
|
98
|
-
# assert property.inverse.is_a?( OWL::ObjectProperty )
|
99
|
-
#
|
100
|
-
# # assert that the inverse of the inverse is the same
|
101
|
-
# # as the original property
|
102
|
-
# assert property.inverse.inverse.uri == property.uri
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
# end
|
106
|
-
#
|
107
|
-
# def test_property_domain_and_range
|
108
|
-
# # test cases:
|
109
|
-
# # TOIMIJAT::stromberg_johan KUOPIO::isDesignerOf KUOPIO::kuopion_museo
|
110
|
-
#
|
111
|
-
# test_designer = TOIMIJAT::stromberg_johan
|
112
|
-
# test_property = OWL::ObjectProperty.new( KUOPIO::isDesignerOf )
|
113
|
-
# assert test_property.is_a?( OWL::ObjectProperty )
|
114
|
-
# assert test_property.is_property?
|
115
|
-
# designers = test_property.domain
|
116
|
-
#
|
117
|
-
# # do a hard-coded check on the test_designer
|
118
|
-
# assert test_designer.range( test_property ).include?( KUOPIO::kuopion_museo )
|
119
|
-
#
|
120
|
-
# # all resources that are in the range of this property
|
121
|
-
# property_range = test_property.range
|
122
|
-
#
|
123
|
-
# # test that the designers are RDFS::Resources
|
124
|
-
# # and that the test_property is included in their properties
|
125
|
-
# designers.each do |designer|
|
126
|
-
# # STDERR.puts designer
|
127
|
-
# assert designer.is_a?( RDFS::Resource )
|
128
|
-
# assert designer.labelize.is_a?( String )
|
129
|
-
# assert designer.properties.include?( test_property )
|
130
|
-
#
|
131
|
-
# # check that the resources this designer has designed is included
|
132
|
-
# # in the property_range
|
133
|
-
# designer.range( test_property ).each do |designed_object|
|
134
|
-
# assert designed_object.is_a?( RDFS::Resource )
|
135
|
-
#
|
136
|
-
# # assert that the designed_object has the inverse property to
|
137
|
-
# # the test_property ( isDesignedBy )
|
138
|
-
# assert designed_object.properties.include?( test_property.inverse )
|
139
|
-
#
|
140
|
-
# # assert that this designer is actually the designer of this object
|
141
|
-
# object_designers = designed_object.range( test_property.inverse )
|
142
|
-
# assert object_designers.is_a?( Array )
|
143
|
-
# assert !object_designers.empty?
|
144
|
-
# assert object_designers.include?( designer )
|
145
|
-
#
|
146
|
-
# end
|
147
|
-
# end
|
148
|
-
# end
|
149
|
-
|
150
|
-
def test_recommendation_by_properties
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
end
|
155
|
-
#
|
156
|
-
#
|
157
|
-
# def test_images
|
158
|
-
# @@resources.each do |resource|
|
159
|
-
# images = resource.images
|
160
|
-
# assert images.is_a?( Array )
|
161
|
-
# if images.any?
|
162
|
-
# STDERR.puts "images found for #{resource}"
|
163
|
-
# images.each do |image|
|
164
|
-
# assert image.is_a?( Image )
|
165
|
-
# assert image.url.grep(/^http/).any?
|
166
|
-
# assert image.subjects.include?( resource )
|
167
|
-
# end
|
168
|
-
# end
|
169
|
-
# end
|
170
|
-
# end
|
171
|
-
|
172
|
-
# def test_geopoints
|
173
|
-
# @@resources.each do |resource|
|
174
|
-
# # STDERR.puts resource
|
175
|
-
# geopoint = resource.geopoint
|
176
|
-
# if geopoint
|
177
|
-
# # STDERR.puts "..is mappable"
|
178
|
-
# assert resource.is_mappable?
|
179
|
-
# assert geopoint.is_a?( RDFS::Resource )
|
180
|
-
# assert geopoint.lat != 0.0
|
181
|
-
# assert geopoint.long != 0.0
|
182
|
-
# else
|
183
|
-
# # STDERR.puts "..is not mappable"
|
184
|
-
# assert !resource.is_mappable?
|
185
|
-
# end
|
186
|
-
# end
|
187
|
-
#
|
188
|
-
# # test a specific instance that has a geopoint
|
189
|
-
# geopoint = KUOPIO::kuopion_museo
|
190
|
-
# STDERR.puts geopoint.labelize
|
191
|
-
# assert geopoint.is_mappable?
|
192
|
-
# assert geopoint.lat != 0.0
|
193
|
-
# assert geopoint.long != 0.0
|
194
|
-
#
|
195
|
-
# # test a specific instance, that gets the geopoint
|
196
|
-
# # through a property
|
197
|
-
# resource = TOIMIJAT::isa_camillo
|
198
|
-
# STDERR.puts resource.labelize
|
199
|
-
# assert resource.is_mappable?
|
200
|
-
# assert resource.lat != 0.0
|
201
|
-
# assert resource.long != 0.0
|
202
|
-
#
|
203
|
-
# # test a specific class
|
204
|
-
# owlclass = OWL::Class.new( KUOPIO::museot )
|
205
|
-
# assert owlclass.is_mappable?
|
206
|
-
# assert !owlclass.geopoints.empty?
|
207
|
-
#
|
208
|
-
# @@classes.each do |resource|
|
209
|
-
# STDERR.puts resource
|
210
|
-
# geopoints = resource.geopoints
|
211
|
-
# assert geopoints.is_a?( Array )
|
212
|
-
# if geopoints.any?
|
213
|
-
# STDERR.puts "..is mappable"
|
214
|
-
# assert resource.is_mappable?
|
215
|
-
# geopoints.each do |geopoint|
|
216
|
-
# assert geopoint.is_a?( RDFS::Resource )
|
217
|
-
# assert geopoint.labelize.is_a?( String )
|
218
|
-
# assert geopoint.lat != 0.0
|
219
|
-
# assert geopoint.long != 0.0
|
220
|
-
# assert geopoint.ancestors.include?( resource )
|
221
|
-
# end
|
222
|
-
# else
|
223
|
-
# STDERR.puts "..is not mappable"
|
224
|
-
# assert !resource.is_mappable?
|
225
|
-
# end
|
226
|
-
# end
|
227
|
-
# end
|
228
|
-
|
229
|
-
# def test_ancestors
|
230
|
-
# ( @@resources + @@classes ).each do |resource|
|
231
|
-
# ancestors = resource.ancestors
|
232
|
-
# assert ancestors.is_a?( Array )
|
233
|
-
# assert !ancestors.empty?
|
234
|
-
# ancestors.each do |ancestor|
|
235
|
-
# assert !ancestor.uri.nil?
|
236
|
-
# assert ancestor.is_a?( OWL::Class )
|
237
|
-
# # assert ancestor.is_class?
|
238
|
-
# end
|
239
|
-
# end
|
240
|
-
# end
|
241
|
-
#
|
242
|
-
# def test_parents
|
243
|
-
# ( @@resources + @@classes ).each do |resource|
|
244
|
-
# parents = resource.parents
|
245
|
-
# assert parents.is_a?( Array )
|
246
|
-
# assert !parents.empty?
|
247
|
-
# parents.each do |parent|
|
248
|
-
# assert !parent.uri.nil?
|
249
|
-
# assert parent.is_a?( OWL::Class )
|
250
|
-
# assert parent.is_class?
|
251
|
-
# assert resource.ancestors.include?( parent )
|
252
|
-
# end
|
253
|
-
# end
|
254
|
-
# end
|
255
|
-
#
|
256
|
-
# def test_children
|
257
|
-
# # add a specific class that definitely has children
|
258
|
-
# ( @@classes + [ OWL::Class.new( KUOPIO::rakennukset ) ] ).each do |resource|
|
259
|
-
# children = resource.children
|
260
|
-
# assert children.is_a?( Array )
|
261
|
-
# if children.any?
|
262
|
-
# children.each do |child|
|
263
|
-
# #STDERR.puts child
|
264
|
-
# assert !child.uri.nil?
|
265
|
-
# assert child.is_a?( OWL::Class )
|
266
|
-
# assert child.is_class?
|
267
|
-
# assert resource.descendants.include?( child )
|
268
|
-
# end
|
269
|
-
# end
|
270
|
-
# end
|
271
|
-
# end
|
272
|
-
#
|
273
|
-
# def test_descendants
|
274
|
-
# ( @@classes + [ OWL::Class.new( KUOPIO::rakennukset ) ] ).each do |resource|
|
275
|
-
# descendants = resource.descendants
|
276
|
-
# assert descendants.is_a?( Array )
|
277
|
-
# if descendants.any?
|
278
|
-
# descendants.each do |descendant|
|
279
|
-
# # STDERR.puts descendant
|
280
|
-
# assert !descendant.uri.nil?
|
281
|
-
# assert descendant.is_a?( OWL::Class )
|
282
|
-
# assert descendant.is_class?
|
283
|
-
# end
|
284
|
-
# end
|
285
|
-
# end
|
286
|
-
# end
|
287
|
-
#
|
288
|
-
# def test_class_instances
|
289
|
-
# @@classes.each do |resource|
|
290
|
-
# instances = resource.instances
|
291
|
-
# assert instances.is_a?( Array )
|
292
|
-
# assert !instances.empty?
|
293
|
-
# instances.each do |instance|
|
294
|
-
# assert !instance.uri.nil?
|
295
|
-
# assert instance.is_a?( RDFS::Resource )
|
296
|
-
# assert !instance.is_class?
|
297
|
-
# assert instance.ancestors.include?( resource )
|
298
|
-
# end
|
299
|
-
# end
|
300
|
-
# end
|
301
|
-
|
302
|
-
|
303
|
-
end
|
304
|
-
|
305
|
-
|