active-fedora 9.0.0.beta2 → 9.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/config/jetty.yml +1 -1
  3. data/lib/active_fedora.rb +11 -3
  4. data/lib/active_fedora/associations/association_scope.rb +2 -2
  5. data/lib/active_fedora/associations/belongs_to_association.rb +2 -2
  6. data/lib/active_fedora/associations/collection_association.rb +13 -13
  7. data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +2 -2
  8. data/lib/active_fedora/associations/rdf.rb +2 -2
  9. data/lib/active_fedora/cleaner.rb +2 -6
  10. data/lib/active_fedora/fedora.rb +18 -0
  11. data/lib/active_fedora/fedora_attributes.rb +4 -4
  12. data/lib/active_fedora/file.rb +7 -0
  13. data/lib/active_fedora/fixity_service.rb +9 -1
  14. data/lib/active_fedora/indexing_service.rb +2 -7
  15. data/lib/active_fedora/loadable_from_json.rb +4 -0
  16. data/lib/active_fedora/om_datastream.rb +0 -4
  17. data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
  18. data/lib/active_fedora/query_result_builder.rb +56 -0
  19. data/lib/active_fedora/querying.rb +1 -1
  20. data/lib/active_fedora/rdf.rb +2 -1
  21. data/lib/active_fedora/rdf/fcrepo.rb +323 -9
  22. data/lib/active_fedora/rdf/fcrepo4.rb +7 -0
  23. data/lib/active_fedora/rdf/indexing.rb +1 -1
  24. data/lib/active_fedora/rdf/project_hydra.rb +12 -0
  25. data/lib/active_fedora/reflection.rb +4 -1
  26. data/lib/active_fedora/relation/finder_methods.rb +4 -4
  27. data/lib/active_fedora/simple_datastream.rb +11 -12
  28. data/lib/active_fedora/solr_instance_loader.rb +1 -1
  29. data/lib/active_fedora/solr_query_builder.rb +57 -0
  30. data/lib/active_fedora/solr_service.rb +22 -48
  31. data/lib/active_fedora/version.rb +1 -1
  32. data/lib/active_fedora/versionable.rb +12 -13
  33. data/spec/integration/associations_spec.rb +6 -6
  34. data/spec/integration/attributes_spec.rb +22 -6
  35. data/spec/integration/base_spec.rb +2 -2
  36. data/spec/integration/collection_association_spec.rb +9 -0
  37. data/spec/integration/file_spec.rb +30 -0
  38. data/spec/integration/full_featured_model_spec.rb +1 -1
  39. data/spec/integration/ntriples_datastream_spec.rb +5 -5
  40. data/spec/integration/om_datastream_spec.rb +1 -1
  41. data/spec/integration/{solr_service_spec.rb → query_result_builder_spec.rb} +5 -7
  42. data/spec/integration/relation_delegation_spec.rb +3 -3
  43. data/spec/integration/scoped_query_spec.rb +11 -11
  44. data/spec/integration/solr_instance_loader_spec.rb +8 -0
  45. data/spec/integration/versionable_spec.rb +32 -14
  46. data/spec/unit/base_spec.rb +3 -3
  47. data/spec/unit/indexing_service_spec.rb +2 -2
  48. data/spec/unit/ntriples_datastream_spec.rb +16 -16
  49. data/spec/unit/om_datastream_spec.rb +7 -7
  50. data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
  51. data/spec/unit/query_result_builder_spec.rb +39 -0
  52. data/spec/unit/query_spec.rb +2 -2
  53. data/spec/unit/rdf_vocab_spec.rb +30 -0
  54. data/spec/unit/simple_datastream_spec.rb +2 -2
  55. data/spec/unit/solr_config_options_spec.rb +1 -1
  56. data/spec/unit/solr_query_builder_spec.rb +20 -0
  57. data/spec/unit/solr_service_spec.rb +2 -53
  58. metadata +11 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d60ea93eeb279f9295e64e08e725c95cf5bea026
4
- data.tar.gz: 625d2f73009486e3d60b2491a81589f13b11ab4c
3
+ metadata.gz: 380da0e904e671fecd1e7cc340a7ff9e7e43ca89
4
+ data.tar.gz: 01155eab5f9d0480eefc945636a17c48707ddae7
5
5
  SHA512:
6
- metadata.gz: d438e3f43b8b128c721fb4c984ecce6fb8d250fa473ec85e586b51913f2fd27105a74bb8773249e74028c1955d6e882469acf6af2708d35526ab21328c034f6e
7
- data.tar.gz: 0a7739691a954a784416251ec56322e7ce3ade16b7387d1d7c1476dcc6141dc54f545a4218f438e18c3c26e0f48b6aa3c4de5590af2a6b2fdc7ea88544094e0d
6
+ metadata.gz: 33fe88b57b1e02b8173754cbbac2a722f364b33d119375f2a3c1b1a44229040c779938896ac3abd15a58ef0647b591346fe161ab10b1f7e89b076a1f12d52929
7
+ data.tar.gz: a7b51616edde2428ac50bd8721f82d7db76e70d1532e02613b31e06e20a1b54d1d15826993d98763d3e592c78bc49953090b45805d9596b9dc6f618534f59f27
@@ -2,5 +2,5 @@ default:
2
2
  startup_wait: 90
3
3
  jetty_port: 8983
4
4
  java_opts:
5
- - "-Xmx256m"
5
+ - "-Xmx512m"
6
6
  - "-XX:MaxPermSize=128m"
