talia_core 0.5.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/VERSION.yml +2 -2
  2. data/config/talia_core.yml.example +37 -35
  3. data/generators/talia_admin/templates/app/models/fake_source.rb +93 -0
  4. data/generators/talia_admin/templates/app/models/talia_collection.rb +13 -37
  5. data/generators/talia_base/talia_base_generator.rb +0 -1
  6. data/generators/talia_base/templates/app/controllers/custom_templates_controller.rb +2 -1
  7. data/generators/talia_base/templates/app/controllers/sources_controller.rb +1 -1
  8. data/generators/talia_base/templates/script/configure_talia +56 -73
  9. data/generators/talia_swicky/talia_swicky_generator.rb +18 -0
  10. data/generators/talia_swicky/templates/app/controllers/swicky_notebooks_controller.rb +111 -0
  11. data/generators/talia_swicky/templates/app/helpers/swicky_notebooks_helper.rb +29 -0
  12. data/generators/talia_swicky/templates/app/views/swicky_notebooks/index.builder +6 -0
  13. data/generators/talia_swicky/templates/app/views/swicky_notebooks/index.html.erb +10 -0
  14. data/generators/talia_swicky/templates/app/views/swicky_notebooks/show.html.erb +11 -0
  15. data/generators/talia_swicky/templates/test/fixtures/notebook.rdf +862 -0
  16. data/generators/talia_swicky/templates/test/functional/swicky_notebooks_controller_test.rb +44 -0
  17. data/lib/core_ext/boolean.rb +23 -0
  18. data/lib/core_ext/jdbc_rake_monkeypatch.rb +22 -0
  19. data/lib/core_ext/nil_class.rb +11 -0
  20. data/lib/core_ext/object.rb +34 -0
  21. data/lib/core_ext/string.rb +15 -0
  22. data/lib/custom_template.rb +3 -1
  23. data/lib/loader_helper.rb +16 -3
  24. data/lib/mysql.rb +7 -7
  25. data/lib/progressbar.rb +2 -2
  26. data/lib/swicky/exhibit_json/item.rb +129 -0
  27. data/lib/swicky/exhibit_json/item_collection.rb +129 -0
  28. data/lib/swicky/fragment.rb +0 -0
  29. data/lib/swicky/note.rb +7 -0
  30. data/lib/swicky/notebook.rb +78 -12
  31. data/lib/talia_core/active_source.rb +45 -13
  32. data/lib/talia_core/active_source_parts/class_methods.rb +154 -26
  33. data/lib/talia_core/active_source_parts/finders.rb +49 -26
  34. data/lib/talia_core/active_source_parts/predicate_handler.rb +71 -23
  35. data/lib/talia_core/active_source_parts/rdf/ntriples_reader.rb +13 -0
  36. data/lib/talia_core/active_source_parts/rdf/rdf_reader.rb +99 -0
  37. data/lib/talia_core/active_source_parts/rdf/rdfxml_reader.rb +12 -0
  38. data/lib/talia_core/active_source_parts/{rdf.rb → rdf_handler.rb} +52 -19
  39. data/lib/talia_core/active_source_parts/xml/generic_reader.rb +151 -260
  40. data/lib/talia_core/active_source_parts/xml/generic_reader_add_statements.rb +97 -0
  41. data/lib/talia_core/active_source_parts/xml/generic_reader_helpers.rb +88 -0
  42. data/lib/talia_core/active_source_parts/xml/generic_reader_import_statements.rb +239 -0
  43. data/lib/talia_core/active_source_parts/xml/rdf_builder.rb +14 -7
  44. data/lib/talia_core/active_source_parts/xml/source_builder.rb +7 -3
  45. data/lib/talia_core/active_source_parts/xml/source_reader.rb +17 -2
  46. data/lib/talia_core/collection.rb +192 -1
  47. data/lib/talia_core/data_types/data_loader.rb +88 -18
  48. data/lib/talia_core/data_types/data_record.rb +24 -2
  49. data/lib/talia_core/data_types/delayed_copier.rb +13 -3
  50. data/lib/talia_core/data_types/file_record.rb +24 -13
  51. data/lib/talia_core/data_types/file_store.rb +111 -94
  52. data/lib/talia_core/data_types/iip_data.rb +104 -23
  53. data/lib/talia_core/data_types/iip_loader.rb +102 -56
  54. data/lib/talia_core/data_types/image_data.rb +3 -1
  55. data/lib/talia_core/data_types/media_link.rb +4 -1
  56. data/lib/talia_core/data_types/mime_mapping.rb +65 -38
  57. data/lib/talia_core/data_types/path_helpers.rb +23 -17
  58. data/lib/talia_core/data_types/pdf_data.rb +9 -6
  59. data/lib/talia_core/data_types/simple_text.rb +5 -4
  60. data/lib/talia_core/data_types/xml_data.rb +53 -25
  61. data/lib/talia_core/dummy_handler.rb +3 -2
  62. data/lib/talia_core/errors.rb +13 -27
  63. data/lib/talia_core/initializer.rb +44 -4
  64. data/lib/talia_core/oai/active_source_model.rb +13 -6
  65. data/lib/talia_core/oai/active_source_oai_adapter.rb +13 -12
  66. data/lib/talia_core/rdf_import.rb +1 -1
  67. data/lib/talia_core/rdf_resource.rb +2 -1
  68. data/lib/talia_core/semantic_collection_wrapper.rb +143 -151
  69. data/lib/talia_core/semantic_property.rb +4 -0
  70. data/lib/talia_core/semantic_relation.rb +84 -33
  71. data/lib/talia_core/source.rb +45 -25
  72. data/lib/talia_core/source_fragment.rb +7 -0
  73. data/lib/talia_core/source_transfer_object.rb +3 -1
  74. data/lib/talia_core/source_types/agent.rb +16 -0
  75. data/lib/talia_core/source_types/dc_resource.rb +3 -3
  76. data/lib/talia_core/source_types/marcont_resource.rb +15 -0
  77. data/lib/talia_core/source_types/skos_concept.rb +17 -0
  78. data/lib/talia_dependencies.rb +1 -1
  79. data/lib/talia_util.rb +1 -1
  80. data/lib/talia_util/bar_progressor.rb +1 -1
  81. data/lib/talia_util/image_conversions.rb +8 -2
  82. data/lib/talia_util/import_job_helper.rb +40 -3
  83. data/lib/talia_util/io_helper.rb +15 -4
  84. data/lib/talia_util/progressable.rb +50 -1
  85. data/lib/talia_util/rake_tasks.rb +3 -21
  86. data/lib/talia_util/test_helpers.rb +6 -1
  87. data/lib/talia_util/util.rb +108 -27
  88. data/lib/talia_util/xml/base_builder.rb +28 -1
  89. data/lib/talia_util/xml/rdf_builder.rb +81 -5
  90. data/lib/tasks/talia_core_tasks.rake +2 -0
  91. data/test/core_ext/boolean_test.rb +26 -0
  92. data/test/core_ext/nil_class_test.rb +14 -0
  93. data/test/core_ext/object_test.rb +26 -0
  94. data/test/core_ext/string_test.rb +11 -0
  95. data/test/swicky/json_encoder_test.rb +51 -42
  96. data/test/swicky/notebook_test.rb +13 -6
  97. data/test/talia_core/active_source_finder_interface_test.rb +30 -0
  98. data/test/talia_core/active_source_test.rb +445 -34
  99. data/test/talia_core/collection_test.rb +332 -0
  100. data/test/talia_core/data_types/file_record_test.rb +2 -23
  101. data/test/talia_core/ntriples_reader_test.rb +49 -0
  102. data/test/talia_core/rdfxml_reader_test.rb +51 -0
  103. data/test/talia_core/source_test.rb +12 -0
  104. data/test/talia_util/import_job_helper_test.rb +19 -12
  105. metadata +190 -90
  106. data/config/database.yml +0 -19
  107. data/config/rdfstore.yml +0 -13
  108. data/config/talia_core.yml +0 -24
  109. data/generators/talia_base/templates/migrations/bj_migration.rb +0 -10
  110. data/lib/JXslt/jxslt.rb +0 -60
  111. data/lib/swicky/json_encoder.rb +0 -179
  112. data/lib/talia_core/agent.rb +0 -14
  113. data/lib/talia_core/background_jobs/job.rb +0 -82
  114. data/lib/talia_core/background_jobs/progress_job.rb +0 -68
  115. data/lib/talia_core/data_types/temp_file_handling.rb +0 -85
  116. data/lib/talia_core/ordered_source.rb +0 -228
  117. data/lib/talia_core/semantic_collection_item.rb +0 -94
  118. data/lib/talia_core/source_types/collection.rb +0 -15
  119. data/lib/talia_util/progressbar.rb +0 -236
  120. data/tasks/talia_core_tasks.rake +0 -2
  121. data/test/talia_core/ordered_source_test.rb +0 -394
  122. data/test/talia_core/semantic_collection_item_test.rb +0 -125
