Issue/VIVO 3739 : fix for data property editing form (#323)
* fix: compare blank node id with uri safely
This commit is contained in:
parent
ce680d9cd7
commit
f8c38b8233
1 changed files with 10 additions and 1 deletions
|
@ -643,7 +643,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
|||
|
||||
if (existingValue == null ) {
|
||||
model.add(res, prop, model.createResource(uri));
|
||||
} else if (!(existingValue.getURI()).equals(uri)) {
|
||||
} else if (!isEqual(uri, existingValue)) {
|
||||
model.removeAll(res, prop, null);
|
||||
model.add(res, prop, model.createResource(uri));
|
||||
}
|
||||
|
@ -651,6 +651,15 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isEqual(String uri, Resource existingValue) {
|
||||
if (existingValue.asNode().isBlank()) {
|
||||
final String blankNodeId = existingValue.asNode().getBlankNodeId().toString();
|
||||
return uri.endsWith(blankNodeId);
|
||||
} else {
|
||||
return existingValue.getURI().equals(uri);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* convenience method for use with functional object properties
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue