fcrepo-exts / fcrepo-import-export

Apache License 2.0
15 stars 19 forks source link

add flag for omitting membership triples #152

Closed pwinckles closed 3 years ago

pwinckles commented 3 years ago

Jira: https://jira.lyrasis.org/browse/FCREPO-3427

What this does

Adds a flag, --omit-membership that is used to omit membership triples in exports. This is required when migration from F5 to F6 because the membership triples are not stored in the user RDF.

How to test

Run an export using the new flag and very that the exported containers do not have membership triples. Here's a script for creating direct and indirect containers:

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects -v -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven -v -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix ldp: <http://www.w3.org/ns/ldp#>\n@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object ;\nldp:membershipResource </rest/objects/raven/> ;\nldp:hasMemberRelation pcdm:hasMember .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages -v -H'Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"' -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages/cover -v -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages/page0 -v -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages/page1 -v -H "Content-Type: text/turtle" -X PUT --data-binary @-

echo -e '@prefix ldp: <http://www.w3.org/ns/ldp#>\n@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object ;\nldp:membershipResource </rest/objects/raven/pages/cover> ;\nldp:hasMemberRelation pcdm:hasFile .' | curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages/cover/files -v -H'Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"' -H "Content-Type: text/turtle" -X PUT --data-binary @-

curl -u fedoraAdmin:fedoraAdmin http://localhost:8080/rest/objects/raven/pages/cover/files/cover.txt -H "Link: <http://www.w3.org/ns/ldp#NonRDFSource>; rel=type" -v -H "Content-Type: text/plain" -X PUT --data-binary "This is a cover"

echo -e 'PREFIX pcdm: <http://pcdm.org/models#>\nINSERT {\n  <> a pcdm:File\n} WHERE {\n}' | curl -u fedoraAdmin:fedoraAdmin -i -XPATCH -H"Content-Type: application/sparql-update" http://localhost:8080/rest/objects/raven/pages/cover/files/cover.txt/fcr:metadata --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Object .' | curl -i -XPUT -H"Content-Type: text/turtle" http://localhost:8080/rest/collections --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n\n<> a pcdm:Collection .' | curl -i -XPUT -H"Content-Type: text/turtle" http://localhost:8080/rest/collections/poe --data-binary @-

echo -e '@prefix ldp: <http://www.w3.org/ns/ldp#>\n@prefix pcdm: <http://pcdm.org/models#>\n@prefix ore: <http://www.openarchives.org/ore/terms/>\n\n<> a pcdm:Object ;\nldp:membershipResource </rest/collections/poe/> ;\nldp:hasMemberRelation pcdm:hasMember ;\nldp:insertedContentRelation ore:proxyFor .' | curl -i -XPUT -H"Content-Type: text/turtle" -H'Link: <http://www.w3.org/ns/ldp#IndirectContainer>;rel="type"' http://localhost:8080/rest/collections/poe/members --data-binary @-

echo -e '@prefix pcdm: <http://pcdm.org/models#>\n@prefix ore: <http://www.openarchives.org/ore/terms/>\n\n<> a pcdm:Object ;\nore:proxyFor </fcrepo/rest/objects/raven/> .' | curl -i -XPUT -H"Content-Type: text/turtle" http://localhost:8080/rest/collections/poe/members/ravenProxy --data-binary @-