@@ -19,12 +19,16 @@ module RDF
19
19
  class Literal
20
20
  class DateTime < Literal
21
21
  ALTERNATIVE_FORMAT = '%Y-%m-%dT%H:%M:%S'.freeze
22
+ DOT = '.'.freeze
23
+ Z = 'Z'.freeze
24
+ EMPTY = ''.freeze
22
25
 
23
26
  def to_s
24
27
  @string ||= begin
25
- nano = @object.strftime('%N').sub(/0+\Z/, '')
26
- nano = '.' + nano unless nano.blank?
27
- @object.strftime(ALTERNATIVE_FORMAT) + nano + 'Z'
28
+ # Show nanoseconds but remove trailing zeros
29
+ nano = @object.strftime('%N').sub(/0+\Z/, EMPTY)
30
+ nano = DOT + nano unless nano.blank?
31
+ @object.strftime(ALTERNATIVE_FORMAT) + nano + Z
28
32
  end
29
33
  end
30
34
  end
@@ -69,6 +73,7 @@ module ActiveFedora #:nodoc:
69
73
  autoload :Persistence
70
74
  autoload :QualifiedDublinCoreDatastream
71
75
  autoload :Querying
76
+ autoload :QueryResultBuilder
72
77
  autoload :RDF
73
78
  autoload_under 'rdf' do
74
79
  autoload :RDFDatastream
@@ -91,6 +96,7 @@ module ActiveFedora #:nodoc:
91
96
  autoload :Serialization
92
97
  autoload :SimpleDatastream
93
98
  autoload :SolrInstanceLoader
99
+ autoload :SolrQueryBuilder
94
100
  autoload :SolrService
95
101
  autoload :SparqlInsert
96
102
  autoload :Predicates
@@ -151,6 +157,7 @@ module ActiveFedora #:nodoc:
151
157
  SolrService.reset!
152
158
  Predicates.predicate_config = nil
153
159
  configurator.init(options)
160
+ fedora.init_base_path
154
161
  end
155
162
 
156
163
  def config
@@ -224,6 +231,7 @@ module ActiveFedora #:nodoc:
224
231
  end
225
232
  end
226
233
  end
234
+
227
235
  end
228
236
 
229
237
  self.configurator ||= ActiveFedora::FileConfigurator.new
@@ -22,10 +22,10 @@ module ActiveFedora
22
22
  chain.each_with_index do |reflection, i|
23
23
  if reflection.source_macro == :belongs_to
24
24
  # Create a partial solr query using the ids. We may add additional filters such as class_name later
25
- scope = scope.where( ActiveFedora::SolrService.construct_query_for_ids([owner[reflection.foreign_key]]))
25
+ scope = scope.where( ActiveFedora::SolrQueryBuilder.construct_query_for_ids([owner[reflection.foreign_key]]))
26
26
  elsif reflection.source_macro == :has_and_belongs_to_many
27
27
  else
28
- scope = scope.where( ActiveFedora::SolrService.construct_query_for_rel(association.send(:find_predicate) => owner.id))
28
+ scope = scope.where( ActiveFedora::SolrQueryBuilder.construct_query_for_rel(association.send(:find_reflection) => owner.id))
29
29
  end
30
30
 
31
31
  is_first_chain = i == 0
@@ -42,8 +42,8 @@ module ActiveFedora
42
42
  candidate_classes = klass.descendants.select {|d| d.name }
43
43
  candidate_classes += [klass] unless klass == ActiveFedora::Base
44
44
  model_pairs = candidate_classes.inject([]) { |arr, klass| arr << [:has_model, klass.to_class_uri]; arr }
45
- '(' + ActiveFedora::SolrService.construct_query_for_ids(ids) + ') AND (' +
46
- ActiveFedora::SolrService.construct_query_for_rel(model_pairs, 'OR') + ')'
45
+ '(' + ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids) + ') AND (' +
46
+ ActiveFedora::SolrQueryBuilder.construct_query_for_rel(model_pairs, 'OR') + ')'
47
47
  end
48
48
 
49
49
  def foreign_key_present?
@@ -8,7 +8,6 @@ module ActiveFedora
8
8
  construct_query
9
9
  end
10
10
 
11
-
12
11
  # Implements the reader method, e.g. foo.items for Foo.has_many :items
13
12
  # @param opts [Boolean, Hash] if true, force a reload
14
13
  # @option opts [Symbol] :response_format can be ':solr' to return a solr result.
@@ -264,7 +263,7 @@ module ActiveFedora
264
263
  def find_target
265
264
  # TODO: don't reify, just store the solr results and lazily reify.
266
265
  # For now, we set a hard limit of 1000 results.
267
- records = ActiveFedora::SolrService.reify_solr_results(load_from_solr(rows: 1000))
266
+ records = ActiveFedora::QueryResultBuilder.reify_solr_results(load_from_solr(rows: 1000))
268
267
  records.each { |record| set_inverse_instance(record) }
269
268
  records
270
269
  end
@@ -332,37 +331,38 @@ module ActiveFedora
332
331
  def construct_query
333
332
 
334
333
  #TODO use primary_key instead of id
335
- clauses = {find_predicate.to_s => @owner.id}
334
+ clauses = { find_reflection => @owner.id }
336
335
  clauses[:has_model] = @reflection.class_name.constantize.to_class_uri if @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base'
