-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhauling implementatation of ActiveFedora::Rdf #377
Conversation
This is perhaps a few hours premature. Our cCLA is on the way, but it may not be on file yet. Thought it wouldn't hurt for the PR to get some eyeballs today, since it's a pretty major commit. |
Since this is such a big commit, with a massive impact, I propose we have at least 3 👍 before we merge. |
I'm in support of that @jcoyne. This is squashed, in line with the contribution guidelines. The history is still available at https://github.com/no-reply/active_fedora/tree/rdf, if that helps people review the content. |
I will be pointing my local ScholarSphere installation at this branch this afternoon to see what breaks and compare that to the documentation above. Stay tuned. |
@no-reply can you rebase please ;) |
|
||
def rdf_type(value) | ||
Deprecation.warn Configurable, "rdf_type is deprecated and will be removed in active-fedora 8.0.0. Use configure :type => instead.", caller | ||
configure :type => value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the ruby 1.9 hash syntax (http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
end | ||
|
||
def class_for_property | ||
klass = property_config[:class_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klass = property_config.fetch(:class_name, ActiveFedora::Rdf::Resource)
I agree with @mjgiarlo ;) -- I have started a branch to use this in damspas (https://github.com/ucsdlib/damspas/tree/feature/af7) and will spend some quality time on this, probably at c4l and definitely the following week. |
** THIS BREAKS BACKWARD COMPATIBILITY ** This is a major rewrite of RDF Datastreams and the underlying node support, tightly coupling the ActiveFedora::Rdf to rdf.rb. It replaces the old RdfNode and related modules with a Resource class that subclasses RDF::Graph. The commit adds support for RDF Resources (nodes) persisted to an RDF::Repository, which allows many ActiveFedora::Base objects to share data without duplicating statements in each of their datastreams. It will handle deep nodes in graphs gracefully, even if they are not expected in the model. The other key features are some powerful convienince methods for handling Linked Data; namely, #fetch (which pulls data from an upstream URI) and #rdf_label (which is a way of getting a human-readable label from common fields). Improves handling of typed data. Primarily by virtue of using df.rb. Saving a Date object (for example) will serialize correctly typed data and return a Date object when parsed. Adds the new Rdf::Identifiable to ActiveFedora::Base, allowing Fedora objects to be treated as Rdf::Resources. This lets you create complex relationships between objects, referencing them in and retrieving them from datastreams. A demo of the features included in the commit is here: https://gist.github.com/no-reply/9519740 The commit breaks backwards compatability in several ways. Full documentation of compatibility breakage and deprecation is here: https://gist.github.com/terrellt/75a2fc84fd3d274a1bbd - New object types now subclass ActiveFedora::Rdf::Resource: class Component < ActiveFedora::Rdf::Resource end # instead of: class Component include ActiveFedora::RdfObject end - Parameters for new Resources are changed. - A resource is *always* returned for URI subjects, even when no class can be identified. This allows better handling of nested data from sources whose structure is unknown; properties won't be registered, but other Resource methods will be available. You can get the string version by calling #rdf_subject. - Typed literals are supported. *This includes changes to serialization of RDF!* Passing (e.g.) a Ruby Date object as the value of a property/triple will yield a typed literal in RDF serializations and a Ruby Date object will be returned when fetching that data. It also deprecates a few things for future removal. - `rdf_type` is deprecated in favor of a general configuration syntax for Resources. - `map_predicates` is superceded by `property`, which registers properties in a simpler way (without need for a block) using a pattern borrowed from some non-core ruby-rdf libraries. This work depends on the linkeddata gem for support loading arbitrary RDF serialations (see: ActiveFedora::Rdf::Resource#fetch).
This has been rebased (and unceremoniously force-pushed) for further comment and/or merge. |
Overhauling implementatation of ActiveFedora::Rdf
** THIS BREAKS BACKWARD COMPATIBILITY **
This is a major rewrite of RDF Datastreams and the underlying node
support, tightly coupling the ActiveFedora::Rdf to rdf.rb. It replaces
the old RdfNode and related modules with a Resource class that
subclasses RDF::Graph.
The commit adds support for RDF Resources (nodes) persisted to an
RDF::Repository, which allows many ActiveFedora::Base objects to share
data without duplicating statements in each of their datastreams. It
will handle deep nodes in graphs gracefully, even if they are not
expected in the model. The other key features are some powerful
convenience methods for handling Linked Data; namely, #fetch (which
pulls data from an upstream URI) and #rdf_label (which is a way of
getting a human-readable label from common fields).
It also improves handling of typed data. Primarily by virtue of using
df.rb. Saving a Date object (for example) will serialize correctly
typed data and return a Date object when parsed.
A demo of the features included in the commit is here:
https://gist.github.com/no-reply/9519740
The commit breaks backwards compatability in several ways. Full
documentation of compatibility breakage and deprecation is here:
https://gist.github.com/terrellt/75a2fc84fd3d274a1bbd
New object types now subclass ActiveFedora::Rdf::Resource:
class Component < ActiveFedora::Rdf::Resource
end
instead of:
class Component
include ActiveFedora::RdfObject
end
Parameters for new Resources are changed.
A resource is always returned for URI subjects, even when no
class can be identified. This allows better handling of nested data
from sources whose structure is unknown; properties won't be
registered, but other Resource methods will be available. You can get
the string version by calling #rdf_subject.
Typed literals are supported. This includes changes to
serialization of RDF! Passing (e.g.) a Ruby Date object as the value
of a property/triple will yield a typed literal in RDF serializations
and a Ruby Date object will be returned when fetching that data.
It also deprecates a few things for future removal.
rdf_type
is deprecated in favor of a general configuration syntaxfor Resources.
map_predicates
is superceded byproperty
, which registersproperties in a simpler way (without need for a block) using a pattern
borrowed from some non-core ruby-rdf libraries.
This work depends on the linkeddata gem for support loading arbitrary
RDF serialations (see: ActiveFedora::Rdf::Resource#fetch).