Created
May 4, 2018 14:23
-
-
Save escowles/4e6f2a821c4ceb541ad6aca35148081c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| AUTH="-u fedoraAdmin:fedoraAdmin" | |
| BASE="http://localhost:8080/rest/$RANDOM" | |
| SUBJ="$BASE#me" | |
| # create a direct container with a hash uri resource | |
| echo creating direct container | |
| curl $AUTH -X PUT -H "Content-type: text/turtle" -d "<$SUBJ> <http://purl.org/dc/title> 'my thing' ." $BASE | |
| echo | |
| # create an indirect container using the hash uri as the membership resource | |
| TTL="<> a <http://www.w3.org/ns/ldp#IndirectContainer>; | |
| <http://www.w3.org/ns/ldp#membershipResource> <$SUBJ>; | |
| <http://www.w3.org/ns/ldp#hasMemberRelation> <http://pcdm.org/models#hasFile>; | |
| <http://www.w3.org/ns/ldp#insertedContentRelation> <http://www.openarchives.org/ore/terms/proxyFor> ." | |
| echo creating indirect | |
| curl $AUTH -X PUT -H "Content-type: text/turtle" -H "Link: <http://www.w3.org/ns/ldp#IndirectContainer>;rel=\"type\"" -d "$TTL" $BASE/bar | |
| echo | |
| # create a file | |
| echo creating file | |
| curl $AUTH -X PUT -d "asdf" $BASE/file1 | |
| echo | |
| # create a member of the indirect container | |
| echo creating member | |
| curl $AUTH -X POST -H "Content-type: text/turtle" -d "<> <http://www.openarchives.org/ore/terms/proxyFor> <$BASE/file1>" $BASE/bar | |
| echo | |
| # expect to see triples referencing the hash uri resource | |
| echo fetching $BASE | |
| curl $AUTH $BASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment