From 628f8da5ed2c2960683ebc8962953d82dc02f966 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Thu, 8 Dec 2011 17:13:39 +0000 Subject: [PATCH] updating add role to person two stage, moving role to activity relationships and inverse to optional instead of required to support repair mode. --- .../AddRoleToPersonTwoStageGenerator.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRoleToPersonTwoStageGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRoleToPersonTwoStageGenerator.java index fc145792..c0b29da2 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRoleToPersonTwoStageGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRoleToPersonTwoStageGenerator.java @@ -128,13 +128,20 @@ public abstract class AddRoleToPersonTwoStageGenerator extends BaseEditConfigura editConfiguration.setN3Required(list( N3_PREFIX + "\n" + "?person ?rolePredicate ?role .\n" + - "?role a ?roleType .\n"+ - "?role " + getRoleToActivityPlaceholder() + " ?roleActivity .\n"+ - "?roleActivity " + getActivityToRolePlaceholder() + " ?role ." + "?role a ?roleType .\n" )); // Optional N3 + //Note here we are placing the role to activity relationships as optional, since + //it's possible to delete this relationship from the activity + //On submission, if we kept these statements in n3required, the retractions would + //not have all variables substituted, leading to an error + //Note also we are including the relationship as a separate string in the array, to allow it to be + //independently evaluated and passed back with substitutions even if the other strings are not + //substituted correctly. editConfiguration.setN3Optional( list( + "?role " + getRoleToActivityPlaceholder() + " ?roleActivity .\n"+ + "?roleActivity " + getActivityToRolePlaceholder() + " ?role .", "?role ?inverseRolePredicate ?person .", getN3ForActivityLabel(), getN3ForActivityType(),