NIHVIVO-2067 - Academic Intervals without associated dates lose their connection to course/semester class during the kb migration
This commit is contained in:
parent
3843886b87
commit
0c2de658a3
1 changed files with 16 additions and 9 deletions
|
@ -104,12 +104,25 @@ public class DateTimeMigration {
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
|
|
||||||
Statement stmt1 = iter.next();
|
Statement stmt1 = iter.next();
|
||||||
|
|
||||||
|
if (!stmt1.getObject().isResource()) {
|
||||||
|
logger.log("WARN: the object of this statement is expected to be a resource: " + ABoxUpdater.stmtString(stmt1));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Statement stmt2 = aboxModel.getProperty(stmt1.getObject().asResource(), dateTimeIntervalProp);
|
Statement stmt2 = aboxModel.getProperty(stmt1.getObject().asResource(), dateTimeIntervalProp);
|
||||||
|
|
||||||
if (stmt2 == null) continue;
|
if (stmt2 == null) {
|
||||||
if (!stmt1.getObject().isResource()) continue;
|
logger.log("Info: Found an AcademicInterval without dates attached");
|
||||||
if (!stmt2.getObject().isResource()) continue;
|
additions.add(stmt1.getSubject(), dateTimeIntervalProp, stmt1.getObject());
|
||||||
|
additions.add(stmt1.getObject().asResource(), dateTimeIntervalForProp, stmt1.getSubject());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stmt2.getObject().isResource()) {
|
||||||
|
logger.log("WARN: the object of this statement is expected to be a resource: " + ABoxUpdater.stmtString(stmt2));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
retractions.add(stmt2);
|
retractions.add(stmt2);
|
||||||
retractions.add(stmt2.getObject().asResource(), dateTimeIntervalForProp, stmt2.getSubject());
|
retractions.add(stmt2.getObject().asResource(), dateTimeIntervalForProp, stmt2.getSubject());
|
||||||
|
@ -135,7 +148,6 @@ public class DateTimeMigration {
|
||||||
|
|
||||||
if (additions.size() > 0) {
|
if (additions.size() > 0) {
|
||||||
long count = additions.size() / 2;
|
long count = additions.size() / 2;
|
||||||
//logger.log(count + " Academic interval" + ((count > 1) ? "s were" : " was") + " updated to the new date/time format");
|
|
||||||
logger.log("Updated " + count + " Academic interval" + ((count > 1) ? "s" : "") + " to the new date/time format");
|
logger.log("Updated " + count + " Academic interval" + ((count > 1) ? "s" : "") + " to the new date/time format");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -220,11 +232,6 @@ public class DateTimeMigration {
|
||||||
record.recordAdditions(additions);
|
record.recordAdditions(additions);
|
||||||
|
|
||||||
if (additions.size() > 0) {
|
if (additions.size() > 0) {
|
||||||
/*
|
|
||||||
logger.log(additions.size() + " date/time literal" +
|
|
||||||
((additions.size() > 1) ? "s" : "") + ((additions.size() > 1) ? " were " : " was ") +
|
|
||||||
"updated to the xsd:dateTime representation.");
|
|
||||||
*/
|
|
||||||
logger.log("Updated " + additions.size() + " date/time literal" +
|
logger.log("Updated " + additions.size() + " date/time literal" +
|
||||||
((additions.size() > 1) ? "s" : "") + " to the xsd:dateTime representation");
|
((additions.size() > 1) ? "s" : "") + " to the xsd:dateTime representation");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue