update to model utils to replace Capital letter with lowercase for one of the relationships, updates to concept generator to enable deletion of relationship on remove and not concept individual itself, also including addition of inverse property as well, also updating grant role generator to identify correct inverse predicate and not 'relatedRole' as it had been

This commit is contained in:
hjkhjk54 2011-12-05 19:22:53 +00:00
parent 6872af6545
commit acc7dfcfda
6 changed files with 45 additions and 14 deletions

View file

@ -279,12 +279,13 @@ var addConceptForm = {
if ($(link)[0] === $('.remove:last')[0]) {
removeLast = true;
}
//Using primitive rdf edit which expects an n3 string for deletion
$.ajax({
url: $(link).attr('href'),
type: 'POST',
data: {
deletion: $(link).parents('.existingConcept').data('conceptNodeUri')
additions: '',
retractions: addConceptForm.generateDeletionN3($(link).parents('.existingConcept').data('conceptNodeUri'))
},
dataType: 'json',
context: link, // context for callback
@ -309,6 +310,14 @@ var addConceptForm = {
}
}
});
},
generateDeletionN3: function(conceptNodeUri) {
var n3String = "<" + addConceptForm.subjectUri + "> <" + addConceptForm.predicateUri + "> <" + conceptNodeUri + "> .";
//add inverse string to also be removed
if(addConceptForm.inversePredicateUri.length > 0) {
n3String += "<" + conceptNodeUri + "> <" + addConceptForm.inversePredicateUri + "> <" + addConceptForm.subjectUri + "> .";
}
return n3String;
}
};

View file

@ -4,6 +4,7 @@
<#assign existingConcepts = editConfiguration.pageData.existingConcepts/>
<#assign userDefinedConceptUrl = editConfiguration.pageData.userDefinedConceptUrl/>
<#assign sources = editConfiguration.pageData.searchServices/>
<#assign inversePredicate = editConfiguration.pageData.inversePredicate />
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
@ -52,7 +53,7 @@
</#if>
</span>
</span>
&nbsp;<a href="${urls.base}/edit/primitiveDelete" class="remove">Remove</a>
&nbsp;<a href="${urls.base}/edit/primitiveRdfEdit" class="remove">Remove</a>
</span>
</li>
@ -121,7 +122,10 @@
<script type="text/javascript">
var customFormData = {
dataServiceUrl: '${urls.base}/conceptSearchService'
dataServiceUrl: '${urls.base}/conceptSearchService',
subjectUri: '${editConfiguration.subjectUri}',
predicateUri: '${editConfiguration.predicateUri}',
inversePredicateUri: '${inversePredicate}'
};
</script>

View file

@ -163,11 +163,17 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
//Since the concept node from an external vocabulary may already be in the system
//The label and is defined by may already be defined and don't require re-saving
private List<String> generateN3Required(VitroRequest vreq) {
return list(
List<String> n3Required = list(
getPrefixesString() + "\n" +
"?subject ?predicate ?conceptNode .\n" +
"?conceptNode <" + RDF.type.getURI() + "> <http://www.w3.org/2002/07/owl#Thing> ."
);
List<String> inversePredicate = getInversePredicate(vreq);
//Adding inverse predicate if it exists
if(inversePredicate.size() > 0) {
n3Required.add("?conceptNode <" + inversePredicate.get(0) + "> ?subject .");
}
return n3Required;
}
//Don't think there's any n3 optional here
@ -316,7 +322,12 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
formSpecificData.put("userDefinedConceptUrl", getUserDefinedConceptUrl(vreq));
//Add URIs and labels for different services
formSpecificData.put("searchServices", ConceptSearchServiceUtils.getVocabSources());
List<String> inversePredicate = getInversePredicate(vreq);
if(inversePredicate.size() > 0) {
formSpecificData.put("inversePredicate", inversePredicate.get(0));
} else {
formSpecificData.put("inversePredicate", "");
}
editConfiguration.setFormSpecificData(formSpecificData);
}

View file

@ -196,7 +196,7 @@ public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator
editString += "?role a <" + getRoleType(vreq) + "> .";
editString += "?role <" + getRoleToGrantPredicate(vreq) + "> ?grant .";
editString += "?grant a core:Grant ;" +
"core:relatedRole ?role .";
"<" + getGrantToRolePredicate(vreq) + "> ?role .";
return editString;
}
@ -650,7 +650,7 @@ public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator
}
private Object getHasCoPrincipalInvestigatorURI() {
return getVivoOntologyCoreNamespace() + "hasPrincipalInvestigatorRole";
return getVivoOntologyCoreNamespace() + "hasCo-PrincipalInvestigatorRole";
}
@ -660,7 +660,7 @@ public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator
}
private Object getHasPrincipalInvestigatorURI() {
return getVivoOntologyCoreNamespace() + "hasCo-PrincipalInvestigatorRole";
return getVivoOntologyCoreNamespace() + "hasPrincipalInvestigatorRole";
}

View file

@ -163,18 +163,25 @@ public class AddUserDefinedConceptGenerator extends VivoBaseGenerator implement
//Here, the node is typed as a skos concept
private List<String> generateN3Required(VitroRequest vreq) {
return list(
List<String> n3Required = list(
getPrefixesString() + "\n" +
"?subject ?predicate ?conceptNode .\n"
);
List<String> inversePredicate = getInversePredicate(vreq);
//Adding inverse predicate if it exists
if(inversePredicate.size() > 0) {
n3Required.add("?conceptNode <" + inversePredicate.get(0) + "> ?subject .");
}
return n3Required;
}
//Optional b/c user may select an existing SKOS concept
private List<String> generateN3Optional() {
return list(
"?conceptNode <" + VitroVocabulary.RDF_TYPE + "> <" + SKOSConceptType + "> .\n" +
"?conceptNode <" + label + "> ?conceptLabel ."
);
"?conceptNode <" + VitroVocabulary.RDF_TYPE + "> <" + SKOSConceptType + "> .\n" +
"?conceptNode <" + label + "> ?conceptLabel ."
);
}

View file

@ -23,7 +23,7 @@ public class ModelUtils {
private static final String processPropertyURI = "http://vivoweb.org/ontology/core#roleRealizedIn";
private static final String processPropertyInverseURI = "http://vivoweb.org/ontology/core#realizedRole";
private static final String nonProcessPropertyURI = "http://vivoweb.org/ontology/core#roleContributesTo";
private static final String nonProcessPropertyInverseURI = "http://vivoweb.org/ontology/core#ContributingRole";
private static final String nonProcessPropertyInverseURI = "http://vivoweb.org/ontology/core#contributingRole";
private static Set<String> processClass = new HashSet<String>();
static {