@@ -1,12 +1,28 @@
1
1
  module TaliaCore
2
+
3
+ # The basic class to represent a semantic relation, which is equivalent
4
+ # to an RDF triple.
5
+ #
6
+ # The predicate is directly contained in the record is a string, while
7
+ # the subject refers to respective ActiveSource object.
8
+ #
9
+ # The object of the relation refers either to another ActiveSource or
10
+ # to a SemanticProperty, depending on the object_type field. This is
11
+ # a normal polymorphic relation to the active_sources/semantic_properties
12
+ # table(s)
2
13
  class SemanticRelation < ActiveRecord::Base
3
14
 
4
15
  belongs_to :subject, :class_name => 'TaliaCore::ActiveSource'
5
16
  belongs_to :object, :polymorphic => true
6
17
  before_destroy :discard_property
18
+ before_destroy :destroy_dependent_object
19
+ before_save :check_for_object
7
20
 
8
21
  # Returns true if the Relation matches the given predicate URI (and value,
9
- # if given)
22
+ # if given). A relation matches if the predicate of this relation is
23
+ # them same as the predicate given (which can be a String or a Source or
24
+ # a N::URI) and if the object's value (or uri, if the object is a
25
+ # ActiveSource) is the same as the value given.
10
26
  def matches?(predicate, value = nil)
