From b9b6c50e87371e865652f7c397b492fd4b568c5d Mon Sep 17 00:00:00 2001 From: ryounes Date: Tue, 22 Mar 2011 18:52:39 +0000 Subject: [PATCH] NIHVIVO-2186 Filter out incomplete object property statements for non-editing users. --- .../BaseObjectPropertyDataPostProcessor.java | 18 ------------------ webapp/web/config/listViewConfig-default.xml | 6 +++++- webapp/web/config/listViewConfig-vitroLink.xml | 3 +++ .../individual/propStatement-vitroLink.ftl | 2 +- webapp/web/templates/freemarker/body/test.ftl | 3 --- 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseObjectPropertyDataPostProcessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseObjectPropertyDataPostProcessor.java index 76bf47ebc..4ca9773f6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseObjectPropertyDataPostProcessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseObjectPropertyDataPostProcessor.java @@ -64,24 +64,6 @@ public abstract class BaseObjectPropertyDataPostProcessor implements } } - /* This is a temporary measure to handle the fact that the current Individual.getMoniker() - * method returns the individual's VClass if moniker is null. We want to replicate that - * behavior here, but in future the moniker property (along with other Vitro namespace - * properties) will be removed. In addition, this type of logic (display x if it exists, otherwise y) - * will be moved into the display modules (Editing and Display Configuration Improvements). - */ -// rjy7 Now Individual.getMoniker() returns only the moniker, not the VClass, so no reason to call the method -// if the sparql query returns a null moniker. -// protected void addMoniker(Map map, String monikerKey, String objectKey) { -// String moniker = map.get(monikerKey); -// if (moniker == null) { -// Individual ind = getIndividual(map.get(objectKey)); -// if (ind != null) { -// map.put(monikerKey, ind.getMoniker()); -// } -// } -// } - protected Individual getIndividual(String uri) { return wdf.getIndividualDao().getIndividualByURI(uri); } diff --git a/webapp/web/config/listViewConfig-default.xml b/webapp/web/config/listViewConfig-default.xml index 57e809402..54c85d2f4 100644 --- a/webapp/web/config/listViewConfig-default.xml +++ b/webapp/web/config/listViewConfig-default.xml @@ -13,12 +13,16 @@ SELECT ?subclass ?object ?name ?moniker WHERE { + ?subject ?property ?object OPTIONAL { ?object a ?subclass } FILTER ( afn:namespace(?subclass) != "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" ) OPTIONAL { ?object rdfs:label ?name } - OPTIONAL { ?object vitro:moniker ?moniker } + OPTIONAL { ?object vitro:moniker ?moniker } + + FILTER ( bound(?name) ) + } ORDER BY ?subclass ?name ?object diff --git a/webapp/web/config/listViewConfig-vitroLink.xml b/webapp/web/config/listViewConfig-vitroLink.xml index cffb18540..058483b5d 100644 --- a/webapp/web/config/listViewConfig-vitroLink.xml +++ b/webapp/web/config/listViewConfig-vitroLink.xml @@ -18,6 +18,9 @@ OPTIONAL { ?link vitro:linkAnchor ?anchor } OPTIONAL { ?link vitro:linkURL ?url } OPTIONAL { ?link vitro:linkDisplayRank ?rank } + + FILTER ( bound(?anchor) && bound(?url) ) + } ORDER BY ?rank diff --git a/webapp/web/templates/freemarker/body/partials/individual/propStatement-vitroLink.ftl b/webapp/web/templates/freemarker/body/partials/individual/propStatement-vitroLink.ftl index 122d2a3a6..51e785bfd 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/propStatement-vitroLink.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/propStatement-vitroLink.ftl @@ -11,5 +11,5 @@ <#if statement.url??> ${linkText} <#else> - ${linkText} (no url provided for link) + ${linkText} (no url provided for link) \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/test.ftl b/webapp/web/templates/freemarker/body/test.ftl index c711808d1..1dc72abb8 100644 --- a/webapp/web/templates/freemarker/body/test.ftl +++ b/webapp/web/templates/freemarker/body/test.ftl @@ -3,6 +3,3 @@ <#-- FreeMarker test cases -->

${title}

- - -