diff --git a/src/main/java/w2phtml/rdf/DocumentStructure.java b/src/main/java/w2phtml/rdf/DocumentStructure.java
index 15ee1df..d0f1c3d 100644
--- a/src/main/java/w2phtml/rdf/DocumentStructure.java
+++ b/src/main/java/w2phtml/rdf/DocumentStructure.java
@@ -5,11 +5,14 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TimeZone;
import java.util.Vector;
-
+import java.text.SimpleDateFormat;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.rdf.model.ModelFactory;
@@ -23,7 +26,8 @@ import org.apache.jena.rdf.model.Property;
public class DocumentStructure {
- private static final String HTML_EXCERPT_PROPERTY = "htmlExcerpt";
+ private static final String MODIFICATION_TIME = "modificationTime";
+ private static final String HTML_EXCERPT_PROPERTY = "htmlExcerpt";
private static final String TOCITEM = "TOCItem";
private static final String TS = "https://litvinovg.pro/text_structures#";
private static final String PARSERNAME = "w2phtml";
@@ -58,6 +62,7 @@ public class DocumentStructure {
private HashMap tocLevels;
private HashMap inputParts;
private Metadata metadata;
+ private Date currentTime;
public DocumentStructure(Vector files,String fileName, XhtmlConfig config,Metadata metadata) {
this.tocLevels = new HashMap();
@@ -71,6 +76,7 @@ public class DocumentStructure {
this.participantClass = textOntology.createClass(TS + PARTICIPANT);
this.itemClass = textOntology.createClass(TS + TOCITEM);
this.docID = fileName;
+ this.currentTime = Calendar.getInstance().getTime();
String publicationType = config.getRDFType();
setPublicationType(publicationType);
this.documentClass = textOntology.createClass(TS + documentType);
@@ -161,6 +167,7 @@ public class DocumentStructure {
private Resource createExcerpt(DocumentPart docExcerpt) {
String excerptName = TS + excerptType + "/" + PARSERNAME + "_" + docID + docExcerpt.getSafePath();
Resource excerpt = m.createIndividual(excerptName, excerptClass);
+ addModificationTime(excerpt);
if (!docExcerpt.getBody().isEmpty()) {
Property htmlExcerpt = m.createProperty(TS + HTML_EXCERPT_PROPERTY);
excerpt.addLiteral(htmlExcerpt, docExcerpt.getBody());
@@ -180,8 +187,10 @@ public class DocumentStructure {
String documentURI = TS + documentType + "/" + PARSERNAME + "_" + docID ;
Resource mainResource = m.createResource(documentURI, documentClass);
mainResource.addProperty( RDFS.label, docPart.getName());
+
+ addModificationTime(mainResource);
+
String tocURI = TS + TABLE_OF_CONTENTS + "/" + PARSERNAME + "_" + docID ;
-
Resource toc = m.createResource(tocURI, tocClass);
toc.addProperty( RDFS.label, docPart.getName());
@@ -193,6 +202,14 @@ public class DocumentStructure {
tocLevels.put(docPart.getPath(), toc);
attachExcerpt(docPart, toc);
}
+
+ private void addModificationTime(Resource mainResource) {
+ Property property = m.createProperty(TS + MODIFICATION_TIME);
+ SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ sd.setTimeZone(TimeZone.getTimeZone("GMT"));
+ String todayAsString = sd.format(currentTime);
+ mainResource.addProperty( property, todayAsString);
+ }
private void addAuthor(Resource resource, DocumentPart docPart) {
String order = docPart.getOrder();