11
27
  if(value)
12
28
  if(value.is_a?(ActiveSource) || value.is_a?(SemanticProperty))
@@ -20,49 +36,84 @@ module TaliaCore
20
36
  end
21
37
  end
22
38
 
23
- class << self
24
-
25
- # Retrieve "fat" relations for the given source and property
26
- def find_fat_relations(source, predicate)
27
- joins = ActiveSource.sources_join
28
- joins << ActiveSource.props_join
29
- relations = SemanticRelation.find(:all, :conditions => {
30
- :subject_id => source.id,
31
- :predicate_uri => predicate
32
- },
33
- :joins => joins,
34
- :select => fat_record_select
35
- )
36
- relations
39
+ # Return the "value" of the relation. This is usually the same as #object,
40
+ # except that string values are parsed as PropertyString objects and that
41
+ # in case the "special type" is set the related resources are made to
42
+ # be objects of that type (see above).
43
+ def value
44
+ semprop = object.is_a?(SemanticProperty)
45
+ if(special_object_type)
46
+ assit(object, "Must have object for #{predicate_uri}")
47
+ raise(ArgumentError, 'Must not have a property for a typed item') if(semprop)
48
+ special_object_type.new(object.uri.to_s)
49
+ elsif(semprop)
50
+ # Plain, return the object or the value for SemanticProperties
51
+ object.value ? PropertyString.parse(object.value) : object.value
52
+ else
53
+ object
37
54
  end
38
-
39
- # For selecting "fat" records on the semantic properties
40
- def fat_record_select
41
- @select ||= begin
42
- select = 'semantic_relations.id AS id, semantic_relations.created_at AS created_at, '
43
- select << 'semantic_relations.updated_at AS updated_at, '
44
- select << 'semantic_relations.rel_order AS rel_order,'
45
- select << 'object_id, object_type, subject_id, predicate_uri, '
46
- select << 'obj_props.created_at AS property_created_at, '
47
- select << 'obj_props.updated_at AS property_updated_at, '
48
- select << 'obj_props.value AS property_value, '
49
- select << 'obj_sources.created_at AS object_created_at, '
50
- select << 'obj_sources.updated_at AS object_updated_at, obj_sources.type AS object_realtype, '
51
- select << 'obj_sources.uri AS object_uri'
52
- select
53
- end
55
+ end
56
+
57
+ # An item will be equal to its #value - this is a little hack that lets Enumerable#find and
58
+ # such methods work easily on collections of SemanticRelation.
59
+ #
60
+ # If compare is a SemanticRelation, this will be true if both relations have the same predicate
61
+ # value.
62
+ def ==(compare)
63
+ if(compare.is_a?(SemanticRelation))
64
+ (self.predicate_uri == compare.predicate_uri) && (self.value == compare.value)
65
+ else
66
+ self.value == compare
54
67
  end
