Skip to content

Commit

Permalink
Merge branch 'main' of
Browse files Browse the repository at this point in the history
git@github.com:NASA-PDS/pds4-information-model.git into main

Changed java type used for dateTimeUTC from Date to Instant
	DMDocument - deprecated old dateTimeUTC
	WriteDOMDDJSONFile - change in file header
	WriteDOMTermEntryJSON - change in file header
	WriteDOMRDFTTLFile	- change in file comment
	WriteDOM11179DDPinsFilePClass - removed useless comment
	WriteCoreXMLSchemaLabel - three changes - <creation_date_time> x 2 and
<modification_date>
  • Loading branch information
jshughes committed Mar 29, 2023
1 parent 00613ec commit 3422012
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
Expand Down Expand Up @@ -248,7 +252,8 @@ public class DMDocument extends Object {
static String masterTodaysDate;
static String masterTodaysDateUTC;
static String masterTodaysDateTimeUTC;
static String masterTodaysDateTimeUTCwT;
// static String masterTodaysDateTimeUTCwT;
static String masterTodaysDateTimeUTCFromInstant;
static String masterTodaysDateyymmdd;

// 11179 and RDF global variables
Expand Down Expand Up @@ -387,7 +392,8 @@ public static void main(String args[]) throws Throwable {
masterTodaysDateyymmdd = masterTodaysDateUTC.substring(2, 4)
+ masterTodaysDateUTC.substring(5, 7) + masterTodaysDateUTC.substring(8, 10);
masterTodaysDateTimeUTC = getUTCDateTime();
masterTodaysDateTimeUTCwT = replaceString(masterTodaysDateTimeUTC, " ", "T");
// masterTodaysDateTimeUTCwT = replaceString(masterTodaysDateTimeUTC, " ", "T");
masterTodaysDateTimeUTCFromInstant = getUTCDateTimeFromInstant();

rdfPrefix = "http://pds.nasa.gov/infomodel/pds#";
creationDateValue = masterTodaysDateUTC;
Expand Down Expand Up @@ -985,6 +991,16 @@ static public boolean isInteger(String s) {
return true;
}

/**
* get a UTC Formated Date/Time from Instant
*/
static String getUTCDateTimeFromInstant() {
Instant now = Instant.now();
now = now.truncatedTo(ChronoUnit.SECONDS);
String dateTimeUTC = now.toString();
return dateTimeUTC;
}

/**
* get a UTC Formated Date/Time from the machine date
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void writeFileLines(SchemaFileDefn lSchemaFileDefn, PrintWriter prSchemat
prSchematron.println(" <product_class>Product_XML_Schema</product_class>");
prSchematron.println(" <Modification_History>");
prSchematron.println(" <Modification_Detail>");
prSchematron.println(" <modification_date>" + DMDocument.masterTodaysDateUTC
prSchematron.println(" <modification_date>" + DMDocument.masterTodaysDateTimeUTCFromInstant
+ "</modification_date>");
prSchematron
.println(" <version_id>" + lSchemaFileDefn.labelVersionId + "</version_id>");
Expand All @@ -127,7 +127,7 @@ public void writeFileLines(SchemaFileDefn lSchemaFileDefn, PrintWriter prSchemat
prSchematron.println(" <File>");
prSchematron.println(
" <file_name>" + lSchemaFileDefn.relativeFileNameXMLSchema + "</file_name>");
prSchematron.println(" <creation_date_time>" + DMDocument.masterTodaysDateTimeUTCwT
prSchematron.println(" <creation_date_time>" + DMDocument.masterTodaysDateTimeUTCFromInstant
+ "</creation_date_time>");
prSchematron.println(" <file_size unit=\"byte\">"
+ getFileSize(lSchemaFileDefn.relativeFileSpecXMLSchema) + "</file_size>");
Expand All @@ -149,7 +149,7 @@ public void writeFileLines(SchemaFileDefn lSchemaFileDefn, PrintWriter prSchemat
prSchematron.println(" <File>");
prSchematron.println(
" <file_name>" + lSchemaFileDefn.relativeFileNameSchematron + "</file_name>");
prSchematron.println(" <creation_date_time>" + DMDocument.masterTodaysDateTimeUTCwT
prSchematron.println(" <creation_date_time>" + DMDocument.masterTodaysDateTimeUTCFromInstant
+ "</creation_date_time>");
prSchematron.println(" <file_size unit=\"byte\">"
+ getFileSize(lSchemaFileDefn.relativeFileSpecSchematron) + "</file_size>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public void writePINSFile(String lFileName) throws java.io.IOException {
// Print the Protege Pins Header
private void printPDDPHdr() {
prDDPins.println(" ; Tue Jan 26 07:52:47 PST 2010"); // protege write resets date
// prDDPins.println(" ; " + DMDocument.masterTodaysDateTimeUTCwT);
prDDPins.println(" ; ");
prDDPins.println(" ;+ (version \"3.3.1\")");
prDDPins.println(" ;+ (build \"Build 430\")");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void printPDDPHdr(SchemaFileDefn lSchemaFileDefn2, PrintWriter prDDPins)
prDDPins.println(" " + formValue("LDD Version") + ": "
+ formValue(lSchemaFileDefn2.ont_version_id) + " ,");
prDDPins.println(" " + formValue("Date") + ": "
+ formValue(DMDocument.masterTodaysDateTimeUTCwT) + " ,");
+ formValue(DMDocument.masterTodaysDateTimeUTCFromInstant) + " ,");
prDDPins.println(" " + formValue("Description") + ": "
+ formValue("This document is a dump of the contents of the PDS4 Data Dictionary") + " ,");
String lNSList = formValue("pds:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void writeRDFHdr (ClassAttrPropClassification lClassAttrPropClassificatio
}
prRDFFile.println("###########################################");
prRDFFile.println("########## Class definitions");
prRDFFile.println("########## DateTime:" + DMDocument.masterTodaysDateTimeUTCwT);
prRDFFile.println("########## DateTime:" + DMDocument.masterTodaysDateTimeUTCFromInstant);
prRDFFile.println("###########################################");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private TreeMap <String, TermEntryDefnGroup> getTermMappings () {
private JSONObject getJSONObject (TreeMap <String, TermEntryDefnGroup> termEntryDefnGroupMap) {
// create the JSON object
JSONObject jsonObjectRoot = new JSONObject ();
jsonObjectRoot.put("datetime", DMDocument.masterTodaysDateTimeUTCwT);
jsonObjectRoot.put("datetime", DMDocument.masterTodaysDateTimeUTCFromInstant);
jsonObjectRoot.put("infoModelVersionId", DMDocument.infoModelVersionId);
jsonObjectRoot.put("title", "PDS4 Term Mappings");
jsonObjectRoot.put("lddName", lddName);
Expand Down

0 comments on commit 3422012

Please sign in to comment.