From 4ce6dc2f8ce1d3a6a2ce2abef5ba8d82a6079cc1 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Thu, 9 Feb 2023 16:25:36 +0100 Subject: [PATCH] fix creation of faux property with xml literal range value (#363) Co-authored-by: Georgy Litvinov --- .../edit/FauxPropertyRetryController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java index ae59726f8..500e1ba75 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java @@ -91,6 +91,7 @@ public class FauxPropertyRetryController extends BaseEditController { private static class EpoPopulator { private static final String LITERAL = "http://www.w3.org/2000/01/rdf-schema#Literal"; + private static final String XML_LITERAL = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"; private final VitroRequest req; private final ServletContext ctx; private final WebappDaoFactory wadf; @@ -335,11 +336,22 @@ public class FauxPropertyRetryController extends BaseEditController { option.setBody("Literal"); option.setSelected(true); list.add(option); + } else if (rangeUri.equals(XML_LITERAL)) { + Option option = new Option(); + option.setValue(rangeUri); + option.setBody("XML Literal"); + option.setSelected(true); + list.add(option); } else { Datatype dataType = wadf.getDatatypeDao().getDatatypeByURI(rangeUri); Option option = new Option(); - option.setValue(dataType.getUri()); - option.setBody(dataType.getName()); + if (dataType != null) { + option.setValue(dataType.getUri()); + option.setBody(dataType.getName()); + } else { + option.setValue(rangeUri); + option.setBody(rangeUri); + } option.setSelected(true); list.add(option); }