55
-
68
+ end
69
+
70
+ # This will return the "object type" for the current relation. This can
71
+ # be used to "force" a relation for some predicates.
72
+ #
73
+ # This will check if an entry exists for the current predicate has an
74
+ # entry in #special_types. If yes, the class will be returned.
75
+ #
76
+ # If object_type returns a class, the #value method will return objects
77
+ # of that class for all resources.
78
+ #
79
+ # The default case is that this returns nil, which will cause #value
80
+ # to return the actual "object" value for relations to resources.
81
+ def special_object_type
82
+ self.class.special_types[predicate_uri]
83
+ end
84
+
85
+ # Simple hash that checks if a type if property requires "special" handling
86
+ # This will cause the wrapper to accept ActiveSource relations and all
87
+ # sources will be casted to the given type
88
+ def self.special_types
89
+ @special_types ||= {
90
+ N::RDF.type.to_s => N::SourceClass
91
+ }
56
92
  end
57
93
 
58
94
  private
59
95
 
60
- # Discards the "value" property that belongs to this source
96
+ # If the object of this relation is a SemanticProperty, it will
97
+ # be deleted from the database by this method.
61
98
  def discard_property
62
99
  if(object.is_a?(SemanticProperty))
63
100
  SemanticProperty.delete(object.id)
64
101
  end
65
102
  end
103
+
104
+ def destroy_dependent_object
105
+ object.destroy if(object.is_a?(ActiveSource) && subject.property_options_for(predicate_uri)[:dependent] == :destroy)
106
+ end
107
+
108
+ # Called on save, this will check if the "same" object already exists in the database.
109
+ # If yes, it will use the version from the database instead of the one currently attached,
110
+ # since a "new" source with an existing URI cannot be saved.
111
+ def check_for_object
112
+ if(self.object.new_record? && self.object.is_a?(ActiveSource))
113
+ existing = ActiveSource.find(:first, :conditions => { :uri => self.object.uri.to_s })
114
+ self.object = (existing || self.object)
115
+ end
116
+ end
66
117
 
67
118
  end
68
119
  end
@@ -7,20 +7,23 @@ require 'rdf_resource'
7
7
 
8
8
  module TaliaCore
9
9
 
10
- # This represents a Source in the Talia core system.
10
+ # Base class for most sources in the Talia system. The Source class has some
11
+ # additional features over the basic ActiveSource class.
11
12
  #
12
- # Since data for the Source exists both in the database and in the RDF store, the
13
- # handling/saving of data is a bit peculiar at the moment (subject to change in the future):
13
+ # Most importantly, it contains the "smart" accessor in the same style as
14
+ # ActiveRDF:
14
15
  #
15
- # * When a new Source is created, no data is saved
16
- # * RDF properties *cannot* be written until the Source has been saved for the first time
17
- # * Database properties are *only* written when the save method is called
18
- # * RDF properties are written immediately when they are assigned
19
- # * To ensure that the data is written, the save method should be called as
20
- # necessary.
16
+ # source.rdf::something
17
+ # => SemanticCollection Wrapper
18
+ #
19
+ # # is the same as:
20
+ # source[N::RDF.something]
21
+ #
22
+ # There are also
21
23
  class Source < ActiveSource
22
24
  # FIXME: Remove methods for old admin panel
23
25
 
26
+ # FIXME: Remove workflow?
24
27
  has_one :workflow, :class_name => 'TaliaCore::Workflow::Base', :dependent => :destroy
25
28
 
26
29
  # The uri will be wrapped into an object
@@ -64,11 +67,11 @@ module TaliaCore
64
67
  joins << "LEFT JOIN active_sources AS t_sources ON semantic_relations.object_id = t_sources.id AND semantic_relations.object_type = 'TaliaCore::ActiveSource' "