337
- @counter_query = @finder_query = ActiveFedora::SolrService.construct_query_for_rel(clauses)
336
+ @counter_query = @finder_query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(clauses)
338
337
  end
339
338
 
340
339
 
341
340
  private
342
341
 
343
- def find_predicate
344
- if @reflection.options[:predicate]
345
- reflection.predicate.to_s
346
- elsif @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base' && @reflection.macro != :has_and_belongs_to_many
342
+ def find_reflection
343
+ return reflection if @reflection.options[:predicate]
344
+ if @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base' && @reflection.macro != :has_and_belongs_to_many
347
345
  inverse_relation = @owner.class.to_s.underscore.to_sym
348
346
  begin
349
- find_class_for_relation(@reflection.class_name.constantize)
347
+ find_reflection_for_relation(@reflection.class_name.constantize)
350
348
  rescue NameError
351
349
  raise "No :predicate attribute was set or could be inferred for #{@reflection.macro} #{@reflection.name.inspect} on #{@owner.class}"
352
350
  end
351
+ else
352
+ raise "Couldn't find reflection"
353
353
  end
354
354
  end
355
355
 
356
- def find_class_for_relation(klass, inverse_relation=@owner.class.to_s.underscore.to_sym)
356
+ def find_reflection_for_relation(klass, inverse_relation=@owner.class.to_s.underscore.to_sym)
357
357
  raise "Unable to lookup the :predicate attribute for #{@reflection.macro} #{@reflection.name.inspect} on #{@owner.class} because #{klass} specifies \"class_name: 'ActiveFedora::Base'\". Either specify a specific class_name in #{klass} or set :predicate in the #{@reflection.macro} declaration on #{@owner.class}" if inverse_relation == :'active_fedora/base'
358
358
  if klass.reflections.key?(inverse_relation)
359
359
  # Try it singular
360
- return klass.reflections[inverse_relation].predicate
360
+ return klass.reflections[inverse_relation]
361
361
  elsif klass.reflections.key?(inverse_relation.to_s.pluralize.to_sym)
362
362
  # Try it plural
363
- return klass.reflections[inverse_relation.to_s.pluralize.to_sym].predicate
363
+ return klass.reflections[inverse_relation.to_s.pluralize.to_sym]
364
364
  end
365
- find_class_for_relation(klass, @owner.class.superclass.to_s.underscore.to_sym)
365
+ find_reflection_for_relation(klass, @owner.class.superclass.to_s.underscore.to_sym)
366
366
  end
367
367
 
368
368
  def create_record(attributes, raise = false)
@@ -51,10 +51,10 @@ module ActiveFedora
51
51
  return [] if ids.blank?
52
52
  solr_result = []
53
53
  0.step(ids.size,page_size) do |startIdx|
54
- query = ActiveFedora::SolrService.construct_query_for_ids(ids.slice(startIdx,page_size))
54
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids.slice(startIdx,page_size))
55
55
  solr_result += ActiveFedora::SolrService.query(query, rows: page_size)
56
56
  end
57
- return ActiveFedora::SolrService.reify_solr_results(solr_result)
57
+ return ActiveFedora::QueryResultBuilder.reify_solr_results(solr_result)
58
58
  end
59
59
 
60
60
  # In a HABTM, just look in the RDF, no need to run a count query from solr.
@@ -54,10 +54,10 @@ module ActiveFedora
54
54
  def filter_by_class(candidate_uris)
55
55
  return [] if candidate_uris.empty?
56
56
  ids = candidate_uris.map {|uri| ActiveFedora::Base.uri_to_id(uri) }
57
- results = ActiveFedora::SolrService.query(ActiveFedora::SolrService.construct_query_for_ids(ids), rows: 10000)
57
+ results = ActiveFedora::SolrService.query(ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids), rows: 10000)
58
58
 
59
59
  docs = results.select do |result|
