w3c / ldp-testsuite

(UNMAINTAINED) Tests for Linked Data Platform (LDP)
Other
22 stars 29 forks source link

Strange results in test testActAsIfInsertedContentRelationTripleExists #226

Closed hectorcorrea closed 8 years ago

hectorcorrea commented 8 years ago

Test testActAsIfInsertedContentRelationTripleExists reports confusing (and perhaps wrong) results.

Example

Create a Direct Container (dc2) with test2 as membershipResource and using a URI (<http://xyz>) as the hasMemberRelation

curl -X PUT localhost:9001/test2

curl -X POST \
--header "Content-Type: text/turtle" \
--header "Slug: dc2" \
-d "<> <http://www.w3.org/ns/ldp#hasMemberRelation> <http://xyz> ; <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:9001/test2> ." \
localhost:9001

Run testActAsIfInsertedContentRelationTripleExists using dc2 as the direct container

java -jar target/ldp-testsuite-0.2.0-SNAPSHOT-shaded.jar --server http://localhost:9001/dc2 --direct --test testActAsIfInsertedContentRelationTripleExists

The test fails because of the assertion for triple <test2>, <http://yxz>, <dc2/nodeX> in line https://github.com/w3c/ldp-testsuite/blob/master/src/main/java/org/w3/ldp/testsuite/test/DirectContainerTest.java#L205

QUESTION: Why does the test fails even if this property does exist in the membership resource (test2)

$ curl localhost:9001/test2
<http://localhost:9001/test2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/ldp#Resource> .
<http://localhost:9001/test2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/ldp#RDFSource> .
<http://localhost:9001/test2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/ldp#Container> .
<http://localhost:9001/test2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/ldp#BasicContainer> .
<http://localhost:9001/test2> <http://xyz> <http://localhost:9001/dc2/node5> .
<http://localhost:9001/test2> <http://xyz> <http://localhost:9001/dc2/node6> .

QUESTION: When the tests fails on this example the error indicates

LDP Direct Containers MUST behave as if they have a (LDPC URI,
ldp:insertedContentRelation , ldp:MemberSubject) triple, but LDP imposes 
no requirement to materialize such a triple in the LDP-DC representation.

even though the error was thrown when looking for a property on the membership resource (test2 in this case) rather than a property on the direct container dc2 itself.

Which one is it? Is the test failing because the direct container is missing <dc2> ldp:insertedContentRelation ldp:MemberSubject . or because the membeship resource is missing <test2> <http://yxz> <dc2/nodeX>) ?

In either case the result does not seem to make sense. The direct container contains the <dc2> ldp:insertedContentRelation ldp:MemberSubject . triple and the membership resource contains the <test2> <http://yxz> <dc2/nodeX> . triple.

hectorcorrea commented 8 years ago

Nevermind...I didn't realize that when the client includes header Prefer: return=representation; include="http://www.w3.org/ns/ldp#PreferMembership in the request, the server is meant to include information about the memberResource of the Direct Container when fetching the Direct Dontainer. See section 7.2.3 of https://www.w3.org/TR/ldp/ (examples 23-25)