65
68
  joins << "LEFT JOIN semantic_properties ON semantic_relations.object_id = semantic_properties.id AND semantic_relations.object_type = 'TaliaCore::SemanticProperty' "
66
69
 
67
- property = uri_string_for(property)
70
+ property = uri_string_for(property, false)
68
71
  results = {}
69
72
  for val in values
70
73
  find(:all )
71
- val_str = uri_string_for(val)
74
+ val_str = uri_string_for(val, false)
72
75
  find_parms = params.merge(
73
76
  :conditions => ['semantic_properties.value = ? OR t_sources.uri = ?', val_str, val_str],
74
77
  :joins => joins
@@ -88,13 +91,16 @@ module TaliaCore
88
91
  #
89
92
  # ActiveSource.find_or_instantiate_by_uri('http://talia.org/unexistent', 'Foo Bar')
90
93
  # # => #<TaliaCore::ActiveSource id: nil, uri: "http://talia.org/Foo_Bar">
91
- def self.find_or_instantiate_by_uri(uri, local_name)
94
+ #
95
+ # TODO: Delete this/old backend method?
96
+ def self.find_or_instantiate_by_uri(uri, local_name) # :nodoc:
92
97
  result = find_by_uri(uri)
93
98
  result ||= self.new(N::LOCAL.to_s + local_name.to_permalink)
94
99
  end
95
100
 
96
101
  # Return an hash of direct predicates, grouped by namespace.
97
- def grouped_direct_predicates
102
+ # TODO: Delete this/old backend method?
103
+ def grouped_direct_predicates # :nodoc:
98
104
  #TODO should it be memoized?
99
105
  direct_predicates.inject({}) do |result, predicate|
100
106
  predicates = self[predicate].collect { |p| SourceTransferObject.new(p.to_s) }
@@ -106,22 +112,25 @@ module TaliaCore
106
112
  end
107
113
  end
108
114
 
115
+ # TODO: Delete this/old backend method?
109
116
  def predicate_objects(namespace, name) #:nodoc:
110
117
  predicate(namespace, name).values.flatten.map(&:to_s)
111
118
  end
112
119
 
113
120
  # Check if the current source is related with the given rdf object (triple endpoint).
114
- def associated?(namespace, name, stringified_predicate)
121
+ # TODO: Delete this/old backend method?
122
+ def associated?(namespace, name, stringified_predicate) # :nodoc:
115
123
  predicate_objects(namespace, name).include?(stringified_predicate)
116
124
  end
117
125
 
118
- # Check if a predicate is changed.
119
- def predicate_changed?(namespace, name, objects)
126
+ # Check if a predicate is changed. TODO: Delete this/old backend method?
127
+ def predicate_changed?(namespace, name, objects) # :nodoc:
120
128
  not predicate_objects(namespace, name).eql?(objects.map(&:to_s))
121
129
  end
122
130
 
123
- attr_reader :predicates_attributes
124
- def predicates_attributes=(predicates_attributes)
131
+ # TODO: Delete this/old backend method?
132
+ attr_reader :predicates_attributes # :nodoc:
133
+ def predicates_attributes=(predicates_attributes) # :nodoc:
125
134
  @predicates_attributes = predicates_attributes.collect do |attributes_hash|
126
135
  attributes_hash['object'] = instantiate_source_or_rdf_object(attributes_hash)
127
136
  attributes_hash
@@ -129,7 +138,8 @@ module TaliaCore
129
138
  end
130
139
 
131
140
  # Return an hash of new predicated attributes, grouped by namespace.
132
- def grouped_predicates_attributes
141
+ # TODO: Delete this/old backend method?
142
+ def grouped_predicates_attributes # :nodoc:
133
143
  @grouped_predicates_attributes ||= predicates_attributes.inject({}) do |result, predicate|
134
144
  namespace, name = predicate['namespace'], predicate['name']
135
145
  predicate = SourceTransferObject.new(predicate['titleized'])
@@ -140,8 +150,9 @@ module TaliaCore
140
150
  end
141
151
  end
142
152
 
143
- # Save, associate/disassociate given predicates attributes.
144
- def save_predicates_attributes
153
+ # Save, associate/disassociate given predicates attributes. TODO: Delete this/
154
+ # old backend method?
155
+ def save_predicates_attributes # :nodoc:
145
156
  each_predicate do |namespace, name, objects|
146
157
  objects.each { |object| object.save if object.is_a?(Source) && object.new_record? }
147
158
  self.predicate_replace(namespace, name, objects.to_s) if predicate_changed?(namespace, name, objects)
@@ -182,10 +193,16 @@ module TaliaCore
182
193
  value.is_a?(Source) && (value.uri == uri)
183
194
  end
184
195
 
196
+ # See Source.normalize_uri
185
197
  def normalize_uri(uri, label = '')
186
198
  self.class.normalize_uri(uri, label)
187
199
  end
188
200
 
201
+ # Returns the Collection (or collections) this source is in.
202
+ def collections
203
+ Collection.find(:all, :find_through => [N::DCT.hasPart, self])
204
+ end
205
+
189
206
  protected
190
207
 
191
208
  # Look at the given attributes and choose to instantiate
@@ -202,7 +219,9 @@ module TaliaCore
202
219
  #
203
220
  # http://springfield.org/Homer_Simpson
204
221
  # # => Should instantiate a source with the given uri
205
- def instantiate_source_or_rdf_object(attributes)
222
+ #
223
+ # TODO: Delete this/old backend method?
224
+ def instantiate_source_or_rdf_object(attributes) # :nodoc:
206
225
  name_or_uri = attributes['titleized']
207
226
  if /^\"[\w\s\d]+\"$/.match name_or_uri
208
227
  name_or_uri[1..-2]
@@ -216,7 +235,8 @@ module TaliaCore
216
235
  end
217
236
 
218
237
  # Iterate through grouped_predicates_attributes, yielding the given code.
219
- def each_predicate(&block)
238
+ # TODO: Delete this/old backend method?
239
+ def each_predicate(&block) # :nodoc:
220
240
  grouped_predicates_attributes.each do |namespace, predicates|
221
241
  predicates.each do |predicate, objects|
222
242
  block.call(namespace, predicate, objects.flatten)
@@ -246,10 +266,10 @@ module TaliaCore
246
266
 
247
267
 
248
268
  # Missing methods: This just check if the given method corresponds to a
249
- # registered namespace. If yes, this will return a "dummy" handler that
269
+ # registered namespace. If yes, this will return a DummyHandler that
250
270
  # allows access to properties.
251
271
  #
252
- # This will allow invocations as namespace::name
272
+ # This will allow invocations such as namespace::name
253
273
  def method_missing(method_name, *args)
254
274
  # TODO: Add permission checking for all updates to the model
255
275
  # TODO: Add permission checking for read access?
@@ -0,0 +1,7 @@
1
+ module TaliaCore
2
+
3
+ # A fragment is a "virtual" entitity that describes a part of a source.
4
+ class SourceFragment
5
+ end
6
+
7
+ end
@@ -7,7 +7,9 @@ module TaliaCore #:nodoc:
7
7
  #
8
8
  # http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
9
9
  # http://java.sun.com/blueprints/patterns/TransferObject.html
10
- class SourceTransferObject
10
+ #
11
+ # TODO: Remove as part of old admin interface?
12
+ class SourceTransferObject # :nodoc:
11
13
  attr_reader :uri
12
14
 
13
15
  def initialize(name_or_uri) #:nodoc:
@@ -0,0 +1,16 @@
1
+ module TaliaCore
2
+ module SourceTypes
3
+
4
+ # Some item that "has the power to act". This can either be a person or another
5
+ # entity, like an institution or a corporation
6
+ class Agent < Source
7
+
8
+ has_rdf_type N::DCT.Agent
9
+
10
+ singular_property :name, N::DCNS.title
11
+ singular_property :description, N::DCNS.description
12
+
13
+ end
14
+
15
+ end
16
+ end
@@ -7,12 +7,12 @@ module TaliaCore
7
7
 
8
8
  # General metadata
9
9
  singular_property :identifier, N::DCNS.identifier
10
- simple_property :creators, N::DCNS.creator
10
+ multi_property :creators, N::DCNS.creator
11
11
  singular_property :date, N::DCNS.date
12
12
  singular_property :description, N::DCNS.description
13
- simple_property :publishers, N::DCNS.publisher
13
+ multi_property :publishers, N::DCNS.publisher
14
14
  singular_property :language, N::DCNS.language
15
- simple_property :dc_subjects, N::DCNS.subject
15
+ multi_property :dc_subjects, N::DCNS.subject
16
16
  singular_property :rights, N::DCNS.rights
17
17
  singular_property :title, N::DCNS.title
18
18
 
@@ -0,0 +1,15 @@
1
+ module TaliaCore
2
+ module SourceTypes
3
+
4
+ # A generic SKOS concept. This means that this source represents an entry in
5
+ # a taxonomy, thesaurus or the like.
6
+ #
7
+ # TODO: Stub class at the moment
8
+ class MarcontResource < Source
9
+
10
+ has_rdf_type N::MARCONT.Resource
11
+
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module TaliaCore
2
+ module SourceTypes
3
+
4
+ # A generic SKOS concept. This means that this source represents an entry in
5
+ # a taxonomy, thesaurus or the like.
6
+ #
7
+ # TODO: Stub class at the moment
8
+ class SkosConcept < Source
9
+
10
+ N::SKOS.Concept
11
+
12
+ singular_property :pref_label, N::SKOS.prefLabel
13
+
14
+ end
15
+
16
+ end
17
+ end
@@ -2,7 +2,7 @@
2
2
  require File.dirname(__FILE__) + '/loader_helper'
3
3
 
4
4
  # This is also needed for local loading
5
- RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
5
+ RAILS_GEM_VERSION = '2.3.10' unless defined? RAILS_GEM_VERSION
6
6
 
7
7
  # Stuff we may need to load from sources/uninstalled versions
8
8
  TLoad::require_module("assit", "assit", "/../../assit") unless(defined?(assit))
@@ -4,7 +4,7 @@ require File.join(File.dirname(__FILE__), 'talia_dependencies')
4
4
  require 'core_ext'
5
5
  require 'talia_core/rdf_import'
6
6
  require 'talia_util/rdf_update'
7
- require 'talia_util/progressbar'
7
+ require 'progressbar'
8
8
 
9
9
  # Stuff we just load from the gems
10
10
  gem "builder"
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'progressbar')
1
+ require File.join(File.dirname(__FILE__), '..', 'progressbar')
2
2
 
