NIHVIVO-1797 handle non-standard date formats that appear in weill DB
This commit is contained in:
parent
6fe1b3c1ab
commit
4151edf34c
3 changed files with 11 additions and 6 deletions
|
@ -148,10 +148,10 @@ public class DateTimeMigration {
|
|||
*/
|
||||
public void updateLiterals() throws IOException {
|
||||
|
||||
//TODO: look into java locale note: not handling timezones - they are not expected to be in the 1.1.1 data
|
||||
DateFormat yearFormat = new SimpleDateFormat("yyyy");
|
||||
DateFormat yearMonthFormat = new SimpleDateFormat("yyyy-MM");
|
||||
DateFormat yearMonthDayFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DateFormat yearMonthDayFormat2 = new SimpleDateFormat("dd-MMM-yy");
|
||||
|
||||
aboxModel.enterCriticalSection(Lock.WRITE);
|
||||
|
||||
|
@ -190,8 +190,13 @@ public class DateTimeMigration {
|
|||
date = yearMonthDayFormat.parse(stmt.getObject().asLiteral().getLexicalForm());
|
||||
newStmt = ResourceFactory.createStatement(stmt.getSubject(), stmt.getPredicate(), getDateTimeLiteral(date) );
|
||||
} catch (ParseException pe) {
|
||||
logger.log("Parse Exception for yearMonthDay literal: " + stmt.getObject().asLiteral().getLexicalForm() +
|
||||
". The following statement has been removed from the knowledge base " + ABoxUpdater.stmtString(stmt));
|
||||
try {
|
||||
date = yearMonthDayFormat2.parse(stmt.getObject().asLiteral().getLexicalForm());
|
||||
newStmt = ResourceFactory.createStatement(stmt.getSubject(), stmt.getPredicate(), getDateTimeLiteral(date) );
|
||||
} catch (ParseException pe2) {
|
||||
logger.log("Parse Exception for yearMonthDay literal: " + stmt.getObject().asLiteral().getLexicalForm() +
|
||||
". The following statement has been removed from the knowledge base " + ABoxUpdater.stmtString(stmt));
|
||||
}
|
||||
}
|
||||
} else if (ymdtPrecisionURI.equals(precision)) {
|
||||
logger.log("WARNING: unhandled precision found for individual " + stmt.getSubject().getURI() + ": " + precision +
|
||||
|
|
|
@ -64,6 +64,7 @@ public class KnowledgeBaseUpdater {
|
|||
|
||||
long startTime = System.currentTimeMillis();
|
||||
System.out.println("Migrating the knowledge base");
|
||||
logger.log("Started");
|
||||
|
||||
try {
|
||||
performUpdate();
|
||||
|
|
|
@ -17,8 +17,7 @@ public class SimpleChangeLogger implements ChangeLogger {
|
|||
|
||||
private boolean errorsWritten = false;
|
||||
|
||||
public SimpleChangeLogger( String logPath,
|
||||
String errorPath ) {
|
||||
public SimpleChangeLogger( String logPath, String errorPath ) {
|
||||
File logFile = new File(logPath);
|
||||
File errorFile = new File(errorPath);
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue