Skip to content
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

Merged
merged 1 commit into from
Apr 5, 2015
Merged

Clean Connection #750

merged 1 commit into from
Apr 5, 2015

Conversation

tpendragon
Copy link
Contributor

This is an LDP Connection that doesn't return server managed/LDP/AF added triples. Useful for returning what you put into LDP.

@@ -0,0 +1,59 @@
module ActiveFedora
class PreferHeaders
Copy link
Member

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?

Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 93.03% when pulling c75f90d on terrellt:feature/clean_connection into 2d90a8f on projecthydra:master.

describe "#get" do
context "when given an existing resource uri" do
let(:uri) { asset.rdf_subject }
let(:asset) do
Copy link
Member

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

Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 93.06% when pulling ac198c9 on terrellt:feature/clean_connection into 2d90a8f on projecthydra:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling 45430b4 on terrellt:feature/clean_connection into 2d90a8f on projecthydra:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling 45430b4 on terrellt:feature/clean_connection into 2d90a8f on projecthydra:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling 45430b4 on terrellt:feature/clean_connection into 2d90a8f on projecthydra:master.


class CleanResult < SimpleDelegator
def graph
__getobj__.graph.delete(has_model_query)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling dffef73 on terrellt:feature/clean_connection into 81f9a7c on projecthydra:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling dffef73 on terrellt:feature/clean_connection into 81f9a7c on projecthydra:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 93.0% when pulling dffef73 on terrellt:feature/clean_connection into 81f9a7c on projecthydra:master.

@jeremyf
Copy link
Contributor

jeremyf commented Apr 5, 2015

👍

jeremyf added a commit that referenced this pull request Apr 5, 2015
@jeremyf jeremyf merged commit 4545b0f into samvera:master Apr 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants