diff --git a/audit-triplestore/pom.xml b/audit-triplestore/pom.xml
index 44bb061e..3f467fa4 100644
--- a/audit-triplestore/pom.xml
+++ b/audit-triplestore/pom.xml
@@ -43,6 +43,10 @@
org.apache.commons
commons-lang3
+
+ org.fcrepo
+ fcrepo-audit
+
diff --git a/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditNamespaces.java b/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditNamespaces.java
deleted file mode 100644
index e82202ba..00000000
--- a/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditNamespaces.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright 2015 DuraSpace, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.fcrepo.camel.audit.triplestore;
-
-/**
- * @author acoburn
- */
-public final class AuditNamespaces {
-
- public static final String AUDIT = "http://fedora.info/definitions/v4/audit#";
- public static final String EVENT_TYPE = "http://id.loc.gov/vocabulary/preservation/eventType/";
- public static final String PREMIS = "http://www.loc.gov/premis/rdf/v1#";
- public static final String PROV = "http://www.w3.org/ns/prov#";
- public static final String XSD = "http://www.w3.org/2001/XMLSchema#";
-
- private AuditNamespaces() {
- // prevent instantiation
- }
-}
diff --git a/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditSparqlProcessor.java b/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditSparqlProcessor.java
index 2373d2f6..5546d31d 100644
--- a/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditSparqlProcessor.java
+++ b/audit-triplestore/src/main/java/org/fcrepo/camel/audit/triplestore/AuditSparqlProcessor.java
@@ -15,13 +15,11 @@
*/
package org.fcrepo.camel.audit.triplestore;
+import static org.fcrepo.audit.AuditNamespaces.AUDIT;
+import static org.fcrepo.audit.AuditNamespaces.PREMIS;
+import static org.fcrepo.audit.AuditNamespaces.PROV;
+import static org.fcrepo.audit.AuditNamespaces.XSD;
import static org.fcrepo.camel.RdfNamespaces.RDF;
-import static org.fcrepo.camel.RdfNamespaces.REPOSITORY;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.AUDIT;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.EVENT_TYPE;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.PREMIS;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.PROV;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.XSD;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -33,6 +31,7 @@
import java.util.TimeZone;
import java.util.UUID;
+import org.fcrepo.audit.InternalAuditor;
import org.fcrepo.camel.JmsHeaders;
import org.fcrepo.camel.processor.ProcessorUtils;
@@ -92,14 +91,6 @@ public void process(final Exchange exchange) throws Exception {
private static final UriRef PREMIS_EVENT = new UriRef(PREMIS + "Event");
private static final UriRef PROV_EVENT = new UriRef(PROV + "InstantaneousEvent");
- private static final UriRef CONTENT_MOD = new UriRef(AUDIT + "contentModification");
- private static final UriRef CONTENT_REM = new UriRef(AUDIT + "contentRemoval");
- private static final UriRef METADATA_MOD = new UriRef(AUDIT + "metadataModification");
-
- private static final UriRef CONTENT_ADD = new UriRef(EVENT_TYPE + "ing");
- private static final UriRef OBJECT_ADD = new UriRef(EVENT_TYPE + "cre");
- private static final UriRef OBJECT_REM = new UriRef(EVENT_TYPE + "del");
-
private static final UriRef PREMIS_TIME = new UriRef(PREMIS + "hasEventDateTime");
private static final UriRef PREMIS_OBJ = new UriRef(PREMIS + "hasEventRelatedObject");
private static final UriRef PREMIS_AGENT = new UriRef(PREMIS + "hasEventRelatedAgent");
@@ -109,11 +100,6 @@ public void process(final Exchange exchange) throws Exception {
private static final UriRef XSD_DATE = new UriRef(XSD + "dateTime");
private static final UriRef XSD_STRING = new UriRef(XSD + "string");
- private static final String HAS_CONTENT = REPOSITORY + "hasContent";
- private static final String LAST_MODIFIED = REPOSITORY + "lastModified";
- private static final String NODE_ADDED = REPOSITORY + "NODE_ADDED";
- private static final String NODE_REMOVED = REPOSITORY + "NODE_REMOVED";
- private static final String PROPERTY_CHANGED = REPOSITORY + "PROPERTY_CHANGED";
private static final String EMPTY_STRING = "";
@@ -134,6 +120,7 @@ private static Set triplesForMessage(final Message message, final UriRef
final String agent = (String) message.getHeader(JmsHeaders.USER_AGENT, EMPTY_STRING);
final String properties = (String) message.getHeader(JmsHeaders.PROPERTIES, EMPTY_STRING);
final String identifier = ProcessorUtils.getSubjectUri(message);
+ final String premisType = InternalAuditor.getAuditEventType(eventType, properties);
// types
final Set triples = new HashSet<>();
@@ -146,29 +133,8 @@ private static Set triplesForMessage(final Message message, final UriRef
triples.add( new TripleImpl(subject, PREMIS_OBJ, new UriRef(identifier)) );
triples.add( new TripleImpl(subject, PREMIS_AGENT, new TypedLiteralImpl(user, XSD_STRING)) );
triples.add( new TripleImpl(subject, PREMIS_AGENT, new TypedLiteralImpl(agent, XSD_STRING)) );
-
- // mapping event type/properties to audit event type
- if (eventType.contains(NODE_ADDED)) {
- if (properties != null && properties.contains(HAS_CONTENT)) {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, CONTENT_ADD) );
- } else {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, OBJECT_ADD) );
- }
- } else if (eventType.contains(NODE_REMOVED)) {
- if (properties != null && properties.contains(HAS_CONTENT)) {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, CONTENT_REM) );
- } else {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, OBJECT_REM) );
- }
- } else if (eventType.contains(PROPERTY_CHANGED)) {
- if (properties != null && properties.contains(HAS_CONTENT)) {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, CONTENT_MOD) );
- } else if (properties != null && properties.equals(LAST_MODIFIED)) {
- /* adding/removing a file updates the lastModified property of the parent container,
- so ignore updates when only lastModified is changed */
- } else {
- triples.add( new TripleImpl(subject, PREMIS_TYPE, METADATA_MOD) );
- }
+ if (premisType != null) {
+ triples.add(new TripleImpl(subject, PREMIS_TYPE, new UriRef(premisType)));
}
return triples;
}
diff --git a/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/ProcessorTest.java b/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/ProcessorTest.java
index c0c217f6..9597b6bc 100644
--- a/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/ProcessorTest.java
+++ b/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/ProcessorTest.java
@@ -16,10 +16,10 @@
package org.fcrepo.camel.audit.triplestore;
import static org.fcrepo.camel.RdfNamespaces.REPOSITORY;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.AUDIT;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.EVENT_TYPE;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.PREMIS;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.XSD;
+import static org.fcrepo.audit.AuditNamespaces.AUDIT;
+import static org.fcrepo.audit.AuditNamespaces.EVENT_TYPE;
+import static org.fcrepo.audit.AuditNamespaces.PREMIS;
+import static org.fcrepo.audit.AuditNamespaces.XSD;
import java.io.IOException;
import java.util.HashMap;
diff --git a/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/RouteTest.java b/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/RouteTest.java
index 23810d06..956e6fc3 100644
--- a/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/RouteTest.java
+++ b/audit-triplestore/src/test/java/org/fcrepo/camel/audit/triplestore/RouteTest.java
@@ -16,8 +16,8 @@
package org.fcrepo.camel.audit.triplestore;
import static org.fcrepo.camel.RdfNamespaces.REPOSITORY;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.AUDIT;
-import static org.fcrepo.camel.audit.triplestore.AuditNamespaces.PREMIS;
+import static org.fcrepo.audit.AuditNamespaces.AUDIT;
+import static org.fcrepo.audit.AuditNamespaces.PREMIS;
import java.util.HashMap;
import java.util.Map;
diff --git a/pom.xml b/pom.xml
index 8c6c2003..2ec24a18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,6 +187,11 @@
+
+ org.fcrepo
+ fcrepo-audit
+ ${project.version}
+