diff --git a/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl b/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl index 82d48d4b..247d4cf6 100644 --- a/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl +++ b/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl @@ -71,16 +71,9 @@

<#-- Label --> <@p.label individual editable /> - - <#-- Moniker / Preferred Title --> - <#-- Use Preferred Title over Moniker if it is populated --> - <#assign title = (propertyGroups.getProperty("${core}preferredTitle").firstValue)! /> - <#if ! title?has_content> - <#assign title = individual.moniker> - - <#if title?has_content> - ${title} - + + <#-- Most-specific types --> + <@p.mostSpecificTypes individual />

diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java index 3cc9efad..7e143615 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java +++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java @@ -9,8 +9,6 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.openrdf.model.URI; -import org.openrdf.model.impl.URIImpl; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.Individual; @@ -25,6 +23,12 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; public class IndividualTemplateModel extends BaseIndividualTemplateModel { private static final Log log = LogFactory.getLog(IndividualTemplateModel.class); + + private static final String FOAF = "http://xmlns.com/foaf/0.1/"; + private static final String CORE = "http://vivoweb.org/ontology/core#"; + private static final String PERSON_CLASS = FOAF + "Person"; + private static final String ORGANIZATION_CLASS = FOAF + "Organization"; + private Map qrData = null; public IndividualTemplateModel(Individual individual, VitroRequest vreq) { @@ -34,98 +38,16 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel { private String getBaseVisUrl() { return getUrl(Route.VISUALIZATION_SHORT.path()); } - - /* Access methods for templates */ - - public boolean isPerson() { - return isVClass("http://xmlns.com/foaf/0.1/Person"); - } - - public boolean isOrganization() { - return isVClass("http://xmlns.com/foaf/0.1/Organization"); - } - - public String getCoAuthorVisUrl() { - - String coauthorVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.COAUTHORSHIP_VIS_SHORT_URL + "/"; - - return getVisUrl(coauthorVisURL); - } - - public String getCoInvestigatorVisUrl() { - - String coinvestigatorVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.COINVESTIGATOR_VIS_SHORT_URL + "/"; - - return getVisUrl(coinvestigatorVisURL); - } - - private String getVisUrl(String coinvestigatorVisURL) { - boolean isUsingDefaultNameSpace = UrlBuilder.isUriInDefaultNamespace( - getUri(), - vreq); - - if (isUsingDefaultNameSpace) { - - return coinvestigatorVisURL + getLocalName(); - - } else { - - return UrlBuilder.addParams( - coinvestigatorVisURL, - new ParamMap(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY, getUri())); - } - } - - public String getTemporalGraphUrl() { - if (!isOrganization()) { - return null; - } - - String temporalVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.PUBLICATION_TEMPORAL_VIS_SHORT_URL + "/"; - - return getVisUrl(temporalVisURL); - } - - public String getMapOfScienceUrl() { - - String mapOfScienceVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.MAP_OF_SCIENCE_VIS_SHORT_URL + "/"; - - return getVisUrl(mapOfScienceVisURL); - } - - public String getSelfEditingId() { - String id = null; - String idMatchingProperty = ConfigurationProperties.getBean(getServletContext()).getProperty("selfEditing.idMatchingProperty"); - if (! StringUtils.isBlank(idMatchingProperty)) { - // Use assertions model to side-step filtering. We need to get the value regardless of whether the property - // is visible to the current user. - WebappDaoFactory wdf = vreq.getAssertionsWebappDaoFactory(); - Collection ids = - wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, idMatchingProperty); - if (ids.size() > 0) { - id = ids.iterator().next().getData(); - } - } - return id; - } - - public Map doQrData() { - if(qrData == null) - qrData = generateQrData(); - return qrData; - } - + private Map generateQrData() { - String core = "http://vivoweb.org/ontology/core#"; - String foaf = "http://xmlns.com/foaf/0.1/"; Map qrData = new HashMap(); WebappDaoFactory wdf = vreq.getAssertionsWebappDaoFactory(); - Collection firstNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, foaf + "firstName"); - Collection lastNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, foaf + "lastName"); - Collection preferredTitles = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "preferredTitle"); - Collection phoneNumbers = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "phoneNumber"); - Collection emails = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "email"); + Collection firstNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, FOAF + "firstName"); + Collection lastNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, FOAF + "lastName"); + Collection preferredTitles = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, CORE + "preferredTitle"); + Collection phoneNumbers = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, CORE + "phoneNumber"); + Collection emails = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, CORE + "email"); if(firstNames != null && ! firstNames.isEmpty()) qrData.put("firstName", firstNames.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); @@ -153,4 +75,76 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel { return qrData; } + + + /* Access methods for templates */ + + public boolean isPerson() { + return isVClass(PERSON_CLASS); + } + + public boolean isOrganization() { + return isVClass(ORGANIZATION_CLASS); + } + + public String getCoAuthorVisUrl() { + String coauthorVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.COAUTHORSHIP_VIS_SHORT_URL + "/"; + return getVisUrl(coauthorVisURL); + } + + public String getCoInvestigatorVisUrl() { + String coinvestigatorVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.COINVESTIGATOR_VIS_SHORT_URL + "/"; + return getVisUrl(coinvestigatorVisURL); + } + + private String getVisUrl(String coinvestigatorVisURL) { + boolean isUsingDefaultNameSpace = UrlBuilder.isUriInDefaultNamespace( + getUri(), + vreq); + + if (isUsingDefaultNameSpace) { + return coinvestigatorVisURL + getLocalName(); + } else { + return UrlBuilder.addParams( + coinvestigatorVisURL, + new ParamMap(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY, getUri())); + } + } + + public String getTemporalGraphUrl() { + if (!isOrganization()) { + return null; + } + String temporalVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.PUBLICATION_TEMPORAL_VIS_SHORT_URL + "/"; + return getVisUrl(temporalVisURL); + } + + public String getMapOfScienceUrl() { + String mapOfScienceVisURL = getBaseVisUrl() + "/" + VisualizationFrameworkConstants.MAP_OF_SCIENCE_VIS_SHORT_URL + "/"; + return getVisUrl(mapOfScienceVisURL); + } + + public String getSelfEditingId() { + String id = null; + String idMatchingProperty = ConfigurationProperties.getBean(getServletContext()).getProperty("selfEditing.idMatchingProperty"); + if (! StringUtils.isBlank(idMatchingProperty)) { + // Use assertions model to side-step filtering. We need to get the value regardless of whether the property + // is visible to the current user. + WebappDaoFactory wdf = vreq.getAssertionsWebappDaoFactory(); + Collection ids = + wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, idMatchingProperty); + if (ids.size() > 0) { + id = ids.iterator().next().getData(); + } + } + return id; + } + + public Map doQrData() { + if(qrData == null) + qrData = generateQrData(); + return qrData; + } + + } diff --git a/themes/wilma/css/wilma.css b/themes/wilma/css/wilma.css index 1a618fa6..4942f288 100644 --- a/themes/wilma/css/wilma.css +++ b/themes/wilma/css/wilma.css @@ -1190,7 +1190,7 @@ nav#alpha-browse-container { font-size: 1.375em; color: #2485ae; } -#individual-intro span.preferred-title { +#individual-intro span.most-specific-type { font-size: .825em; color: #5e6363; border-left: 1px solid #A6B1B0; @@ -1260,7 +1260,7 @@ ul.individual-urls-people li a { color: #2485ae; line-height: 1.3em; } -h1.fn .preferred-title { +h1.fn .most-specific-type { font-size: .825em; color: #5e6363; border-left: 1px solid #a6b1b0;