talia_core 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +41 -0
- data/bin/talia +33 -0
- data/lib/JXslt/jxslt.rb +60 -0
- data/lib/acts_as_roled.rb +11 -0
- data/lib/core_ext/platform.rb +9 -0
- data/lib/core_ext/string.rb +6 -0
- data/lib/core_ext.rb +1 -0
- data/lib/custom_template.rb +4 -0
- data/lib/loader_helper.rb +62 -0
- data/lib/mysql.rb +1214 -0
- data/lib/progressbar.rb +236 -0
- data/lib/role.rb +12 -0
- data/lib/talia_cl/command_line.rb +39 -0
- data/lib/talia_cl/commands/standalone/cl_options.rb +9 -0
- data/lib/talia_cl/commands/standalone/standalone_generate.rb +75 -0
- data/lib/talia_cl/commands/standalone.rb +25 -0
- data/lib/talia_cl/commands/talia_console/cl_options.rb +55 -0
- data/lib/talia_cl/commands/talia_console/console_commands.rb +37 -0
- data/lib/talia_cl/commands/talia_console/talia_commands.rb +131 -0
- data/lib/talia_cl/commands/talia_console.rb +47 -0
- data/lib/talia_cl/core_commands.rb +11 -0
- data/lib/talia_cl.rb +47 -0
- data/lib/talia_core/active_source.rb +372 -0
- data/lib/talia_core/active_source_parts/class_methods.rb +378 -0
- data/lib/talia_core/active_source_parts/predicate_handler.rb +89 -0
- data/lib/talia_core/active_source_parts/rdf.rb +131 -0
- data/lib/talia_core/active_source_parts/sql_helper.rb +36 -0
- data/lib/talia_core/active_source_parts/xml/base_builder.rb +47 -0
- data/lib/talia_core/active_source_parts/xml/generic_reader.rb +363 -0
- data/lib/talia_core/active_source_parts/xml/rdf_builder.rb +88 -0
- data/lib/talia_core/active_source_parts/xml/source_builder.rb +73 -0
- data/lib/talia_core/active_source_parts/xml/source_reader.rb +20 -0
- data/lib/talia_core/agent.rb +14 -0
- data/lib/talia_core/background_jobs/job.rb +82 -0
- data/lib/talia_core/background_jobs/progress_job.rb +68 -0
- data/lib/talia_core/collection.rb +13 -0
- data/lib/talia_core/data_types/data_loader.rb +92 -0
- data/lib/talia_core/data_types/data_record.rb +105 -0
- data/lib/talia_core/data_types/delayed_copier.rb +76 -0
- data/lib/talia_core/data_types/file_record.rb +59 -0
- data/lib/talia_core/data_types/file_store.rb +306 -0
- data/lib/talia_core/data_types/iip_data.rb +153 -0
- data/lib/talia_core/data_types/iip_loader.rb +127 -0
- data/lib/talia_core/data_types/image_data.rb +32 -0
- data/lib/talia_core/data_types/media_link.rb +19 -0
- data/lib/talia_core/data_types/mime_mapping.rb +45 -0
- data/lib/talia_core/data_types/path_helpers.rb +77 -0
- data/lib/talia_core/data_types/pdf_data.rb +42 -0
- data/lib/talia_core/data_types/simple_text.rb +36 -0
- data/lib/talia_core/data_types/temp_file_handling.rb +85 -0
- data/lib/talia_core/data_types/xml_data.rb +169 -0
- data/lib/talia_core/dc_resource.rb +20 -0
- data/lib/talia_core/dummy_handler.rb +34 -0
- data/lib/talia_core/dummy_source.rb +20 -0
- data/lib/talia_core/errors.rb +25 -0
- data/lib/talia_core/initializer.rb +427 -0
- data/lib/talia_core/ordered_source.rb +228 -0
- data/lib/talia_core/rails_ext/actionpack/action_controller/record_identifier.rb +13 -0
- data/lib/talia_core/rails_ext/actionpack/action_controller.rb +1 -0
- data/lib/talia_core/rails_ext/actionpack.rb +1 -0
- data/lib/talia_core/rails_ext.rb +1 -0
- data/lib/talia_core/rdf_import.rb +90 -0
- data/lib/talia_core/rdf_resource.rb +159 -0
- data/lib/talia_core/semantic_collection_item.rb +93 -0
- data/lib/talia_core/semantic_collection_wrapper.rb +324 -0
- data/lib/talia_core/semantic_property.rb +7 -0
- data/lib/talia_core/semantic_relation.rb +67 -0
- data/lib/talia_core/source.rb +323 -0
- data/lib/talia_core/source_transfer_object.rb +38 -0
- data/lib/talia_core/workflow/base.rb +15 -0
- data/lib/talia_core/workflow/publication_workflow.rb +62 -0
- data/lib/talia_core/workflow.rb +300 -0
- data/lib/talia_core.rb +9 -0
- data/lib/talia_dependencies.rb +12 -0
- data/lib/talia_util/bar_progressor.rb +15 -0
- data/lib/talia_util/configuration/config_file.rb +48 -0
- data/lib/talia_util/configuration/database_config.rb +40 -0
- data/lib/talia_util/configuration/mysql_database_setup.rb +104 -0
- data/lib/talia_util/data_import.rb +91 -0
- data/lib/talia_util/image_conversions.rb +82 -0
- data/lib/talia_util/import_job_helper.rb +132 -0
- data/lib/talia_util/io_helper.rb +54 -0
- data/lib/talia_util/progressable.rb +38 -0
- data/lib/talia_util/progressbar.rb +236 -0
- data/lib/talia_util/rdf_update.rb +80 -0
- data/lib/talia_util/some_sigla.xml +1960 -0
- data/lib/talia_util/test_helpers.rb +151 -0
- data/lib/talia_util/util.rb +226 -0
- data/lib/talia_util/yaml_import.rb +80 -0
- data/lib/talia_util.rb +13 -0
- data/lib/user.rb +116 -0
- data/lib/version.rb +15 -0
- data/test/core_ext/string_test.rb +11 -0
- data/test/custom_template_test.rb +8 -0
- data/test/talia_core/active_source_predicate_test.rb +54 -0
- data/test/talia_core/active_source_rdf_test.rb +89 -0
- data/test/talia_core/active_source_test.rb +631 -0
- data/test/talia_core/data_types/data_loader_test.rb +123 -0
- data/test/talia_core/data_types/data_record_test.rb +40 -0
- data/test/talia_core/data_types/file_record_test.rb +171 -0
- data/test/talia_core/data_types/iip_data_test.rb +130 -0
- data/test/talia_core/data_types/image_data_test.rb +88 -0
- data/test/talia_core/data_types/pdf_data_test.rb +68 -0
- data/test/talia_core/data_types/xml_data_test.rb +134 -0
- data/test/talia_core/generic_xml_test.rb +83 -0
- data/test/talia_core/initializer_test.rb +36 -0
- data/test/talia_core/ordered_source_test.rb +398 -0
- data/test/talia_core/rdf_resource_test.rb +115 -0
- data/test/talia_core/semantic_collection_item_test.rb +129 -0
- data/test/talia_core/source_reader_test.rb +33 -0
- data/test/talia_core/source_test.rb +484 -0
- data/test/talia_core/source_transfer_object_test.rb +24 -0
- data/test/talia_core/workflow/publication_workflow_test.rb +242 -0
- data/test/talia_core/workflow/user_class_for_workflow.rb +35 -0
- data/test/talia_core/workflow/workflow_base_test.rb +21 -0
- data/test/talia_core/workflow_test.rb +19 -0
- data/test/talia_util/import_job_helper_test.rb +46 -0
- data/test/test_helper.rb +68 -0
- metadata +262 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
# Load the helper class
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
3
|
+
|
4
|
+
module TaliaCore
|
5
|
+
|
6
|
+
# Test the ActiveSource
|
7
|
+
class ActiveSourceRdfTest < Test::Unit::TestCase
|
8
|
+
fixtures :active_sources, :semantic_properties, :semantic_relations
|
9
|
+
|
10
|
+
def setup
|
11
|
+
setup_once(:rdf_res) do
|
12
|
+
TaliaUtil::Util.flush_rdf
|
13
|
+
active_sources(:multirel).send(:create_rdf, :force) # Update the rdf
|
14
|
+
active_sources(:multirel).my_rdf
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_direct_predicates
|
19
|
+
assert_equal(3, @rdf_res.direct_predicates.size, "Elements #{@rdf_res.direct_predicates}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_accessor
|
23
|
+
props = @rdf_res['http://testvalue.org/multirel']
|
24
|
+
assert_equal(3, props.size)
|
25
|
+
assert(props.include?(active_sources(:testy)))
|
26
|
+
assert(props.include?(semantic_properties(:other_value).value), "Actually contains #{props}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_rel_remove
|
30
|
+
src = ActiveSource.new('http://as_test/rel_remover')
|
31
|
+
src[N::RDF.rew] << 'value'
|
32
|
+
src.save!
|
33
|
+
# Test that there is 1 element now
|
34
|
+
assert_equal(1, (vals = SemanticRelation.find(:all, :conditions => {'subject_id' => src.id })).size, "Expected 1 value, got [#{print_rels(vals)}]")
|
35
|
+
assert_equal(1, src.semantic_relations.size)
|
36
|
+
# Test if the element can be removed
|
37
|
+
src[N::RDF.rew].remove
|
38
|
+
assert_equal(0, (vals = SemanticRelation.find(:all, :conditions => {'subject_id' => src.id })).size, "Expected 0 values, got [#{print_rels(vals)}]")
|
39
|
+
assert_equal(0, src[N::RDF.rew].size)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_rdf_remove
|
43
|
+
src = ActiveSource.new('http://as_test/rdf_remove')
|
44
|
+
src[N::RDF.rew] << 'value'
|
45
|
+
src.save!
|
46
|
+
assert_equal(1, src.my_rdf[N::RDF.rew].size)
|
47
|
+
src[N::RDF.rew].remove
|
48
|
+
src.save!
|
49
|
+
assert_equal(0, src.my_rdf[N::RDF.rew].size)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_rdf_rewrite
|
53
|
+
src = ActiveSource.new('http://as_test/rdf_rewrite')
|
54
|
+
src[N::RDF.rew] << 'value'
|
55
|
+
src.save!
|
56
|
+
assert_equal(1, src.my_rdf[N::RDF.rew].size)
|
57
|
+
src[N::RDF.rew].remove
|
58
|
+
src[N::RDF.rew] << 'new value'
|
59
|
+
assert(1, src[N::RDF.rew].size)
|
60
|
+
src.save!
|
61
|
+
assert_equal(1, src.my_rdf[N::RDF.rew].size)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_rdf_staggered_save
|
65
|
+
src = ActiveSource.new('http://as_test/rdf_saving_test_advanced')
|
66
|
+
src[N::RDF.rew] << 'foo'
|
67
|
+
src.save!
|
68
|
+
src[N::RDF.rew] << 'bar'
|
69
|
+
src.save!
|
70
|
+
res = ActiveSource.find(src.uri)
|
71
|
+
assert_property(res[N::RDF.rew], 'foo', 'bar')
|
72
|
+
assert_equal(['foo', 'bar'], res.my_rdf[N::RDF.rew])
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_rdf_on_rewrite
|
76
|
+
src = ActiveSource.new('http://asrdf_test/test_update_rdf_rewrite')
|
77
|
+
src[N::RDF.something] << 'value1'
|
78
|
+
src.rewrite_attributes!('rdf:something' => ['value2', 'value3'])
|
79
|
+
assert_equal(src.my_rdf[N::RDF.something], [ 'value2', 'value3' ])
|
80
|
+
end
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
def print_rels(relations)
|
85
|
+
relations.collect { |relation| "<#{relation.subject.uri} - #{relation.predicate_uri} - #{relation.object.is_a?(ActiveSource) ? relation.object.uri : relation.object.value}> | " }
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|