From 82047bb17ac69d386ee717a81e791bca6a45070d Mon Sep 17 00:00:00 2001 From: bjl23 Date: Fri, 11 Feb 2011 20:03:14 +0000 Subject: [PATCH] NIHVIVO-2120 fix for bug that generated statements with rdfs:Literal datatypes --- .../webapp/dao/jena/DataPropertyDaoJena.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java index c2080b858..9806874b4 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java @@ -488,7 +488,8 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements RDF.type, rest) ) { - datatypeURI = avfrest.getAllValuesFrom().getURI(); + datatypeURI = convertRequiredDatatypeURI( + avfrest.getAllValuesFrom().getURI()); break; } else { // check if the restriction applies to one of the individual's types @@ -497,7 +498,8 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements equivOrSubResources.addAll(ontModel.listSubjectsWithProperty(OWL.equivalentClass, rest).toList()); for(Resource equivOrSubRes : equivOrSubResources) { if (!equivOrSubRes.isAnon() && vclassURIs.contains(equivOrSubRes.getURI())) { - datatypeURI = avfrest.getAllValuesFrom().getURI(); + datatypeURI = convertRequiredDatatypeURI( + avfrest.getAllValuesFrom().getURI()); break; } } @@ -512,6 +514,18 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements return datatypeURI; } + /** + * Converts datatypes used in allValuesFromRestrictions to actual + * requirements for editing. Initially, this means we filter out + * rdfs:Literal because we don't want to populate literals with this + * as a datatype. + */ + private String convertRequiredDatatypeURI(String datatypeURI) { + return (RDFS.Literal.getURI().equals(datatypeURI)) + ? null + : datatypeURI; + } + public String getRequiredDatatypeURI(Individual individual, DataProperty dataprop) { return getRequiredDatatypeURI(individual,dataprop,getVClassURIs(individual)); }