Releases: samvera/active_fedora
v8.0.0.rc3
RDF module renamed (#616)
ActiveFedora::Rdf
has been renamed to ActiveFedora::RDF
. Deprecated submodules of ActiveFedora::Rdf
have been removed (see below). For the most part, this is a transparent change, since classes like ActiveFedora::RDFDatastream
do not use the ActiveFedora::RDF
namespace.
Fcrepo3 and ProjectHydra RDF vocabularies added (#616)
ActiveFedora::RDF::Fcrepo
module contains RDF vocabulary class for Fedora 3. Cf. https://github.com/fcrepo3/fcrepo/blob/master/fcrepo-server/src/main/resources/rdfs/fedora_relsext_ontology.rdfs.ActiveFedora::RDF::ProjectHydra
is an RDF vocabulary for custom ActiveFedora/Hydra relations predicates (e.g.,http://projecthydra.org/ns/relations#isGovernedBy
)
Change to RDFDatastream resource class implementation (#500)
ActiveFedora::Rdf::ObjectResource
was removed in favor of permitting an RDFDatastream to use any ActiveTriples::Resource
subclass as its resource class, provided that it includes ActiveFedora::RDF::Persistence
.
If you have overridden #resource_class
in your RDF datastream subclass, you should change your resource class from:
class MyDatastreamResource < ActiveFedora::Rdf::Resource
# stuff
end
to:
class MyDatastreamResource < ActiveTriples::Resource
include ActiveFedora::RDF::Persistence
# stuff
end
AND, in your datastream, change:
class MyRDFDatastream < NtriplesRDFDatastream # or, < RdfxmlRDFDatastream
def resource_class
MyDatastreamResource
end
end
to:
class MyRDFDatastream < NtriplesRDFDatastream # or, < RdfxmlRDFDatastream
resource_class MyDatastreamResource
end
Change NtriplesRDFDatastream.config to NtriplesRDFDatastream.properties
Change to default datastream "prefix" (prepended to solr field names):
ActiveFedora::Datastream#prefix
returns"#{dsid.underscore}__"
by default (was empty string) -- e.g."desc_metadata__"
for dsid"descMetadata"
. In AF 7.x a deprecation warning prompted overriding of#prefix
to maintain the 7.x behavior (no prefix) in version 8. If you chose to override#prefix
to implement the version 8 behavior, you should be able to remove the override.
Change to attribute setters
The previous (deprecated) behavior permitted attribute setters to receive arrays or scalar regardless of their definitions as "multiple" or "unique" (multiple: false
). The new behavior required the sent value to conform to the attribute definition:
- The setter for an attribute defined with
multiple: true
raisesArgumentError
when given a scalar value:
has_attributes :title, datastream: "descMetadata", multiple: true
obj.title = "Test" # => ArgumentError
obj.title = ["Test"] # OK
- The setter for an attribute defined with
multiple: false
(a.k.a. "unique") raisesArgumentError
when given an enumerable value (Array):
has_attributes :description, datastream: "descMetadata", multiple: false
obj.description = ["Testing ActiveFedora 8.0.0"] # => ArgumentError
obj.description = "Testing ActiveFedora 8.0.0." # OK
- The
#attributes=
method behaves consistently with the attribute setters -- i.e., raisingArgumentError
when setting an attribute value inappropriately as outlined above.
Change to attributes reader
The #attributes
reader method behaves consistently with the attribute readers -- i.e., returning scalar values for multiple: false
and arrays for multiple: true
attributes.
Optional fedora.yml configuration options added as comments to generator template (#618)
# timeout: 60
# open_timeout: nil
# ssl_client_cert: <ssl certificate>
# ssl_client_key: <ssl key>
# validateChecksum: false
Removed deprecated methods
ActiveFedora::SolrService.escape_uri_for_query
(useRsolr.escape
)ActiveFedora::SemanticNode.pids_from_uris
ActiveFedora::RDF::Indexing#prefix
(use#apply_prefix
)ActiveFedora::RDF::Indexing.prefix
ActiveFedora::SolrDigitalObject#new?
(use#new_record?
)ActiveFedora::Querying#quote_for_solr
(useRSolr.escape
)ActiveFedora::Persistence#new?
and#new_object?
(use#new_record?
)
Removed deprecated RDF modules
ActiveFedora::Rdf::Resource
(useActiveTriples::Resource
)ActiveFedora::Rdf::Term
(useActiveTriples::Term
)ActiveFedora::Rdf::List
(useActiveTriples::List
)ActiveFedora::Rdf::Configurable
(useActiveTriples::Configurable
)ActiveFedora::Rdf::Properties
(useActiveTriples::Properties
)ActiveFedora::Rdf::Repositories
(useActiveTriples::Repositories
)ActiveFedora::Rdf::NodeConfig
(useActiveTriples::NodeConfig
)ActiveFedora::Rdf::NestedAttributes
(useActiveTriples::NestedAttributes
)
8.0.0.rc2
RDF module renamed (#616)
ActiveFedora::Rdf
has been renamed to ActiveFedora::RDF
. Deprecated submodules of ActiveFedora::Rdf
have been removed (see below). For the most part, this is a transparent change, since classes like ActiveFedora::RDFDatastream
do not use the ActiveFedora::RDF
namespace.
Fcrepo3 and ProjectHydra RDF vocabularies added (#616)
ActiveFedora::RDF::Fcrepo
module contains RDF vocabulary class for Fedora 3. Cf. https://github.com/fcrepo3/fcrepo/blob/master/fcrepo-server/src/main/resources/rdfs/fedora_relsext_ontology.rdfs.ActiveFedora::RDF::ProjectHydra
is an RDF vocabulary for custom ActiveFedora/Hydra relations predicates (e.g.,http://projecthydra.org/ns/relations#isGovernedBy
)
Change to RDFDatastream resource class implementation (#500)
ActiveFedora::Rdf::ObjectResource
was removed in favor of permitting an RDFDatastream to use any ActiveTriples::Resource
subclass as its resource class, provided that it includes ActiveFedora::RDF::Persistence
.
If you have overridden #resource_class
in your RDF datastream subclass, you should change your resource class from:
class MyDatastreamResource < ActiveFedora::Rdf::Resource
# stuff
end
to:
class MyDatastreamResource < ActiveTriples::Resource
include ActiveFedora::RDF::Persistence
# stuff
end
AND, in your datastream, change:
class MyRDFDatastream < NtriplesRDFDatastream # or, < RdfxmlRDFDatastream
def resource_class
MyDatastreamResource
end
end
to:
class MyRDFDatastream < NtriplesRDFDatastream # or, < RdfxmlRDFDatastream
resource_class MyDatastreamResource
end
Change NtriplesRDFDatastream.config to NtriplesRDFDatastream.properties
Change to default datastream "prefix" (prepended to solr field names):
ActiveFedora::Datastream#prefix
returns"#{dsid.underscore}__"
by default (was empty string) -- e.g."desc_metadata__"
for dsid"descMetadata"
. In AF 7.x a deprecation warning prompted overriding of#prefix
to maintain the 7.x behavior (no prefix) in version 8. If you chose to override#prefix
to implement the version 8 behavior, you should be able to remove the override.
Change to attribute setters
The previous (deprecated) behavior permitted attribute setters to receive arrays or scalar regardless of their definitions as "multiple" or "unique" (multiple: false
). The new behavior required the sent value to conform to the attribute definition:
- The setter for an attribute defined with
multiple: true
raisesArgumentError
when given a scalar value:
has_attributes :title, datastream: "descMetadata", multiple: true
obj.title = "Test" # => ArgumentError
obj.title = ["Test"] # OK
- The setter for an attribute defined with
multiple: false
(a.k.a. "unique") raisesArgumentError
when given an enumerable value (Array):
has_attributes :description, datastream: "descMetadata", multiple: false
obj.description = ["Testing ActiveFedora 8.0.0"] # => ArgumentError
obj.description = "Testing ActiveFedora 8.0.0." # OK
- The
#attributes=
method behaves consistently with the attribute setters -- i.e., raisingArgumentError
when setting an attribute value inappropriately as outlined above.
Change to attributes reader
The #attributes
reader method behaves consistently with the attribute readers -- i.e., returning scalar values for multiple: false
and arrays for multiple: true
attributes.
Optional fedora.yml configuration options added as comments to generator template (#618)
# timeout: 60
# open_timeout: nil
# ssl_client_cert: <ssl certificate>
# ssl_client_key: <ssl key>
# validateChecksum: false
Removed deprecated methods
ActiveFedora::SolrService.escape_uri_for_query
(useRsolr.escape
)ActiveFedora::SemanticNode.pids_from_uris
ActiveFedora::RDF::Indexing#prefix
(use#apply_prefix
)ActiveFedora::RDF::Indexing.prefix
ActiveFedora::SolrDigitalObject#new?
(use#new_record?
)ActiveFedora::Querying#quote_for_solr
(useRSolr.escape
)ActiveFedora::Persistence#new?
and#new_object?
(use#new_record?
)
Removed deprecated RDF modules
ActiveFedora::Rdf::Resource
(useActiveTriples::Resource
)ActiveFedora::Rdf::Term
(useActiveTriples::Term
)ActiveFedora::Rdf::List
(useActiveTriples::List
)ActiveFedora::Rdf::Configurable
(useActiveTriples::Configurable
)ActiveFedora::Rdf::Properties
(useActiveTriples::Properties
)ActiveFedora::Rdf::Repositories
(useActiveTriples::Repositories
)ActiveFedora::Rdf::NodeConfig
(useActiveTriples::NodeConfig
)ActiveFedora::Rdf::NestedAttributes
(useActiveTriples::NestedAttributes
)
8.0.0.rc1
Removed deprecated methods
ActiveFedora::SolrService.escape_uri_for_query
(useRsolr.escape
)ActiveFedora::SemanticNode.pids_from_uris
ActiveFedora::RDF::Indexing#prefix
(use#apply_prefix
)ActiveFedora::RDF::Indexing.prefix
Default datastream "prefix" (preprended to solr field names):
ActiveFedora::Datastream#prefix
returns"#{dsid.underscore}__"
by default (was empty string) -- e.g."desc_metadata__"
for dsid"descMetadata"
.
Attribute setters
- The setter for an attribute defined with
multiple: true
raisesArgumentError
when given a scalar value:
has_attributes :title, datastream: "descMetadata", multiple: true
obj.title = "Test" # => ArgumentError
obj.title = ["Test"] # OK
- The setter for an attribute defined with
multiple: false
(a.k.a. "unique") raisesArgumentError
when given an enumerable value (Array):
has_attributes :description, datastream: "descMetadata", multiple: false
obj.description = ["Testing ActiveFedora 8.0.0"] # => ArgumentError
obj.description = "Testing ActiveFedora 8.0.0." # OK
- The
#attributes=
method behaves consistently with the attribute setters -- i.e., raising ArgumentError when setting an attribute value inappropriately as outlined above.
Attributes reader
The #attributes
reader method behaves consistently with the attribute readers -- i.e., returning scalar values for multiple: false
and arrays for multiple: true
attributes.
7.1.0
One big change in this release is getting rid of the mediashelf-loggable dependency. This module injected a "logger" method on every object, class and module, so it was a bit invasive. There is now a logger method on every object extending from ActiveFedora::Base
Another substantial change is that RdfDatastreams now use ActiveTriples rather than our own parallel implementation of that library.
The final major change is that attributes that are declared as multiple: true
will have a deprecation warning if you try to assign a scalar value to them. Similarly, attributes declared as multiple: false
will have a deprecation if you attempt to assign an enumerable value.
Change log
2014-07-17: Update Om and Rubydora depencencies [Justin Coyne]
2014-07-17: Change the deprecation message so that it helps you find where the
problem is [Justin Coyne]
2014-06-30: Refactoring ActiveFedora::Rdf to use ActiveTriples [Tom Johnson]
2014-07-16: Make logger an accessor that can be set [Justin Coyne]
2014-07-16: Remove mediashelf-loggable [Justin Coyne]
2014-06-24: Replace ActiveFedora::Core#init_with with #init_with_object to avoid
a respond_to? false positive in Psych [Michael B. Klein]
2014-06-24: Have DatastreamHash delegate to a Hash instead of descending from
one [Michael B. Klein]
2014-06-24: Add solr_page_size as a valid option for HABTM [Justin Coyne]
2014-06-23: Refactor for style/readability [Justin Coyne]
2014-06-18: Adds :update_index option to save' -- passing a false value will prevent
update_index' from being called after the object is persisted. The
create_needs_index?' and
update_needs_index?' methods, however, will not be
overridden when they return false. [David Chandek-Stark]
2014-06-18: Fixed bug in ActiveFedora::FinderMethods#load_from_fedora so that it
casts when klass is ActiveFedora::Base and `cast' argument is nil, as intended.
Fixes #431 since by default it calls load_from_fedora(pid, nil) on each hit.
[David Chandek-Stark]
2014-06-13: Created pid instance variable so value can be retained after destroy
Fixes #422 [David Chandek-Stark]
2014-06-10: Added support to `exists?' finder method for a hash of conditions
Fixes #427 [David Chandek-Stark]
2014-06-10: Deprecate setting multiple attribute to scalar value Deprecate
setting unique attribute to enumerable value [David Chandek-Stark]
2014-06-10: Remove useage of RDF.Class from test code. That's not a real URI
[Justin Coyne]
2014-06-10: Peg rspec to ~> 2.99 [Justin Coyne]
2014-06-10: Put rspec options in a .rspec file for rspec 3 [Justin Coyne]
Version 7.0.0
Autocommits
In order to speed up writes, ActiveFedora 7 depends on Solr autocommits. You must add a block like this to your solrconfig.xml or commits may be lost when you restart solr: https://github.com/projecthydra/active_fedora/blob/f2b1fd092889cfefdffcb5d63a9fc1fd87e7242a/lib/generators/active_fedora/config/solr/templates/solr_conf/conf/solrconfig.xml#L19-L68
Association Validation
ActiveFedora 7 validates association options passed to has_many
, belongs_to
and has_and_belongs_to_many
. Options for these methods were not validated in earlier versions. Hence, legacy options (such as :inbound
) which had become effectively no-ops now raise exceptions and will have to be removed.
RDF Compatibility:
ActiveFedora 7 includes a major rewrite of RDFDatastreams and the underlying node support. It replaces the old RdfNode and related modules with a Resource class that subclasses RDF::Graph, tightly coupling ActiveFedora::Rdf to rdf.rb.
These changes effect serialization of typed data in RDF. This may lead to differences between legacy datastreams and new ones created with the same inputs.
Where old versions represented all literals as plain strings, they are now serialized as typed data where appropriate and ruby objects of matching type are returned when retrieving properties. For example:
# Behavior in AF 6
asset.modified = Date.today
asset.descMetadata.content
#=> "<info:fedora/changeme:1> <http://purl.org/dc/terms/modified> \"2014-03-28\" .\n"
asset.modified
#=> ["2014-03-28"]
# Behavior in AF 7
asset.modified = Date.today
asset.descMetadata.content
#=> "<info:fedora/changeme:1> <http://purl.org/dc/terms/modified> \"2014-03-28Z\"^^<http://www.w3.org/2001/XMLSchema#date> .\n"
asset.modified
#=> [Fri, 28 Mar 2014]
The behavior of legacy datastreams will not break, but client code needs to be able to handle both typed data and strings unless and until they are updated.
Syntax changes:
There are a handful of syntax changes brought on by the restructure of AF::Rdf.
RDF Objects used to be defined like this:
class Component
include ActiveFedora::RdfObject
end
Now like this:
class Component < ActiveFedora::Rdf::Resource
end
Lists used to be defined like this:
class ElementList
include ActiveFedora::RdfList
end
Now, like this:
class ElementList < ActiveFedora::Rdf::List
end
New objects used to take an RDF::Graph on init:
Component.new(RDF::Graph.new)
Now they take (optionally) a URI subject
Component.new('http://myorg.org/resource1')
Optionally, they take a parent resource and/or parameters inherited from RDF::Graph. You can pass an existing graph to the Resource in the RDF::Graph way:
Component.new('http://myorg.org/resource1', :data => RDF::Graph.load('http://example.org/somedata.rdf'))
URI values in RDF now return an Rdf::Resource instead of a String when no class is specified:
Component.property :seeAlso, :predicate => RDF::RDFS.seeAlso
c = Component.new
c.seeAlso = "http://google.com"
# old behavior:
c.seeAlso # => ["http://google.com"]
# new behavior:
c.seeAlso # => [#<ActiveFedora::Rdf::Resource:0x3fa648d8e0e0(default)>]
c.seeAlso.rdf_subject # => "http://google.com"
This version also uses RDF 1.1, which should not have any effect on legacy data.
Caveats:
When ActiveFedora::Base.load_instance_from_solr
is used and you attempt to access a term that is not stored in the index, an error will be raised.
Deprecations:
Solr Prefixes
DEPRECATION WARNING: In active-fedora 8 the solr fields created by Hydra::ModsArticleDatastream will be prefixed with "desc_metadata__". If you want to maintain the existing behavior, you must override Hydra::ModsArticleDatastream.#prefix to return an empty string. (called from to_solr at /Users/justin/workspace/active_fedora/lib/active_fedora/om_datastream.rb:51)
In ActiveFedora 8, all the solr fields will be prefixed with the datastream name. If you want this behavior before upgrading to ActiveFedora 8 add this method to your datastreams:
def prefix
"#{dsid.underscore}__"
end
If you want to preserve the existing behavior going forward (i.e. do not prefix solr fields with the datastream name), then add this method instead:
def prefix
""
end
Adding the #prefix
method will remove the deprecation warning.
RDF
DEPRECATION WARNING: map_predicates is deprecated and will be removed in active-fedora 8.0.0. Use property :name, predicate: predicate instead.
Previous versions used the following syntax to register properties in datastreams:
class Datastream < ActiveFedora::NtriplesRDFDatastream
map_predicates do |map|
map.subject in: RDF::DC, to: :subject
end
end
The syntax is now as seen below. The :class_name argument and index blocks still work in the same way.
class Datastream < ActiveFedora::NtriplesRDFDatastream
property :subject, predicate: RDF::DC.subject
end
DEPRECATION WARNING: rdf_type is deprecated and will be removed in active-fedora 8.0.0. Use configure type: instead.
RDF Types used to be defined like this:
class MediatorUser < ActiveFedora::Rdf::Resource
rdf_type RDF::DC.AgentClass
end
They now use a generalized #configure method, which assigns other class level variables (:repository, :rdf_label, and :base_uri).
class MediatorUser < ActiveFedora::Rdf::Resource
configure type: RDF::DC.AgentClass
end
ActiveFedora 6.7.5
Released to make ActiveFedora compatible with Rubydora 1.7.0
ActiveFedora 6.7.4
Earlier today Greg Kellogg released a new version of the ruby rdf library (1.1.2), this breaks[1] the rdf-rdfxml (1.0.1) library which ActiveFedora depends on.
I've added a dependency in the active-fedora gemspec that ensures we get a working combination of those libraries. This is the sole change in this release.
If you are not upgrading to 6.7.4 it is highly recommended that you add this line to your Gemfile:
gem 'rdf', '~> 1.1.1.1'
[1] ruby-rdf/rdf#147
Later: Mr. Kellog has yanked the rdf 1.1.2 gem and released a fixed version (1.1.2.1), so this is no longer an issue.
ActiveFedora 6.7.3
Force overwrite the blacklight solr.yml and jetty.yml config files. This enables the generator to run in Travis-CI (for curate, sufia) without prompting for user input.
v6.7.2
ConfigGenerator should use a unique method name, not generate
so that
it doesn't cause an infinite loop
6.7.1
Two bug fixes:
- The RDF reader chokes on certain character combinations if the raw data
is not encoded UTF-8. See ruby-rdf/rdf#142
Fedora does not store character encoding, so by default they come back as
ASCII-8BIT. - the ConfigGenerator calls
generate
instead ofinvoke