60
- ActiveFedora::SolrService.classes_from_solr_document(result).any? { |klass|
60
+ ActiveFedora::QueryResultBuilder.classes_from_solr_document(result).any? { |klass|
61
61
  class_ancestors(klass).include? reflection.klass
62
62
  }
63
63
  end
@@ -31,7 +31,7 @@ module ActiveFedora
31
31
  end
32
32
 
33
33
  def self.root_resource_path
34
- ActiveFedora.fedora.base_path.sub('/', '')
34
+ ActiveFedora.fedora.root_resource_path
35
35
  end
36
36
 
37
37
  def self.connection
@@ -48,11 +48,7 @@ module ActiveFedora
48
48
  end
49
49
 
50
50
  def self.reinitialize_repo
51
- begin
52
- ActiveFedora.fedora.connection.put(root_resource_path, "")
53
- rescue Ldp::HttpError => exception
54
- log "#reinitialize_repo in spec_helper.rb raised #{exception}"
55
- end
51
+ ActiveFedora.fedora.init_base_path
56
52
  end
57
53
 
58
54
  def self.log(message)
@@ -15,5 +15,23 @@ module ActiveFedora
15
15
  def connection
16
16
  @connection ||= Ldp::Client.new(host)
17
17
  end
18
+
19
+ SLASH = '/'.freeze
20
+ BLANK = ''.freeze
21
+
22
+ # Call this to create a Container Resource to act as the base path for this connection
23
+ def init_base_path
24
+ connection.get(root_resource_path)
25
+ ActiveFedora::Base.logger.info "Attempted to init base path `#{root_resource_path}`, but it already exists" if ActiveFedora::Base.logger
26
+ return false
27
+ rescue Ldp::NotFound
28
+ connection.put(root_resource_path, BLANK).success?
29
+ end
30
+
31
+ # Remove a leading slash from the base_path
32
+ def root_resource_path
33
+ @root_resource_path ||= base_path.sub(SLASH, BLANK)
34
+ end
35
+
18
36
  end
19
37
  end
@@ -6,11 +6,11 @@ module ActiveFedora
6
6
  include RDF::Indexing
7
7
  include ActiveTriples::Properties
8
8
  include ActiveTriples::Reflection
9
- delegate :rdf_subject, :get_values, to: :resource
9
+ delegate :rdf_subject, :get_values, to: :resource
10
10
 
11
- property :has_model, predicate: ::RDF::URI.new("http://fedora.info/definitions/v4/rels-ext#hasModel")
12
- property :create_date, predicate: ActiveFedora::RDF::Fcrepo.created
13
- property :modified_date, predicate: ActiveFedora::RDF::Fcrepo.lastModified
11
+ property :has_model, predicate: ActiveFedora::RDF::Fcrepo::Model.hasModel
12
+ property :create_date, predicate: ActiveFedora::RDF::Fcrepo4.created
13
+ property :modified_date, predicate: ActiveFedora::RDF::Fcrepo4.lastModified
14
14
 
15
15
  def create_date
16
16
  super.first
@@ -254,6 +254,9 @@ module ActiveFedora
254
254
  payload = behaves_like_io?(content) ? content.read : content
255
255
  headers = { 'Content-Type' => mime_type }
256
256
  headers['Content-Disposition'] = "attachment; filename=\"#{@original_name}\"" if @original_name
257
+ # Setting the content-length is required until we figure out why Faraday
258
+ # is not doing this automatically for files uploaded via ActionDispatch.
259
+ headers['Content-Length'] = payload.size.to_s if uploaded_file?(payload)
257
260
  ldp_source.content = payload
258
261
  if new_record?
259
262
  ldp_source.create do |req|
@@ -292,6 +295,10 @@ module ActiveFedora
292
295
 
293
296
  private
294
297
 
298
+ def uploaded_file?(payload)
299
+ defined?(ActionDispatch::Http::UploadedFile) and payload.instance_of?(ActionDispatch::Http::UploadedFile)
300
+ end
301
+
295
302
  def local_or_remote_content(ensure_fetch = true)
296
303
  return @content if new_record?
297
304
 
@@ -25,7 +25,7 @@ module ActiveFedora
25
25
 
26
26
  def get_fixity_response_from_fedora
27
27
  uri = target + "/fcr:fixity"
28
- ActiveFedora.fedora.connection.get(uri)
28
+ ActiveFedora.fedora.connection.get(encoded_url(uri))
29
29
  end
30
30
 
31
31
  def fixity_graph
@@ -36,5 +36,13 @@ module ActiveFedora
36
36
  ::RDF::URI("http://fedora.info/definitions/v4/repository#status")
37
37
  end
38
38
 
39
+ def encoded_url uri
40
+ if uri.match("fcr:versions")
41
+ uri.gsub(/fcr:versions/,"fcr%3aversions")
42
+ else
43
+ uri
44
+ end
45
+ end
46
+
39
47
  end
40
48
  end
@@ -17,7 +17,7 @@ module ActiveFedora
17
17
  end
18
18
 
19
19
  def self.profile_solr_name
20
- ActiveFedora::SolrService.solr_name("object_profile", :displayable)
20
+ @profile_solr_name ||= ActiveFedora::SolrQueryBuilder.solr_name("object_profile", :displayable)
21
21
  end
22
22
 
23
23
 
@@ -26,7 +26,7 @@ module ActiveFedora
26
26
  Solrizer.set_field(solr_doc, 'system_create', c_time, :stored_sortable)
27
27
  Solrizer.set_field(solr_doc, 'system_modified', m_time, :stored_sortable)
28
28
  Solrizer.set_field(solr_doc, 'active_fedora_model', object.class.inspect, :stored_sortable)
29
- solr_doc.merge!(SolrService::HAS_MODEL_SOLR_FIELD => object.has_model)
29
+ solr_doc.merge!(QueryResultBuilder::HAS_MODEL_SOLR_FIELD => object.has_model)
30
30
  solr_doc.merge!(SOLR_DOCUMENT_ID.to_sym => object.id)
31
31
  solr_doc.merge!(self.class.profile_solr_name => object.to_json)
32
32
  object.attached_files.each do |name, file|
@@ -61,10 +61,5 @@ module ActiveFedora
61
61
  end
62
62
  solr_doc
63
63
  end
64
-
65
- def solr_name(*args)
66
- ActiveFedora::SolrService.solr_name(*args)
67
- end
68
-
69
64
  end
70
65
  end
@@ -20,6 +20,10 @@ module ActiveFedora
20
20
  @hash[k.first] = v
21
21
  end
22
22
  end
23
+
24
+ def uri= uri
25
+ @uri = uri
26
+ end
23
27
  end
24
28
 
25
29
  class SolrBackedResource
@@ -34,10 +34,6 @@ module ActiveFedora
34
34
  solr_doc.merge super({}).each_with_object({}) { |(key, value), new| new[[prefix,key].join] = value }
35
35
  end
36
36
 
37
- def generate_solr_symbol(base, data_type)
38
- ActiveFedora::SolrService.solr_name([prefix,base].join, type: data_type)
39
- end
40
-
41
37
  # ** Experimental **
42
38
  #@return [Boolean] true if either the key for name exists in solr or if its string value exists
43
39
  #@param [String] name Name of key to look for
@@ -152,7 +152,7 @@ module ActiveFedora
152
152
  @fields.each do |field_key, field_info|
153
153
  things = send(field_key)
154
154
  if things
155
- field_symbol = ActiveFedora::SolrService.solr_name(field_key, type: field_info[:type])
155
+ field_symbol = ActiveFedora::SolrQueryBuilder.solr_name(field_key, type: field_info[:type])
156
156
  things.val.each do |val|
157
157
  ::Solrizer::Extractor.insert_solr_field_value(solr_doc, field_symbol, val )
158
158
  end
@@ -0,0 +1,56 @@
1
+ module ActiveFedora
2
+ module QueryResultBuilder
3
+ def self.lazy_reify_solr_results(solr_results, opts = {})
4
+ Enumerator.new do |yielder|
5
+ solr_results.each do |hit|
6
+ yielder.yield(reify_solr_result(hit, opts))
7
+ end
8
+ end
9
+ end
10
+
11
+ def self.reify_solr_results(solr_results, opts = {})
12
+ solr_results.collect { |hit| reify_solr_result(hit, opts) }
13
+ end
14
+
15
+ def self.reify_solr_result(hit, opts = {})
16
+ klass = class_from_solr_document(hit)
17
+ klass.find(hit[SOLR_DOCUMENT_ID], cast: true)
18
+ end
19
+
20
+ #Returns all possible classes for the solr object
21
+ def self.classes_from_solr_document(hit, opts = {})
22
+ classes = []
23
+
24
+ hit[HAS_MODEL_SOLR_FIELD].each { |value| classes << Model.from_class_uri(value) }
25
+
26
+ classes.compact
27
+ end
28
+
29
+ #Returns the best singular class for the solr object
30
+ def self.class_from_solr_document(hit, opts = {})
31
+ #Set the default starting point to the class specified, if available.
32
+ best_model_match = Model.from_class_uri(opts[:class]) unless opts[:class].nil?
33
+ Array(hit[HAS_MODEL_SOLR_FIELD]).each do |value|
34
+
35
+ model_value = Model.from_class_uri(value)
36
+
37
+ if model_value
38
+
39
+ # Set as the first model in case opts[:class] was nil
40
+ best_model_match ||= model_value
41
+
42
+ # If there is an inheritance structure, use the most specific case.
43
+ if best_model_match > model_value
44
+ best_model_match = model_value
45
+ end
46
+ end
47
+ end
48
+
49
+ ActiveFedora::Base.logger.warn "Could not find a model for #{hit["id"]}, defaulting to ActiveFedora::Base" unless best_model_match if ActiveFedora::Base.logger
50
+ best_model_match || ActiveFedora::Base
51
+ end
52
+
53
+ HAS_MODEL_SOLR_FIELD = SolrQueryBuilder.solr_name("has_model", :symbol).freeze
54
+
55
+ end
56
+ end
@@ -9,7 +9,7 @@ module ActiveFedora
9
9
  end
10
10
 
11
11
  def default_sort_params
12
- [ActiveFedora::SolrService.solr_name(:system_create, :stored_sortable, type: :date)+' asc']
12
+ [ActiveFedora::SolrQueryBuilder.solr_name(:system_create, :stored_sortable, type: :date)+' asc']
13
13
  end
14
14
 
15
15
  end
@@ -3,11 +3,12 @@ module ActiveFedora
3
3
  extend ActiveSupport::Autoload
4
4
  autoload :DatastreamIndexing
5
5
  autoload :Fcrepo
6
+ autoload :Fcrepo4
6
7
  autoload :Ldp
7
8
  autoload :Indexing
8
9
  autoload :Identifiable
9
- autoload :ObjectResource
10
10
  autoload :Persistence
11
11
  autoload :RelsExt
12
+ autoload :ProjectHydra
12
13
  end
13
14
  end
@@ -1,12 +1,326 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # This file generated automatically using vocab-fetch from github.com:fcrepo3/fcrepo/master/fcrepo-server/src/main/resources/rdfs/fedora_relsext_ontology.rdfs
3
+ # and edited for clarity and additional terms published in different serializations of the voabularies
1
4
  require 'rdf'
2
- class ActiveFedora::RDF::Fcrepo < RDF::StrictVocabulary("http://fedora.info/definitions/v4/repository#")
3
-
4
- # Property definitions
5
- property :hasContent, comment: %(Defining where the fedora object has content.)
6
- property :mimeType
7
-
8
- property :created
9
- property :lastModified
10
- property :hasChild
5
+ module ActiveFedora::RDF
6
+ module Fcrepo
7
+ class System < ::RDF::StrictVocabulary("info:fedora/fedora-system:")
8
+ term :"ContentModel-3.0",
9
+ comment: %(Base Fedora 3 CModel cModel).freeze,
10
+ label: "Fedora 3 Content Model".freeze,
11
+ subClassOf: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
12
+ type: "info:fedora/fedora-system:def/model#FedoraObject".freeze
13
+ term :"FedoraObject-3.0",
14
+ comment: %(Base Fedora 3 Object cModel).freeze,
15
+ label: "Fedora 3 Object".freeze,
16
+ subClassOf: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
17
+ type: "info:fedora/fedora-system:def/model#FedoraObject".freeze
18
+ term :"ServiceDefinition-3.0",
19
+ comment: %(Fedora 3 Service Definition/BDef cModel).freeze,
20
+ label: "Fedora 3 Service Definition".freeze,
21
+ subClassOf: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
22
+ type: "info:fedora/fedora-system:def/model#FedoraObject".freeze
23
+ term :"ServiceDeployment-3.0",
24
+ comment: %(Fedora 3 Service Deployment/BMech cModel).freeze,
25
+ label: "Fedora 3 Service Deployment".freeze,
26
+ subClassOf: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
27
+ type: "info:fedora/fedora-system:def/model#FedoraObject".freeze
28
+ end
29
+ class Model < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/model#")
30
+ # Class definitions
31
+ term :FedoraObject,
32
+ comment: %(The base type of all objects in Fedora).freeze,
33
+ label: "FedoraObject".freeze,
34
+ subClassOf: "rdfs:Resource".freeze,
35
+ type: "rdfs:Class".freeze
36
+ term :Datastream,
37
+ comment: %(Binary data associated with a Fedora object).freeze,
38
+ label: "Datastream".freeze,
39
+ subClassOf: "rdfs:Resource".freeze,
40
+ type: "rdfs:Class".freeze
41
+ term :ExtProperty,
42
+ comment: %(Reification of an extension property of a Fedora object used in messaging).freeze,
43
+ label: "ExtProperty".freeze,
44
+ subClassOf: "rdf:Property".freeze,
45
+ type: "rdfs:Class".freeze
46
+ term :State,
47
+ comment: %(The state of a Fedora object or datastream).freeze,
48
+ label: "State".freeze,
49
+ subClassOf: "rdfs:Resource".freeze,
50
+ type: "rdfs:Class".freeze
51
+ term :Active,
52
+ comment: %(State of an object available in the repository).freeze,
53
+ label: "Active".freeze,
54
+ subClassOf: "rdfs:Resource".freeze,
55
+ type: "info:fedora/fedora-system:def/model#State".freeze
56
+ term :Deleted,
57
+ comment: %(State of an object that should be considered deleted, but is not purged).freeze,
58
+ label: "Deleted".freeze,
59
+ subClassOf: "rdfs:Resource".freeze,
60
+ type: "info:fedora/fedora-system:def/model#State".freeze
61
+ term :Inactive,
62
+ comment: %(State of an object that should be considered temporarily unavailable).freeze,
63
+ label: "Inactive".freeze,
64
+ subClassOf: "rdfs:Resource".freeze,
65
+ type: "info:fedora/fedora-system:def/model#State".freeze
66
+ # Property definitions
67
+ property :altIds,
68
+ comment: %(The alternate IDs for a datastream).freeze,
69
+ label: "Alternate IDs".freeze,
70
+ domain: "info:fedora/fedora-system:def/model#Datastream",
71
+ range: "xsd:string".freeze,
72
+ type: "rdf:Property".freeze
73
+ property :controlGroup,
74
+ comment: %(indicates whether a Datastream's content is inline XML (X), Managed (M), Referenced (R) or External (E)).freeze,
75
+ label: "controlGroup".freeze,
76
+ domain: "info:fedora/fedora-system:def/model#Datastream",
77
+ range: "xsd:string".freeze,
78
+ type: "rdf:Property".freeze
79
+ property :createdDate,
80
+ comment: %(The UTC datetime an object was created).freeze,
81
+ label: "createdDate".freeze,
82
+ domain: "info:fedora/fedora-system:def/model#FedoraObject",
83
+ range: "xsd:dateTimeStamp".freeze,
84
+ type: "rdf:Property".freeze
85
+ property :definesMethod,
86
+ comment: %(indicates the name of a service method defined in this interface).freeze,
87
+ label: "definesMethod".freeze,
88
+ domain: "info:fedora/fedora-system:ServiceDefinition-3.0".freeze,
89
+ range: "xsd:NCName".freeze,
90
+ type: "rdf:Property".freeze
91
+ property :digest,
92
+ comment: %(indicates the checksum digest of a datastream's contents or the keyword 'none').freeze,
93
+ label: "digest".freeze,
94
+ domain: "info:fedora/fedora-system:def/model#Datastream",
95
+ range: "xsd:string".freeze,
96
+ type: "rdf:Property".freeze
97
+ property :digestType,
98
+ comment: %(indicates either the checksum algorithm or the keyword DISABLED).freeze,
99
+ label: "digestType".freeze,
100
+ domain: "info:fedora/fedora-system:def/model#Datastream",
101
+ range: "xsd:string".freeze,
102
+ type: "rdf:Property".freeze
103
+ property :downloadFilename,
104
+ comment: %(indicates the name to be used when downloading a datastream's contents).freeze,
105
+ label: "downloadFilename".freeze,
106
+ domain: "info:fedora/fedora-system:def/model#Datastream",
107
+ range: "xsd:string".freeze,
108
+ type: "rdf:Property".freeze
109
+ property :extProperty,
110
+ comment: %(indicates an extension property of an object in Fedora in messaging).freeze,
111
+ label: "extProperty".freeze,
112
+ domain: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
113
+ range: "info:fedora/fedora-system:def/model#ExtProperty".freeze,
114
+ type: "rdf:Property".freeze
115
+ property :formatURI,
116
+ comment: %(A URI indicating the format of a datastream's content).freeze,
117
+ label: "formatURI".freeze,
118
+ type: "rdf:Property".freeze
119
+ property :hasModel,
120
+ comment: %(Indicates the Fedora 3 CModels for this object).freeze,
121
+ label: "hasModel".freeze,
122
+ subPropertyOf: "rdf:type".freeze,
123
+ domain: "info:fedora/fedora-system:FedoraObject-3.0".freeze,
124
+ range: "info:fedora/fedora-system:ContentModel-3.0".freeze,
125
+ type: "rdf:Property".freeze
126
+ property :hasService,
127
+ comment: %(indicates the Fedora 3 Service Definitions applicable to this CModel).freeze,
128
+ label: "hasService".freeze,
129
+ domain: "info:fedora/fedora-system:ContentModel-3.0".freeze,
130
+ range: "info:fedora/fedora-system:ServiceDefinition-3.0".freeze,
131
+ type: "rdf:Property".freeze
132
+ property :isContractorOf,
133
+ comment: %(indicates the Fedora 3 Content Models this deployment applies to).freeze,
134
+ label: "".freeze,
135
+ domain: "info:fedora/fedora-system:ServiceDeployment-3.0".freeze,
136
+ range: "info:fedora/fedora-system:ContentModel-3.0".freeze,
137
+ type: "rdf:Property".freeze
138
+ property :isDeploymentOf,
139
+ comment: %(indicates the Fedora 3 Service Definitions this deployment implements).freeze,
140
+ label: "isDeploymentOf".freeze,
141
+ domain: "info:fedora/fedora-system:ServiceDeployment-3.0".freeze,
142
+ range: "info:fedora/fedora-system:ServiceDefinition-3.0".freeze,
143
+ type: "rdf:Property".freeze
144
+ property :label,
145
+ comment: %(The label applied to a Fedora object).freeze,
146
+ label: "label".freeze,
147
+ domain: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
148
+ range: "xsd:string".freeze,
149
+ type: "rdf:Property".freeze
150
+ property :length,
151
+ comment: %(indicates the length of a datastream's contents).freeze,
152
+ label: "length".freeze,
153
+ domain: "info:fedora/fedora-system:def/model#Datastream".freeze,
154
+ range: "xsd:nonNegativeInteger".freeze,
155
+ type: "rdf:Property".freeze
156
+ property :ownerId,
157
+ comment: %(indicates the owner of an object).freeze,
158
+ label: "ownerId".freeze,
159
+ type: "rdf:Property".freeze
160
+ property :state,
161
+ comment: %(indicates the state of the object or datastream).freeze,
162
+ label: "state".freeze,
163
+ domain: ["info:fedora/fedora-system:def/model#FedoraObject".freeze,"info:fedora/fedora-system:def/model#Datastream".freeze],
164
+ range: "info:fedora/fedora-system:def/model#State".freeze,
165
+ type: "rdf:Property".freeze
166
+ property :versionable,
167
+ comment: %(indicates whether a datastream's property and contents changes are being tracked as versions).freeze,
168
+ label: "versionable".freeze,
169
+ domain: "info:fedora/fedora-system:def/model#Datastream".freeze,
170
+ range: "xsd:boolean".freeze,
171
+ type: "rdf:Property".freeze
172
+ end
173
+ class RelsExt < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/relations-external#")
11
174
 
175
+ # Property definitions
176
+ property :fedoraRelationship,
177
+ comment: %(The primitive property for all object-to-object relationships in the fedora ontology).freeze,
178
+ label: "Fedora Relationship".freeze,
179
+ type: "rdf:Property".freeze
180
+ property :hasAnnotation,
181
+ comment: %(A refinement of the generic descriptive relationship indicating a commentary relationship between fedora objects. The subject is a fedora object that is being commented on and the predicate is a fedora object that represents an annotation or comment about the subject. ).freeze,
182
+ label: "Has Annotation".freeze,
183
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasDescription".freeze,
184
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isAnnotationOf).freeze,
185
+ type: "rdf:Property".freeze
186
+ property :hasCollectionMember,
187
+ label: "Has Collection Member".freeze,
188
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasMember".freeze,
189
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isMemberOfCollection).freeze,
190
+ type: "rdf:Property".freeze
191
+ property :hasConstituent,
192
+ label: "Has Constituent".freeze,
193
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasPart".freeze,
194
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isConstituentOf).freeze,
195
+ type: "rdf:Property".freeze
196
+ property :hasDependent,
197
+ label: "Has Dependent".freeze,
198
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
199
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isDependentOf).freeze,
200
+ type: "rdf:Property".freeze
201
+ property :hasDerivation,
202
+ label: "Has Derivation".freeze,
203
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
204
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isDerivationOf).freeze,
205
+ type: "rdf:Property".freeze
206
+ property :hasDescription,
207
+ comment: %(A generic descriptive relationship between fedora objects. The subject is a fedora object that is being described in some manner and the predicate is a fedora object that represents a descriptive entity that is about the subject. ).freeze,
208
+ label: "Has Description".freeze,
209
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
210
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isDescriptionOf).freeze,
211
+ type: "rdf:Property".freeze
212
+ property :hasEquivalent,
213
+ label: "Has Equivalent".freeze,
214
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
215
+ type: "rdf:Property".freeze
216
+ property :hasMember,
217
+ label: "Has Member".freeze,
218
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasPart/".freeze,
219
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isMemberOf).freeze,
220
+ type: "rdf:Property".freeze
221
+ property :hasMetadata,
222
+ comment: %(A refinement of the generic descriptive relationship indicating a metadata relationship between fedora objects. The subject is a fedora object and the predicate is a fedora object that represents metadata about the subject. ).freeze,
223
+ label: "Has Metadata".freeze,
224
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasDescription".freeze,
225
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isMetadataFor).freeze,
226
+ type: "rdf:Property".freeze
227
+ property :hasPart,
228
+ label: "Has Part".freeze,
229
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
230
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isPartOf).freeze,
231
+ type: "rdf:Property".freeze
232
+ property :hasSubset,
233
+ label: "Has Subset".freeze,
234
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#hasMember".freeze,
235
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#isSubsetOf).freeze,
236
+ type: "rdf:Property".freeze
237
+ property :isAnnotationOf,
238
+ comment: %(A refinement of the generic descriptive relationship indicating a commentary relationship between fedora objects. The subject is a fedora object that represents an annotation or comment and the predicate is a fedora object that is being commented upon by the subject.).freeze,
239
+ label: "Is Annotation Of".freeze,
240
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isDescriptionOf".freeze,
241
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasAnnotation).freeze,
242
+ type: "rdf:Property".freeze
243
+ property :isConstituentOf,
244
+ label: "Is Constituent Of".freeze,
245
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isPartOf".freeze,
246
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasConstituent).freeze,
247
+ type: "rdf:Property".freeze
248
+ property :isDependentOf,
249
+ label: "Is Dependent Of".freeze,
250
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
251
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasDependent).freeze,
252
+ type: "rdf:Property".freeze
253
+ property :isDerivationOf,
254
+ label: "Is Derivation Of".freeze,
255
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
256
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasDerivation).freeze,
257
+ type: "rdf:Property".freeze
258
+ property :isDescriptionOf,
259
+ comment: %(A generic descriptive relationship between fedora objects. The subject is a fedora object that represents a descriptive entity and the predicate is a fedora object that is being described in some manner by the subject.).freeze,
260
+ label: "Is Description Of".freeze,
261
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
262
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasDescription).freeze,
263
+ type: "rdf:Property".freeze
264
+ property :isMemberOf,
265
+ label: "Is Member Of".freeze,
266
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isPartOf".freeze,
267
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasMember).freeze,
268
+ type: "rdf:Property".freeze
269
+ property :isMemberOfCollection,
270
+ label: "Is Member Of Collection".freeze,
271
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isMemberOf".freeze,
272
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasCollectionMember).freeze,
273
+ type: "rdf:Property".freeze
274
+ property :isMetadataFor,
275
+ comment: %(A refinement of the generic descriptive relationship indicating a metadata relationship between fedora objects. The subject is a fedora object that represents metadata and the predicate is a fedora object for which the subject serves as metadata.).freeze,
276
+ label: "Is Metadata For".freeze,
277
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isDescriptionOf".freeze,
278
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasMetadata).freeze,
279
+ type: "rdf:Property".freeze
280
+ property :isPartOf,
281
+ label: "Is Part Of".freeze,
282
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#fedoraRelationship".freeze,
283
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasPart).freeze,
284
+ type: "rdf:Property".freeze
285
+ property :isSubsetOf,
286
+ label: "Is Subset Of".freeze,
287
+ subPropertyOf: "info:fedora/fedora-system:def/relations-external#isMemberOf".freeze,
288
+ "owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasSubset).freeze,
289
+ type: "rdf:Property".freeze
290
+ end
291
+ class View < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/view#")
292
+ property :disseminates,
293
+ comment: %(A property used to indicate that an object contains a datastream).freeze,
294
+ label: "disseminates".freeze,
295
+ domain: "info:fedora/fedora-system:FedoraObject-3.0".freeze,
296
+ range: "info:fedora/fedora-system:def/model#Datastream".freeze,
297
+ type: "rdf:Property".freeze
298
+ property :disseminationType,
299
+ comment: %(A property whose object is common to all Datastreams of a given DSID).freeze,
300
+ label: "dissemination type".freeze,
301
+ type: "rdf:Property".freeze
302
+ property :isVolatile,
303
+ comment: %(A property indicating that a datastream's content is a reference to content external to the repository).freeze,
304
+ label: "isVolatile".freeze,
305
+ domain: "info:fedora/fedora-system:def/model#Datastream".freeze,
306
+ range: "xsd:boolean".freeze,
307
+ type: "rdf:Property".freeze
308
+ property :lastModifiedDate,
309
+ comment: %(UTC datetime of the last change to an object or most recent version of this datastream).freeze,
310
+ label: "lastModifiedDate".freeze,
311
+ domain: ["info:fedora/fedora-system:def/model#FedoraObject".freeze,"info:fedora/fedora-system:def/model#Datastream".freeze],
312
+ range: "xsd:dateTimeStamp".freeze,
313
+ type: "rdf:Property".freeze
314
+ property :mimeType,
315
+ comment: %(The MIME type of this datastream's content).freeze,
316
+ label: "mimeType".freeze,
317
+ domain: "info:fedora/fedora-system:def/model#Datastream".freeze,
318
+ range: "xsd:string".freeze,
319
+ type: "rdf:Property".freeze
320
+ property :version,
321
+ comment: %(indicates Fedora server version in messaging).freeze,
322
+ label: "Server version".freeze,
323
+ type: "rdf:Property".freeze
324
+ end
325
+ end
12
326
  end