3
3
  module TaliaUtil
4
4
 
@@ -6,6 +6,9 @@ module TaliaUtil
6
6
  #
7
7
  # Since it calls the command line, it should be compatible both with JRuby
8
8
  # and plain Ruby.
9
+ #
10
+ # See TaliaCore::Intializer for the options that can be set for the
11
+ # image conversions
9
12
  class ImageConversions
10
13
 
11
14
  class << self
@@ -43,10 +46,12 @@ module TaliaUtil
43
46
  end
44
47
  end
45
48
 
46
- # Create the thumbnail by running the configured creation command.
49
+ # Create the thumbnail by running the configured creation command. Options are
50
+ # taken from <tt>talia_core.yml</tt>
47
51
  def create_thumb(source, destination)
48
52
  thumbnail_size = "#{thumb_options['width']}x#{thumb_options['height']}"
49
- thumbnail_command = "#{convert_command} \"#{source}\" -quality 85 -thumbnail \"#{thumbnail_size}>\" -background transparent -gravity center -extent #{thumbnail_size} \"#{destination}\""
53
+ thumbnail_force = %w(true yes).include?(thumb_options['force']) ? "-background transparent -gravity center -extent #{thumbnail_size}" : ''
54
+ thumbnail_command = "#{convert_command} \"#{source}\" -quality 85 -thumbnail \"#{thumbnail_size}>\" #{thumbnail_force} \"#{destination}\""
50
55
  execute_command(thumbnail_command, destination)
51
56
  end
52
57
 
@@ -54,6 +59,7 @@ module TaliaUtil
54
59
  # command. This automatically creates the file in the correct location
55
60
  # (IIP root)
56
61
  def create_pyramid(source, destination)
62
+ # TODO: Options not configurable
57
63
  pyramid_command = "#{vips_command} im_vips2tiff \"#{source}\" \"#{destination}\":jpeg:85,tile:256x256,pyramid"
58
64
  execute_command(pyramid_command, destination)
59
65
  end