Merge branch 'maint-rel-1.6' into develop
This commit is contained in:
commit
840d5f67aa
6 changed files with 46 additions and 12 deletions
|
@ -167,21 +167,21 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//process object property
|
//process object property
|
||||||
private void processObjectProperty(VitroRequest vreq) {
|
private void processObjectProperty(VitroRequest vreq) {
|
||||||
ObjectProperty prop = EditConfigurationUtils.getObjectProperty(vreq);
|
ObjectProperty prop = EditConfigurationUtils.getObjectProperty(vreq);
|
||||||
|
|
||||||
//if this property is true, it means the object needs to be deleted along with statement
|
//if this property is true, it means the object needs to be deleted along with statement
|
||||||
if(prop.getStubObjectRelation())
|
//while the second test is to see if a different object uri (i.e. not the direct objet of the predicate)
|
||||||
|
//needs to be deleted
|
||||||
|
if(prop.getStubObjectRelation() || hasDeleteObjectUri(vreq))
|
||||||
{
|
{
|
||||||
deleteObjectIndividual(vreq);
|
deleteObjectIndividual(vreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteObjectPropertyStatement(vreq);
|
if(!hasDeleteObjectUri(vreq)) {
|
||||||
|
deleteObjectPropertyStatement(vreq);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
wdf.getPropertyInstanceDao().deleteObjectPropertyStatement(subjectUri, predicateUri, objectUri);
|
wdf.getPropertyInstanceDao().deleteObjectPropertyStatement(subjectUri, predicateUri, objectUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Individual getObjectIndividualForStubRelation(VitroRequest vreq, String objectUri) {
|
private Individual getObjectIndividualForDeletion(VitroRequest vreq, String objectUri) {
|
||||||
|
|
||||||
Individual object = EditConfigurationUtils.getIndividual(vreq, objectUri);
|
Individual object = EditConfigurationUtils.getIndividual(vreq, objectUri);
|
||||||
if(object == null) {
|
if(object == null) {
|
||||||
|
@ -208,9 +208,13 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private void deleteObjectIndividual(VitroRequest vreq) {
|
private void deleteObjectIndividual(VitroRequest vreq) {
|
||||||
String objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
String objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||||
Individual object = getObjectIndividualForStubRelation(vreq, objectUri);
|
if(hasDeleteObjectUri(vreq)) {
|
||||||
|
//if a different individual needs to be deleted, get that uri instead
|
||||||
|
objectUri = getDeleteObjectUri(vreq);
|
||||||
|
}
|
||||||
|
Individual object = getObjectIndividualForDeletion(vreq, objectUri);
|
||||||
if(object != null) {
|
if(object != null) {
|
||||||
log.warn("Deleting individual " + object.getName() + "since property has been set to force range object deletion");
|
log.warn("Deleting individual " + object.getName() + "since property has been set to force range object deletion or has been set to delete a specific object");
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
wdf.getIndividualDao().deleteIndividual(object);
|
wdf.getIndividualDao().deleteIndividual(object);
|
||||||
} else {
|
} else {
|
||||||
|
@ -219,6 +223,16 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This checks if the object uri is not the individual to be deleted but another individual connected
|
||||||
|
private String getDeleteObjectUri(VitroRequest vreq) {
|
||||||
|
return (String) vreq.getParameter("deleteObjectUri");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasDeleteObjectUri(VitroRequest vreq) {
|
||||||
|
String deleteObjectUri = getDeleteObjectUri(vreq);
|
||||||
|
return (deleteObjectUri != null && !deleteObjectUri.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,9 @@ public class KnowledgeBaseUpdater {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUpdatableABoxGraph(String graphName) {
|
public static boolean isUpdatableABoxGraph(String graphName) {
|
||||||
return (!graphName.contains("tbox") && !graphName.contains("filegraph"));
|
return (graphName != null && !graphName.contains("tbox")
|
||||||
|
&& !graphName.contains("filegraph")
|
||||||
|
&& !graphName.contains("x-arq:UnionGraph"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class UpdateKnowledgeBase implements ServletContextListener {
|
||||||
KnowledgeBaseUpdater ontologyUpdater = new KnowledgeBaseUpdater(settings);
|
KnowledgeBaseUpdater ontologyUpdater = new KnowledgeBaseUpdater(settings);
|
||||||
boolean requiredUpdate = ontologyUpdater.updateRequired(ctx);
|
boolean requiredUpdate = ontologyUpdater.updateRequired(ctx);
|
||||||
|
|
||||||
if(!JenaDataSourceSetupBase.isFirstStartup()) {
|
if(requiredUpdate && !JenaDataSourceSetupBase.isFirstStartup()) {
|
||||||
try {
|
try {
|
||||||
ctx.setAttribute(KBM_REQURIED_AT_STARTUP, Boolean.TRUE);
|
ctx.setAttribute(KBM_REQURIED_AT_STARTUP, Boolean.TRUE);
|
||||||
migrationChangesMade = ontologyUpdater.update(ctx);
|
migrationChangesMade = ontologyUpdater.update(ctx);
|
||||||
|
|
|
@ -491,6 +491,10 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
return getDataLiteralValuesFromParameter();
|
return getDataLiteralValuesFromParameter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get a custom object uri for deletion if one exists, i.e. not the object uri for the property
|
||||||
|
public String getCustomDeleteObjectUri() {
|
||||||
|
return (String) vreq.getParameter("deleteObjectUri");
|
||||||
|
}
|
||||||
//Used for deletion in case there's a specific template to be employed
|
//Used for deletion in case there's a specific template to be employed
|
||||||
public String getDeleteTemplate() {
|
public String getDeleteTemplate() {
|
||||||
String templateName = vreq.getParameter("templateName");
|
String templateName = vreq.getParameter("templateName");
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<input type="hidden" name="predicateUri" value="${editConfiguration.predicateUri}" role="input" />
|
<input type="hidden" name="predicateUri" value="${editConfiguration.predicateUri}" role="input" />
|
||||||
<input type="hidden" name="domainUri" value="${editConfiguration.domainUri}" role="input" />
|
<input type="hidden" name="domainUri" value="${editConfiguration.domainUri}" role="input" />
|
||||||
<input type="hidden" name="rangeUri" value="${editConfiguration.rangeUri}" role="input" />
|
<input type="hidden" name="rangeUri" value="${editConfiguration.rangeUri}" role="input" />
|
||||||
|
<input type="hidden" name="deleteObjectUri" value="${editConfiguration.customDeleteObjectUri}" />
|
||||||
<#if editConfiguration.dataProperty = true>
|
<#if editConfiguration.dataProperty = true>
|
||||||
<input type="hidden" name="datapropKey" value="${editConfiguration.datapropKey}" role="input" />
|
<input type="hidden" name="datapropKey" value="${editConfiguration.datapropKey}" role="input" />
|
||||||
<input type="hidden" name="vitroNsProp" value="${editConfiguration.vitroNsProperty}" role="input" />
|
<input type="hidden" name="vitroNsProp" value="${editConfiguration.vitroNsProperty}" role="input" />
|
||||||
|
|
|
@ -205,6 +205,20 @@ name will be used as the label. -->
|
||||||
<#macro deleteLink propertyLocalName propertyName statement>
|
<#macro deleteLink propertyLocalName propertyName statement>
|
||||||
<#local url = statement.deleteUrl>
|
<#local url = statement.deleteUrl>
|
||||||
<#if url?has_content>
|
<#if url?has_content>
|
||||||
|
<#--We need to specify the actual object to be deleted as it is different from the object uri-->
|
||||||
|
<#if propertyLocalName?contains("ARG_2000028")>
|
||||||
|
<#if propertyName?contains("mailing address")>
|
||||||
|
<#local url = url + "&deleteObjectUri=" + "${statement.address!}">
|
||||||
|
<#elseif propertyName?contains("phone") || propertyName?contains("fax")>
|
||||||
|
<#local url = url + "&deleteObjectUri=" + "${statement.phone!}">
|
||||||
|
<#elseif propertyName?contains("primary email") || propertyName?contains("additional emails")>
|
||||||
|
<#local url = url + "&deleteObjectUri=" + "${statement.email!}">
|
||||||
|
<#elseif propertyName?contains("full name")>
|
||||||
|
<#local url = url + "&deleteObjectUri=" + "${statement.fullName!}">
|
||||||
|
<#elseif propertyName?contains("preferred title")>
|
||||||
|
<#local url = url + "&deleteObjectUri=" + "${statement.title!}">
|
||||||
|
</#if>
|
||||||
|
</#if>
|
||||||
<@showDeleteLink propertyLocalName url />
|
<@showDeleteLink propertyLocalName url />
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue