-
Notifications
You must be signed in to change notification settings - Fork 15
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
Adds requirements for Fedora's alpha-6 implementation of LDP. #30
Conversation
@@ -40,7 +40,7 @@ def self.applied_preferences headers | |||
# Is the response an LDP resource? | |||
|
|||
def self.resource? response | |||
Array(links(response)["type"]).include? Ldp.resource.to_s |
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 guess Fedora 4 is not sending the Link: http://www.w3.org/ns/ldp#Resource; rel="type"
header?
In any case, we should check all of these options:
http://www.w3.org/ns/ldp#Resource
http://www.w3.org/ns/ldp#BasicContainer - for LDP Basic Containers
http://www.w3.org/ns/ldp#DirectContainer - for LDP Direct Containers
http://www.w3.org/ns/ldp#IndirectContainer - for LDP Indirect Containers
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.
So if any of the above are present consider it a resource?
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.
Actually, I wonder if this is a regression in Fedora or not. I can't tell from the LDP spec if we MUST include both, or if one implies the other.
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 like the spec reads a Direct Container is a Container which is an RDF Resource which is a Resource.
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.
The only reason I doubt that reading is they often go out of their way to avoid inference, so I wonder if it is actually a mistake.
@cbeer: Should be ready to re-review. |
@@ -23,7 +23,7 @@ | |||
stubs = Faraday::Adapter::Test::Stubs.new do |stub| | |||
stub.head('/a_resource') {[ 200 ]} | |||
stub.get('/a_resource') {[ 200, {"Link" => "<http://www.w3.org/ns/ldp#Resource>;rel=\"type\""}, simple_graph ]} | |||
stub.get('/a_container') {[ 200, {"Link" => ["<http://www.w3.org/ns/ldp#Resource>;rel=\"type\"","<http://www.w3.org/ns/ldp#BasicContainer>;rel=\"type\""]}, simple_container_graph ]} | |||
stub.get('/a_container') {[ 200, {"Link" => ["<http://www.w3.org/ns/ldp#DirectContainer>;rel=\"type\"","<http://www.w3.org/ns/ldp#BasicContainer>;rel=\"type\""]}, simple_container_graph ]} |
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.
Why is this a DirectContainer instead of a resource? It seems very strange to assert its both a DirectContainer and a BasicContainer. Same question for all the places below too.
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 simply missed the BasicContainer assertion in the long line. Things were changed because Fedora 4 calls items DirectContainers rather than resources. Should we test for the success of all resource types or simply test #resource? and then keep these tests the same?
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.
Just testing #resource makes sense to me.
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.
Just testing #resource makes sense to me.
That should do it.
Tests fail because of RSpec 3.. |
@@ -40,7 +40,7 @@ def self.applied_preferences headers | |||
# Is the response an LDP resource? | |||
|
|||
def self.resource? response | |||
Array(links(response)["type"]).include? Ldp.resource.to_s | |||
container?(response) || Array(links(response)["type"]).include?(Ldp.resource.to_s) |
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.
With that last change, I think we can revert this too, right?
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.
If I revert this then responses from Fedora 4 won't be wrapped, because it just sends LDP.direct_container as the type for resources.
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 see both #Resource and #DirectContainer headers:
< HTTP/1.1 200 OK
< ETag: "cd93612c87d133785390ced92850a8c13b3fc397"
< Last-Modified: Wed, 04 Jun 2014 19:02:59 GMT
< Preference-Applied: return=representation; include="http://www.w3.org/ns/ldp#PreferMembership http://www.w3.org/ns/ldp#PreferContainment http://fedora.info/definitions/v4/repository#InboundReferences"
< Vary: Prefer
< Accept-Patch: application/sparql-update
< Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
< Accept-Post: text/turtle,text/rdf+n3,application/n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
< Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
< Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"
< Content-Type: text/turtle
< Transfer-Encoding: chunked
* Server Jetty(9.1.5.v20140505) is not blacklisted
< Server: Jetty(9.1.5.v20140505)
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.
There's a good chance I missed something, I'll give it a shot later this afternoon.
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.
@cbeer: Confirmed, removed.
Uses PUT/POST appropriately for creating a new record with an ID. Updates etag and last-modified in cached response when updating - stops 412 errors on repeated saves.
Adds requirements for Fedora's alpha-6 implementation of LDP.
Uses PUT/POST appropriately for creating a new record with an ID.
Updates etag and last-modified in cached response when updating - stops
412 errors on repeated saves.