Run the Vagrant VM
Follow the instructions at https://github.com/fcrepo4-labs/fcrepo4-vagrant for setting up the Fedora 4 Vagrant Virtual Machine. These are essentially:
- Clone the fcrepo4-vagrant Git repository
and start the VM:
Code Block |
---|
git clone https://github.com/fcrepo4-labs/fcrepo4-vagrant.git
cd fcrepo4- |
...
...
- Optional: Edit the
install_files/config
file and change the FEDORA_AUTH
value to true
.
Build the Audit Triplestore Camel Workflow
- Connect to the Vagrant VM as the vagrant user, and build the Audit Triplestore Camel workflow:
Code Block |
---|
|
ssh -i ~/.vagrant.d/insecure_private_key -p 2222 vagrant@localhost
git clone https://github.com/fcrepo4-labs/fcrepo-camel-toolbox.git
cd fcrepo-camel-toolbox/audit-triplestore
mvn clean install
mvn camel:run |
Verify that audit events are created in the triplestore
- Verify that there are no triples in the Fuseki triplestore: All Triples In Fuseki
- Perform some auditable operations using the Fedora 4 HTML UI at http://localhost:8080/fcrepo/rest or using the REST API on the command-line:
Code Block |
---|
|
curl -u fedoraAdmin:secret3 -X POST -H "Slug: object1" http://127.0.0.1:8080/fcrepo/rest
curl -u fedoraAdmin:secret3 -X POST -H "Slug: file1" --data-binary "test content" http://127.0.0.1:8080/fcrepo/rest/object1
curl -u fedoraAdmin:secret3 -X PATCH -H "Content-type: application/sparql-update" --data-binary "insert data { <> <http://purl.org/dc/elements/1.1/title> \"new title\" . }" http://127.0.0.1:8080/fcrepo/rest/object1
curl -u fedoraAdmin:secret3 -X DELETE http://127.0.0.1:8080/fcrepo/rest/object1/file1
curl -u fedoraAdmin:secret3 -X DELETE http://127.0.0.1:8080/fcrepo/rest/object1 |
- Return to Fuseki and view the triples for the audit events: All Triples In Fuseki
Query audit events
Once there are audit event triples in Fuseki, you can perform queries using the Fuseki SPARQL query form:
By resource:
Code Block |
---|
select ?e where { ?e <http://www.loc.gov/premis/rdf/v1#hasEventRelatedObject> <http://127.0.0.1:8080/fcrepo/rest/object1> } |
By date range:
Code Block |
---|
select ?e where { ?e <http://www.loc.gov/premis/rdf/v1#hasEventDateTime> ?date . FILTER (?date > "2015-04-01T10:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>) } |
By event type:
Code Block |
---|
select ?e where { ?e <http://www.loc.gov/premis/rdf/v1#hasEventType> <http://id.loc.gov/vocabulary/preservation/eventType/cre> } |
By agent:
Code Block |
---|
select ?e where { ?e <http://www.loc.gov/premis/rdf/v1#hasEventRelatedAgent> "curl/7.37.1"^^<http://www.w3.org/2001/XMLSchema#string> } |