adding some unit tests to JenaIngestUtils
This commit is contained in:
parent
1baf710499
commit
d65cc2b106
16 changed files with 328 additions and 4 deletions
|
@ -598,7 +598,8 @@ public class JenaIngestController extends BaseEditController {
|
|||
private void processMergeResourceRequest(VitroRequest vreq) {
|
||||
String uri1 = vreq.getParameter("uri1"); // get primary uri
|
||||
String uri2 = vreq.getParameter("uri2"); // get secondary uri
|
||||
String usePrimaryLabelOnly = vreq.getParameter("usePrimaryLabelOnly");
|
||||
String usePrimaryLabelOnlyStr = vreq.getParameter("usePrimaryLabelOnly");;
|
||||
boolean usePrimaryLabelOnly = usePrimaryLabelOnlyStr != null && !usePrimaryLabelOnlyStr.isEmpty();
|
||||
|
||||
if(uri1!=null){
|
||||
JenaIngestUtils utils = new JenaIngestUtils();
|
||||
|
|
|
@ -615,8 +615,17 @@ public class JenaIngestUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges statements about resource uri2 into resource uri1 and delete uri2.
|
||||
* @param uri1 The resource to merge to
|
||||
* @param uri2 The resource to merge from
|
||||
* @param baseOntModel The model containing the relevant statements
|
||||
* @param tboxOntModel The model containing class and property data
|
||||
* @param usePrimaryLabelOnly If true, discard rdfs:labels from uri2. Otherwise retain.
|
||||
* @return
|
||||
*/
|
||||
public MergeResult doMerge(String uri1, String uri2, OntModel baseOntModel,
|
||||
OntModel tboxOntModel, String usePrimaryLabelOnly){
|
||||
OntModel tboxOntModel, boolean usePrimaryLabelOnly){
|
||||
|
||||
boolean functionalPresent = false;
|
||||
|
||||
|
@ -660,8 +669,7 @@ public class JenaIngestUtils {
|
|||
// part of the primary resource.
|
||||
leftoverModel.add(res2, stmt.getPredicate(), stmt.getObject());
|
||||
functionalPresent = true;
|
||||
} else if (stmt.getPredicate().equals(RDFS.label) &&
|
||||
usePrimaryLabelOnly!=null && !usePrimaryLabelOnly.isEmpty()) {
|
||||
} else if (stmt.getPredicate().equals(RDFS.label) && usePrimaryLabelOnly) {
|
||||
// if the checkbox is checked, use primary resource rdfs:labels only
|
||||
// and dump secondary resource rdfs:labels into leftoverModel
|
||||
leftoverModel.add(res2, stmt.getPredicate(), stmt.getObject());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue