trellis
trellis copied to clipboard
URI consistency for containers and the trailing slash
I've been adding descriptive statements to containers and I think that I've identified a bug that shows up where the trailing slash is used in some cases and not others in Trellis' system generated statements.
You should be able to reproduce this case in v 0.19.0 using curl commands:
curl -XPOST -H 'Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"' -H "Slug: example" http://localhost:9090/
Then examine the turtle serialization of the parent: (omitting prefixes)
<http://localhost:9090/>
rdf:type ldp:BasicContainer ;
ldp:contains <http://localhost:9090/example/> .
Note that there is a trailing slash on the new container URI. Now GET that new container in turtle:
<http://localhost:9090/example>
rdf:type ldp:BasicContainer .
Note the lack of a trailing slash in the subject above. I would expect that these statements describe the same resource. I have to interact with that resource at the URI with the trailing slash, so that seems like the right one to me..
There is one more context where I note inconsistent use of trailing slash and that is the use of the <> shorthand in a turtle post of a container.
curl -v -X POST \
-H "Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"" \
-H "Slug: groofolder" \
-d "<> a <http://example.com/schema/1.0/Groo> ." \
http://localhost:9090/
Then if you get the groofolder turtle, it looks like this:
<http://localhost:9090/groofolder>
rdf:type ldp:BasicContainer .
<http://localhost:9090/groofolder/>
rdf:type <http://example.com/schema/1.0/Groo> .
The <> is replaced by the URI with the trailing slash, but the Trellis system triple is w/o the slash. Perhaps it all comes down to that one system triple that represents the LDP type being generated w/o the slash..
Some follow up information. The activity streams for container CRUD seem to similarly omit the trailing slash.