Issue/VIVO 3739 : fix for data property editing form (#323)

* fix: compare blank node id with uri safely
This commit is contained in:
Georgy Litvinov 2022-08-19 14:13:06 +02:00 committed by GitHub
parent ce680d9cd7
commit f8c38b8233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
*/