-
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
Clean Connection #750
Clean Connection #750
Conversation
@@ -0,0 +1,59 @@ | |||
module ActiveFedora | |||
class PreferHeaders |
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.
I think we should move this to the LDP Gem. What do you say?
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.
Seems reasonable, may take a bit.
describe "#get" do | ||
context "when given an existing resource uri" do | ||
let(:uri) { asset.rdf_subject } | ||
let(:asset) do |
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.
How about:
ActiveFedora::Base.create do |a|
a.resource << [a.rdf_subject, RDF::DC.title, 'test']
end
❓
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.
👍 Didn't know you could do that.
1 similar comment
|
||
class CleanResult < SimpleDelegator | ||
def graph | ||
__getobj__.graph.delete(has_model_query) |
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.
This is a bit odd. Does the graph#delete
return a graph object that no longer has the specified triple?
I would expect:
def graph
__getobj__.graph.delete(has_model_query)
__getobj__.graph
end
This change does not rely on the overloaded graph#delete
method that is acting as both a command and a query method.
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.
It is, it does, and sure - I can change that.
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.
@jeremyf Look better? Thought it would be good for it not to continuously rerun the delete as well.
One thing that's interesting is graph#delete returning a graph without the statement is similar to how a functional language would do it, no? It -does- mutate the underlying object, but I wonder if the return value was intentional. https://github.com/ruby-rdf/rdf/blob/develop/lib/rdf/mixin/mutable.rb#L137 looks like it is, but immutability certainly doesn't seem to be the goal given the name of the mixin.
CleanConnection is an Ldp::Client which doesn't include those triples which were added by Fedora, LDP, or ActiveFedora. This way you can request a resource and get back the triples you originally put in to the repository - good for things like content negotiation.
2 similar comments
👍 |
This is an LDP Connection that doesn't return server managed/LDP/AF added triples. Useful for returning what you put into LDP.