VIVO-774 Fix display of unpopulated properties
Unpopulated properties with no domain URI were not recognized as faux properties Use the faux property display name instead of the base property name.
This commit is contained in:
parent
dfb9b7517e
commit
474b0abb44
4 changed files with 14 additions and 18 deletions
|
@ -26,6 +26,7 @@ import com.hp.hpl.jena.query.ResultSet;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.ResIterator;
|
import com.hp.hpl.jena.rdf.model.ResIterator;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
|
||||||
|
@ -273,9 +274,11 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
|
|
||||||
private static final String VCARD_KIND_URI = "http://www.w3.org/2006/vcard/ns#Kind";
|
private static final String VCARD_KIND_URI = "http://www.w3.org/2006/vcard/ns#Kind";
|
||||||
private static final String VCARD_NAMESPACE = "http://www.w3.org/2006/vcard/ns#";
|
private static final String VCARD_NAMESPACE = "http://www.w3.org/2006/vcard/ns#";
|
||||||
|
|
||||||
private void storeQualifiedByRoot(OntResource context, String rangeURI) {
|
private void storeQualifiedByRoot(OntResource context, String rangeURI) {
|
||||||
if (rangeURI.startsWith(VCARD_NAMESPACE)) {
|
if (rangeURI.startsWith(VCARD_NAMESPACE)) {
|
||||||
updatePropertyResourceURIValue(context, QUALIFIED_BY_ROOT, VCARD_KIND_URI);
|
updatePropertyResourceURIValue(context, QUALIFIED_BY_ROOT,
|
||||||
|
VCARD_KIND_URI);
|
||||||
} else {
|
} else {
|
||||||
updatePropertyResourceURIValue(context, QUALIFIED_BY_ROOT, null);
|
updatePropertyResourceURIValue(context, QUALIFIED_BY_ROOT, null);
|
||||||
}
|
}
|
||||||
|
@ -504,8 +507,6 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
+ " :hasConfiguration ?config . \n" //
|
+ " :hasConfiguration ?config . \n" //
|
||||||
+ "} \n"; //
|
+ "} \n"; //
|
||||||
|
|
||||||
// TODO Add a filter that will reject solutions that include
|
|
||||||
// qualifiedByDomain
|
|
||||||
private static final String QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN = "" //
|
private static final String QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN = "" //
|
||||||
+ "PREFIX : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#> \n" //
|
+ "PREFIX : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#> \n" //
|
||||||
+ "\n" //
|
+ "\n" //
|
||||||
|
@ -515,6 +516,9 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
+ " :configContextFor ?baseUri ; \n" //
|
+ " :configContextFor ?baseUri ; \n" //
|
||||||
+ " :qualifiedBy ?rangeUri ; \n" //
|
+ " :qualifiedBy ?rangeUri ; \n" //
|
||||||
+ " :hasConfiguration ?config . \n" //
|
+ " :hasConfiguration ?config . \n" //
|
||||||
|
+ " FILTER NOT EXISTS { \n" //
|
||||||
|
+ " ?context :qualifiedByDomain ?domainUri \n" //
|
||||||
|
+ " } \n" //
|
||||||
+ "} \n"; //
|
+ "} \n"; //
|
||||||
|
|
||||||
private static class ParserLocateConfigContext extends
|
private static class ParserLocateConfigContext extends
|
||||||
|
@ -558,7 +562,8 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
String baseUri, String rangeUri) {
|
String baseUri, String rangeUri) {
|
||||||
try (LockedOntModel displayModel = lockableDisplayModel.read()) {
|
try (LockedOntModel displayModel = lockableDisplayModel.read()) {
|
||||||
String queryString;
|
String queryString;
|
||||||
if (domainUri == null || domainUri.trim().isEmpty()) {
|
if (domainUri == null || domainUri.trim().isEmpty()
|
||||||
|
|| domainUri.equals(OWL.Thing.getURI())) {
|
||||||
queryString = bindValues(
|
queryString = bindValues(
|
||||||
QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN,
|
QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN,
|
||||||
uriValue("baseUri", baseUri),
|
uriValue("baseUri", baseUri),
|
||||||
|
|
|
@ -69,8 +69,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
||||||
boolean editing, List<DataProperty> populatedDataPropertyList) {
|
boolean editing, List<DataProperty> populatedDataPropertyList) {
|
||||||
|
|
||||||
super(dp, subject, vreq);
|
super(dp, subject, vreq, dp.getPublicName());
|
||||||
setName(dp.getPublicName());
|
|
||||||
|
|
||||||
// Get the config for this data property
|
// Get the config for this data property
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -86,8 +86,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
boolean editing)
|
boolean editing)
|
||||||
throws InvalidConfigurationException {
|
throws InvalidConfigurationException {
|
||||||
|
|
||||||
super(op, subject, vreq);
|
super(op, subject, vreq, op.getDomainPublic());
|
||||||
setName(op.getDomainPublic());
|
|
||||||
|
|
||||||
sortDirection = op.getDomainEntitySortDirection();
|
sortDirection = op.getDomainEntitySortDirection();
|
||||||
domainUri = op.getDomainVClassURI();
|
domainUri = op.getDomainVClassURI();
|
||||||
|
@ -232,7 +231,6 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
public static ObjectPropertyTemplateModel getObjectPropertyTemplateModel(ObjectProperty op,
|
public static ObjectPropertyTemplateModel getObjectPropertyTemplateModel(ObjectProperty op,
|
||||||
Individual subject, VitroRequest vreq, boolean editing,
|
Individual subject, VitroRequest vreq, boolean editing,
|
||||||
List<ObjectProperty> populatedObjectPropertyList) {
|
List<ObjectProperty> populatedObjectPropertyList) {
|
||||||
|
|
||||||
if (op.getCollateBySubclass()) {
|
if (op.getCollateBySubclass()) {
|
||||||
try {
|
try {
|
||||||
return new CollatedObjectPropertyTemplateModel(op, subject, vreq, editing, populatedObjectPropertyList);
|
return new CollatedObjectPropertyTemplateModel(op, subject, vreq, editing, populatedObjectPropertyList);
|
||||||
|
|
|
@ -13,13 +13,11 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
||||||
|
|
||||||
|
@ -43,14 +41,13 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
PropertyTemplateModel(Property property, Individual subject, VitroRequest vreq, String name) {
|
||||||
|
|
||||||
PropertyTemplateModel(Property property, Individual subject, VitroRequest vreq) {
|
|
||||||
this.vreq = vreq;
|
this.vreq = vreq;
|
||||||
subjectUri = subject.getURI();
|
subjectUri = subject.getURI();
|
||||||
this.property = property;
|
this.property = property;
|
||||||
propertyUri = property.getURI();
|
propertyUri = property.getURI();
|
||||||
localName = property.getLocalName();
|
localName = property.getLocalName();
|
||||||
|
this.name = name;
|
||||||
setVerboseDisplayValues(property);
|
setVerboseDisplayValues(property);
|
||||||
addUrl = "";
|
addUrl = "";
|
||||||
|
|
||||||
|
@ -106,6 +103,7 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
FauxProperty fauxProperty = isFauxProperty(property);
|
FauxProperty fauxProperty = isFauxProperty(property);
|
||||||
if (fauxProperty != null) {
|
if (fauxProperty != null) {
|
||||||
verboseDisplay.put("fauxProperty", assembleFauxPropertyValues(fauxProperty));
|
verboseDisplay.put("fauxProperty", assembleFauxPropertyValues(fauxProperty));
|
||||||
|
this.name = fauxProperty.getDisplayName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,10 +127,6 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
protected abstract int getPropertyDisplayTier(Property p);
|
protected abstract int getPropertyDisplayTier(Property p);
|
||||||
protected abstract Route getPropertyEditRoute();
|
protected abstract Route getPropertyEditRoute();
|
||||||
|
|
||||||
protected void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s on %s",
|
return String.format("%s on %s",
|
||||||
propertyUri != null ? propertyUri : "null Prop URI",
|
propertyUri != null ? propertyUri : "null Prop URI",
|
||||||
|
|
Loading…
Add table
Reference in a new issue