From b024863f428758008e0b6abaf34c63b8a3db9e01 Mon Sep 17 00:00:00 2001 From: bdc34 Date: Wed, 12 Jan 2011 20:00:42 +0000 Subject: [PATCH] Changing VClassGroupCache to not filter out groups and classes with no individuals as part of NIHVIVO-1666 Fixing URLs in browse widget as part of NIHVIVO-592 --- .../vitro/webapp/beans/VClassGroup.java | 13 + .../vitro/webapp/controller/JSONServlet.java | 236 ++++++++++-------- .../webapp/dao/jena/VClassGroupCache.java | 18 +- .../webapp/dao/jena/VClassGroupDaoJena.java | 14 ++ .../pageDataGetter/ClassGroupPageData.java | 42 +++- .../VClassGroupTemplateModel.java | 12 + .../webapp/web/widgets/BrowseWidget.java | 53 ++-- .../freemarker/widgets/widget-browse.ftl | 35 +-- 8 files changed, 277 insertions(+), 146 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/VClassGroup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/VClassGroup.java index efe8c2bf8..12efffcd1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/VClassGroup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/VClassGroup.java @@ -23,6 +23,19 @@ public class VClassGroup extends LinkedList implements Comparable= 0; + } + + public int getIndividualCount() { + return individualCount; + } + + public void setIndividualCount(int individualCount) { + this.individualCount = individualCount; + } public int getDisplayRank() { return displayRank; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java index 723837348..3a27a8401 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java @@ -13,6 +13,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; @@ -77,11 +78,57 @@ public class JSONServlet extends VitroHttpServlet { } - private void getLuceneIndividualsByVClass(HttpServletRequest req, HttpServletResponse resp) { - - VitroRequest vreq = new VitroRequest(req); + private void getLuceneIndividualsByVClass( HttpServletRequest req, HttpServletResponse resp ){ String errorMessage = null; - String message = null; + JSONObject rObj = null; + try{ + VitroRequest vreq = new VitroRequest(req); + VClass vclass=null; + + + String vitroClassIdStr = vreq.getParameter("vclassId"); + if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ + vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); + if (vclass == null) { + log.debug("Couldn't retrieve vclass "); + throw new Exception (errorMessage = "Class " + vitroClassIdStr + " not found"); + } + }else{ + log.debug("parameter vclassId URI parameter expected "); + throw new Exception("parameter vclassId URI parameter expected "); + } + rObj = getLuceneIndividualsByVClass(vclass.getURI(),req,resp,getServletContext()); + }catch(Exception ex){ + errorMessage = ex.toString(); + log.error(ex,ex); + } + + if( rObj == null ) + rObj = new JSONObject(); + + try{ + resp.setCharacterEncoding("UTF-8"); + resp.setContentType("application/json;charset=UTF-8"); + + if( errorMessage != null ){ + rObj.put("errorMessage", errorMessage); + resp.setStatus(500 /*HttpURLConnection.HTTP_SERVER_ERROR*/); + }else{ + rObj.put("errorMessage", ""); + } + Writer writer = resp.getWriter(); + writer.write(rObj.toString()); + }catch(JSONException jse){ + log.error(jse,jse); + } catch (IOException e) { + log.error(e,e); + } + + } + + protected static JSONObject getLuceneIndividualsByVClass(String vclassURI, HttpServletRequest req, HttpServletResponse resp, ServletContext context) throws Exception { + + VitroRequest vreq = new VitroRequest(req); VClass vclass=null; JSONObject rObj = new JSONObject(); @@ -109,111 +156,90 @@ public class JSONServlet extends VitroHttpServlet { //need an unfiltered dao to get firstnames and lastnames WebappDaoFactory fullWdf = vreq.getFullWebappDaoFactory(); - - - try { - String vitroClassIdStr = vreq.getParameter("vclassId"); - if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ - vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); - if (vclass == null) { - log.debug("Couldn't retrieve vclass "); - throw new Exception (errorMessage = "Class " + vitroClassIdStr + " not found"); - } - }else{ - log.debug("parameter vclassId URI parameter expected "); - throw new Exception("parameter vclassId URI parameter expected "); - } - - rObj.put("vclass", - new JSONObject().put("URI",vclass.getURI()) - .put("name",vclass.getName())); - - if (vclass != null) { - String alpha = EntityListController.getAlphaParamter(vreq); - int page = EntityListController.getPageParameter(vreq); - Map map = EntityListController.getResultsForVClass( - vclass.getURI(), - page, - alpha, - vreq.getPortal(), - vreq.getWebappDaoFactory().getPortalDao().isSinglePortal(), - vreq.getWebappDaoFactory().getIndividualDao(), - getServletContext()); - rObj.put("totalCount", map.get("totalCount")); - rObj.put("alpha", map.get("alpha")); - - List inds = (List)map.get("entities"); - List indsTm = new ArrayList(); - JSONArray jInds = new JSONArray(); - for(Individual ind : inds ){ - JSONObject jo = new JSONObject(); - jo.put("URI", ind.getURI()); - jo.put("label",ind.getRdfsLabel()); - jo.put("name",ind.getName()); - jo.put("thumbUrl", ind.getThumbUrl()); - jo.put("imageUrl", ind.getImageUrl()); - jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq.getWebappDaoFactory())); - - String moniker = getDataPropertyValue(ind, monikerDp, fullWdf); - jo.put("moniker", moniker); - jo.put("vclassName", getVClassName(ind,moniker,fullWdf)); - - jo.put("perferredTitle", getDataPropertyValue(ind, perferredTitleDp, fullWdf)); - jo.put("firstName", getDataPropertyValue(ind, fNameDp, fullWdf)); - jo.put("lastName", getDataPropertyValue(ind, lNameDp, fullWdf)); - - jInds.put(jo); - } - rObj.put("individuals", jInds); - - JSONArray wpages = new JSONArray(); - List pages = (List)map.get("pages"); - for( PageRecord pr: pages ){ - JSONObject p = new JSONObject(); - p.put("text", pr.text); - p.put("param", pr.param); - p.put("index", pr.index); - wpages.put( p ); - } - rObj.put("pages",wpages); - - JSONArray jletters = new JSONArray(); - List letters = Controllers.getLetters(); - for( String s : letters){ - JSONObject jo = new JSONObject(); - jo.put("text", s); - jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); - jletters.put( jo ); - } - rObj.put("letters", jletters); - } - - }catch(Exception ex){ - errorMessage = ex.getMessage(); - } - try{ - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("application/json;charset=UTF-8"); - - if( errorMessage != null ){ - rObj.put("errorMessage", errorMessage); - resp.setStatus(500 /*HttpURLConnection.HTTP_SERVER_ERROR*/); - }else{ - rObj.put("errorMessage", ""); - } - Writer writer = resp.getWriter(); - writer.write(rObj.toString()); - }catch(JSONException jse){ - log.error(jse,jse); - } catch (IOException e) { - log.error(e,e); + + String vitroClassIdStr = vreq.getParameter("vclassId"); + if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ + vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); + if (vclass == null) { + log.debug("Couldn't retrieve vclass "); + throw new Exception ("Class " + vitroClassIdStr + " not found"); + } + }else{ + log.debug("parameter vclassId URI parameter expected "); + throw new Exception("parameter vclassId URI parameter expected "); } - return; + + rObj.put("vclass", + new JSONObject().put("URI",vclass.getURI()) + .put("name",vclass.getName())); + + if (vclass != null) { + String alpha = EntityListController.getAlphaParamter(vreq); + int page = EntityListController.getPageParameter(vreq); + Map map = EntityListController.getResultsForVClass( + vclass.getURI(), + page, + alpha, + vreq.getPortal(), + vreq.getWebappDaoFactory().getPortalDao().isSinglePortal(), + vreq.getWebappDaoFactory().getIndividualDao(), + context); + + rObj.put("totalCount", map.get("totalCount")); + rObj.put("alpha", map.get("alpha")); + + List inds = (List)map.get("entities"); + List indsTm = new ArrayList(); + JSONArray jInds = new JSONArray(); + for(Individual ind : inds ){ + JSONObject jo = new JSONObject(); + jo.put("URI", ind.getURI()); + jo.put("label",ind.getRdfsLabel()); + jo.put("name",ind.getName()); + jo.put("thumbUrl", ind.getThumbUrl()); + jo.put("imageUrl", ind.getImageUrl()); + jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq.getWebappDaoFactory())); + + String moniker = getDataPropertyValue(ind, monikerDp, fullWdf); + jo.put("moniker", moniker); + jo.put("vclassName", getVClassName(ind,moniker,fullWdf)); + + jo.put("perferredTitle", getDataPropertyValue(ind, perferredTitleDp, fullWdf)); + jo.put("firstName", getDataPropertyValue(ind, fNameDp, fullWdf)); + jo.put("lastName", getDataPropertyValue(ind, lNameDp, fullWdf)); + + jInds.put(jo); + } + rObj.put("individuals", jInds); + + JSONArray wpages = new JSONArray(); + List pages = (List)map.get("pages"); + for( PageRecord pr: pages ){ + JSONObject p = new JSONObject(); + p.put("text", pr.text); + p.put("param", pr.param); + p.put("index", pr.index); + wpages.put( p ); + } + rObj.put("pages",wpages); + + JSONArray jletters = new JSONArray(); + List letters = Controllers.getLetters(); + for( String s : letters){ + JSONObject jo = new JSONObject(); + jo.put("text", s); + jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); + jletters.put( jo ); + } + rObj.put("letters", jletters); + } + + return rObj; } - private String getVClassName(Individual ind, String moniker, + private static String getVClassName(Individual ind, String moniker, WebappDaoFactory fullWdf) { /* so the moniker frequently has a vclass name in it. Try to return * the vclass name that is the same as the moniker so that the templates @@ -239,7 +265,7 @@ public class JSONServlet extends VitroHttpServlet { return ""; } - String getDataPropertyValue(Individual ind, DataProperty dp, WebappDaoFactory wdf){ + static String getDataPropertyValue(Individual ind, DataProperty dp, WebappDaoFactory wdf){ List values = wdf.getDataPropertyStatementDao() .getDataPropertyValuesForIndividualByProperty(ind, dp); if( values == null || values.isEmpty() ) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java index c57c58910..9c142b0f5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java @@ -79,6 +79,20 @@ public class VClassGroupCache implements ServletContextListener{ return getGroups(getVCGDao(),portalId ); } + /** + * May return null. + */ + public VClassGroup getGroup( int portalId, String vClassGroupURI ){ + if( vClassGroupURI == null || vClassGroupURI.isEmpty() ) + return null; + List cgList = getGroups(portalId); + for( VClassGroup cg : cgList ){ + if( vClassGroupURI.equals( cg.getURI())) + return cg; + } + return null; + } + public void clearGroupCache(){ _groupListMap = new ConcurrentHashMap>(); } @@ -90,13 +104,13 @@ public class VClassGroupCache implements ServletContextListener{ log.debug("needed to build vclassGroups for portal " + portalId); // Get all classgroups, each populated with a list of their member vclasses List groups = - vcgDao.getPublicGroupsWithVClasses(ORDER_BY_DISPLAYRANK, !INCLUDE_UNINSTANTIATED, includeIndividualCount); + vcgDao.getPublicGroupsWithVClasses(ORDER_BY_DISPLAYRANK, INCLUDE_UNINSTANTIATED, includeIndividualCount); // remove classes that have been configured to be hidden from search results vcgDao.removeClassesHiddenFromSearch(groups); // now cull out the groups with no populated classes - vcgDao.removeUnpopulatedGroups(groups); + //vcgDao.removeUnpopulatedGroups(groups); return groups; } else { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java index 0f66177d3..9c7b2e87f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java @@ -158,9 +158,13 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao { } */ if (groups.size()>0) { + if( getIndividualCount ) + addIndividualCountToGroups(groups); return groups; } else { classDao.addVClassesToGroups(groups); + if( getIndividualCount ) + addIndividualCountToGroups(groups); return groups; } } finally { @@ -169,6 +173,16 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao { } + private void addIndividualCountToGroups( List cgList ){ + for( VClassGroup cg : cgList){ + int count = 0; + for( VClass vc : cg){ + count = count + vc.getEntityCount(); + } + cg.setIndividualCount(count); + } + } + public VClassGroup groupFromGroupIndividual(Individual groupInd) { if (groupInd==null) { return null; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/pageDataGetter/ClassGroupPageData.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/pageDataGetter/ClassGroupPageData.java index 5e7ac5750..f098d068a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/pageDataGetter/ClassGroupPageData.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/pageDataGetter/ClassGroupPageData.java @@ -16,6 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; +import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel; /** * This will pass these variables to the template: @@ -67,12 +68,51 @@ public class ClassGroupPageData implements PageDataGetter{ return data; } + public static VClassGroupTemplateModel getClassGroup(String classGroupUri, ServletContext context, VitroRequest vreq){ + + VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context); + List vcgList = vcgc.getGroups(vreq.getPortalId()); + VClassGroup group = null; + for( VClassGroup vcg : vcgList){ + if( vcg.getURI() != null && vcg.getURI().equals(classGroupUri)){ + group = vcg; + break; + } + } + + if( classGroupUri != null && !classGroupUri.isEmpty() && group == null ){ + /*This could be for two reasons: one is that the classgroup doesn't exist + * The other is that there are no individuals in any of the classgroup's classes */ + group = vreq.getWebappDaoFactory().getVClassGroupDao().getGroupByURI(classGroupUri); + if( group != null ){ + List vcgFullList = vreq.getWebappDaoFactory().getVClassGroupDao() + .getPublicGroupsWithVClasses(false, true, false); + for( VClassGroup vcg : vcgFullList ){ + if( classGroupUri.equals(vcg.getURI()) ){ + group = vcg; + break; + } + } + if( group == null ){ + log.error("Cannot get classgroup '" + classGroupUri + "'"); + return null; + }else{ + setAllClassCountsToZero(group); + } + }else{ + log.error("classgroup " + classGroupUri + " does not exist in the system"); + return null; + } + } + + return new VClassGroupTemplateModel(group); + } public String getType(){ return DisplayVocabulary.CLASSGROUP_PAGE_TYPE; } - protected void setAllClassCountsToZero(VClassGroup vcg){ + protected static void setAllClassCountsToZero(VClassGroup vcg){ for(VClass vc : vcg){ vc.setEntityCount(0); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/VClassGroupTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/VClassGroupTemplateModel.java index f81e4b489..0d858735b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/VClassGroupTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/VClassGroupTemplateModel.java @@ -54,4 +54,16 @@ public class VClassGroupTemplateModel extends BaseTemplateModel { return classes; } + + public String getIndividualCount(){ + if( vClassGroup.isIndividualCountSet() ) + return Integer.toString(vClassGroup.getIndividualCount()); + else + return ""; + } + + public boolean isIndividualCountSet(){ + return vClassGroup.isIndividualCountSet(); + } + } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/BrowseWidget.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/BrowseWidget.java index 911cad173..1ba9cbdd4 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/BrowseWidget.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/BrowseWidget.java @@ -18,6 +18,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel; @@ -61,7 +62,7 @@ public class BrowseWidget extends Widget { protected WidgetTemplateValues doAllClassGroupsDisplay(Environment env, Map params, HttpServletRequest request, ServletContext context) { - Map body = getAllClassGroupData(request, params); + Map body = getAllClassGroupData(request, params, context); try { body.put("urls",env.getDataModel().get("urls")); body.put("currentPage", env.getDataModel().get("currentPage")); @@ -73,29 +74,36 @@ public class BrowseWidget extends Widget { return new WidgetTemplateValues(macroName, body); } - protected Map getAllClassGroupData(HttpServletRequest request, Map params){ + /** + * Gets a list of all VClassGroups with vclasses with individual counts. + */ + protected Map getAllClassGroupData(HttpServletRequest request, Map params, ServletContext context){ Map map = new HashMap(); - + VitroRequest vreq = new VitroRequest(request); - List classGroups = - vreq.getWebappDaoFactory().getVClassGroupDao().getPublicGroupsWithVClasses(); - LinkedList cgList = new LinkedList(); - for( VClassGroup classGroup : classGroups){ - cgList.add( new VClassGroupTemplateModel( classGroup )); + VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context); + List cgList = vcgc.getGroups(vreq.getPortalId()); + +// List classGroups = +// vreq.getWebappDaoFactory().getVClassGroupDao().getPublicGroupsWithVClasses(); +// + LinkedList cgtmList = new LinkedList(); + for( VClassGroup classGroup : cgList){ + cgtmList.add( new VClassGroupTemplateModel( classGroup )); } - map.put("vclassGroupList",cgList); + map.put("vclassGroupList",cgtmList); return map; } protected WidgetTemplateValues doClassDisplay(Environment env, Map params, HttpServletRequest request, ServletContext context) { - Map body = getClassData(request,params); + Map body = getClassData(request,params,context); try { body.put("urls",env.getDataModel().get("urls")); - body.put("urlMapping",env.getDataModel().get("urlMapping")); + body.put("currentPage", env.getDataModel().get("currentPage")); } catch (TemplateModelException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -104,10 +112,10 @@ public class BrowseWidget extends Widget { return new WidgetTemplateValues(macroName, body); } - private Map getClassData(HttpServletRequest request, Map params) { + private Map getClassData(HttpServletRequest request, Map params, ServletContext context) { Map map = new HashMap(); - map.putAll(getClassGroupData(request, params)); + map.putAll(getClassGroupData(request, params,context)); String classUri = getParam(Mode.VCLASS, request, params); VitroRequest vreq = new VitroRequest(request); @@ -129,11 +137,11 @@ public class BrowseWidget extends Widget { protected WidgetTemplateValues doClassGroupDisplay(Environment env, Map params, HttpServletRequest request, ServletContext context) { - Map body = getClassGroupData(request,params); + Map body = getClassGroupData(request,params, context); try { body.put("urls",env.getDataModel().get("urls")); - body.put("urlMapping",env.getDataModel().get("urlMapping")); + body.put("currentPage", env.getDataModel().get("currentPage")); } catch (TemplateModelException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -142,14 +150,17 @@ public class BrowseWidget extends Widget { return new WidgetTemplateValues(macroName, body); } - protected Map getClassGroupData(HttpServletRequest request, Map params) { + protected Map getClassGroupData(HttpServletRequest request, Map params, ServletContext context) { Map map = new HashMap(); - String vcgName = getParam(Mode.CLASS_GROUP, request, params); + String vcgUri = getParam(Mode.CLASS_GROUP, request, params); VitroRequest vreq = new VitroRequest(request); - VClassGroup vcg = vreq.getWebappDaoFactory().getVClassGroupDao().getGroupByName(vcgName); + //VClassGroup vcg = vreq.getWebappDaoFactory().getVClassGroupDao().getGroupByURI(vcgUri); - vreq.getWebappDaoFactory().getVClassDao().addVClassesToGroup(vcg, false, true); + VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context); + VClassGroup vcg = vcgc.getGroup(vreq.getPortalId(), vcgUri); + + //vreq.getWebappDaoFactory().getVClassDao().addVClassesToGroup(vcg, false, true); ArrayList classes = new ArrayList(vcg.size()); for( VClass vc : vcg){ classes.add(new VClassTemplateModel(vc)); @@ -157,7 +168,7 @@ public class BrowseWidget extends Widget { map.put("classes", classes); map.put("classGroup", new VClassGroupTemplateModel(vcg)); - map.put("classGroupName", vcgName); + map.put("classGroupName", vcg.getPublicName()); map.put("classGroupUri", vcg.getURI()); return map; @@ -166,7 +177,7 @@ public class BrowseWidget extends Widget { enum Mode{ VCLASS_ALPHA("vclassAlpha","vclassAlpha"), VCLASS("vclass","vclassUri"), - CLASS_GROUP("classGroup","classGroup"), + CLASS_GROUP("classGroup","classgroupUri"), ALL_CLASS_GROUPS("allClassGroups","all"); String macroName; diff --git a/webapp/web/templates/freemarker/widgets/widget-browse.ftl b/webapp/web/templates/freemarker/widgets/widget-browse.ftl index c181cfb67..9055f1054 100644 --- a/webapp/web/templates/freemarker/widgets/widget-browse.ftl +++ b/webapp/web/templates/freemarker/widgets/widget-browse.ftl @@ -16,41 +16,41 @@ <#macro classGroup> -
- <#--

Macro classGroup from widget-browse.ftl

+
+

Browse

+
- There are ${classes?size} classes in classGroup ${classGroup.publicName}. - Only classes with instances are included. -
--> + There are ${classes?size} classes in classGroup ${classGroup.publicName}. + There are ${classGroup.individualCount} individuals in the class group. + Classes with and without instances are included. + - - <#--
    - <#list classes as class> -
  • ${class.name} ${class.individualCount}
  • - -
-->
<#macro vclass> -
-

vclass ${class.name} from ${classGroup.publicName}

- This has classGroup, classes, individualsInClass and class. +
+

Browse

+
+ vclass ${class.name} from ${classGroup.publicName} + This has classGroup, classes, individualsInClass and class. +
    <#list individualsInClass as ind> @@ -60,7 +60,8 @@ <#macro vclassAlpha> -
    -

    vclassAlpha

    +
    +

    Browse

    +
    vclassAlpha is not yet implemented.