Merge branch 'develop' of https://github.com/vivo-project/Vitro into develop

This commit is contained in:
Tim Worrall 2015-02-10 16:34:47 -05:00
commit 9072d436e5
6 changed files with 65 additions and 82 deletions

View file

@ -28,9 +28,9 @@ auth:ADMIN
auth:hasPermission simplePermission:PageViewableAdmin ; auth:hasPermission simplePermission:PageViewableAdmin ;
# Uncomment the following permission line to enable the SPARQL update API. # Uncomment the following permission line to enable the SPARQL update API.
# Before enabling, be sure that the URL api/sparqlUpdate is secured by SSH, # Before enabling, be sure that the URL api/sparqlUpdate is secured by HTTPS,
# so passwords will not be sent in clear text. # so passwords will not be sent in clear text.
# auth:hasPermission simplePermission:UseSparqlUpdateApi ; #auth:hasPermission simplePermission:UseSparqlUpdateApi ;
# permissions for CURATOR and above. # permissions for CURATOR and above.
auth:hasPermission simplePermission:EditOntology ; auth:hasPermission simplePermission:EditOntology ;

View file

@ -0,0 +1,25 @@
# $This file is distributed under the terms of the license in /doc/license.txt$
# All instances of a class can be excluded from the search index by adding a
# vitroDisplay:excludeClass property between vitroDisplay:SearchIndex and the
# URI of the class that you would like to exclude.
# .n3 or .rdf files can be created in this directory to configure the search
# exclusions. Each file must be a valid file in the format specified by its
# extension. Each file will be loaded individually and must be a complete
# stand alone example of its format. Each file must contain all the necessary
# prefixes, namespaces and preambles required by the format specified by its
# extension.
# If you would like to add classes to the exclusions, add a file to this
# directory ending in .n3 with N3 statements similar to this example.
#
# @prefix owl: <http://www.w3.org/2002/07/owl#> .
# @prefix vitroDisplay: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
# @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
# @prefix example: <http://example/ns/> .
#
# vitroDisplay:SearchIndex
# rdf:type owl:Thing ;
# vitroDisplay:excludeClass example:classToExclude ;

View file

@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -139,38 +140,30 @@ public class CollatedObjectPropertyTemplateModel extends
// others will be removed // others will be removed
List<Map<String, String>> filteredList = new ArrayList<Map<String, String>>(); List<Map<String, String>> filteredList = new ArrayList<Map<String, String>>();
Set<String> processedObjects = new HashSet<String>(); Set<String> processedObjects = new HashSet<String>();
//Useful to keep track of objects where statement data may not match the most specific type
//returne for some reason, in which case useful to keep track
Set<String> filteredObjects = new HashSet<String>();
for (Map<String, String> outerMap : statementData) { for (Map<String, String> outerMap : statementData) {
String objectUri = outerMap.get(objectVariableName); String objectUri = outerMap.get(objectVariableName);
if (processedObjects.contains(objectUri)) { if (processedObjects.contains(objectUri)) {
continue; continue;
} }
processedObjects.add(objectUri); processedObjects.add(objectUri);
//Get most specific type for this particular List<Map<String, String>> dataForThisObject = new ArrayList<Map<String, String>>();
List<String> mostSpecificTypes = this.getSortedMostSpecificType(objectUri); //Retrieve the statements that are related to this specific object
//If more than one most specific type, will compare against both of them
//and if the first one matches, the object will be placed under that
//otherwise subclass will be checked against the other
for (Map<String, String> innerMap : statementData) { for (Map<String, String> innerMap : statementData) {
//Check both the object uri and that the subclass returned matches if (innerMap.get(objectVariableName).equals(objectUri)) {
//the most specific type // Subclass should at this point contain the most specific
if (innerMap.get(objectVariableName) == objectUri) { // type already
//At this point, the statement data will already have the most specific type dataForThisObject.add(innerMap);
//represented }
String subclass = innerMap.get(SUBCLASS_VARIABLE_NAME); }
if(mostSpecificTypes.contains(subclass)) {
filteredList.add(innerMap);
filteredObjects.add(objectUri);
} else {
if(log.isDebugEnabled()) { if(log.isDebugEnabled()) {
log.debug("Iterating through statement data, Subclass does not match most specific type for Object URI - " + objectUri + " - subclass:" + subclass + " - most specific types=" + mostSpecificTypes.toString()); log.debug("Object URI " + objectUri + " has number of statements = " + dataForThisObject.size());
}
}
}
} }
//Subclass variable should already reflect most specifick types but there may be more than one most specific type
Collections.sort(dataForThisObject, new DataComparatorBySubclass());
filteredList.add(dataForThisObject.get(0));
} }
@ -179,31 +172,23 @@ public class CollatedObjectPropertyTemplateModel extends
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Data after subclass filtering"); log.debug("Data after subclass filtering");
logData(statementData); logData(statementData);
//check and see if filteredObjects and processedObjects not the same size
if(filteredObjects.size() < processedObjects.size()) {
log.debug("Certain objects not included in statements displayed for collated subclasses");
processedObjects.removeAll(filteredObjects);
log.debug("These object uris not represented" + processedObjects.toString());
}
} }
} }
//Get the most specific type //Subclass variable should already contain most specific type
//An alternative would be to ensure that the default form, or any form that utilizes collation //If there is more than one most specific type, then order alphabetically
//will return most specific type within the listview select/construct queries so the resulting private class DataComparatorBySubclass implements
//statement data has that value Comparator<Map<String, String>> {
List<String> getMostSpecificTypesForObject(String objectURI) {
WebappDaoFactory wadf = ModelAccess.on(vreq).getWebappDaoFactory();
return wadf.getIndividualDao().getIndividualByURI(objectURI).getMostSpecificTypeURIs();
}
//This will return a single most specific type for an object @Override
//If there are multiple most specific types, the list will be sorted alphabetically and public int compare(Map<String, String> map1, Map<String, String> map2) {
//the first one will be returned
List<String> getSortedMostSpecificType(String objectURI) { String subclass1 = map1.get(SUBCLASS_VARIABLE_NAME);
List<String> mostSpecificTypeURIs = this.getMostSpecificTypesForObject(objectURI); String subclass2 = map2.get(SUBCLASS_VARIABLE_NAME);
Collections.sort(mostSpecificTypeURIs);
return mostSpecificTypeURIs; return subclass1.compareTo(subclass2);
}
} }

View file

@ -1,27 +0,0 @@
# $This file is distributed under the terms of the license in /doc/license.txt$
# All instances of a class can be excluded from the search index
# by adding a vitroDisplay:excludeClass property between
# vitroDisplay:SearchIndex and the URI of the class
# that you would like to exclude.
# All .n3 or .rdf files in this directory will be used to configure
# the search exclusions. Each file must be a valid file in the format
# specified by its extension. Each file will be loaded individually and
# must be a complete stand alone example of its format. Each file must contain all
# the necessary prefixes, namespaces and preambles required by the format
# specified by its extension.
# If you would like to add classes to the
# exclusions, add a file to this directory ending in .n3 with
# N3 statements similar to this example.
#
# @prefix owl: <http://www.w3.org/2002/07/owl#> .
# @prefix vitroDisplay: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
# @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
# @prefix example: <http://example/ns/> .
#
# vitroDisplay:SearchIndex
# rdf:type owl:Thing ;
# vitroDisplay:excludeClass example:classToExclude ;

View file

@ -25,7 +25,7 @@
<section class="account-feedback"> <section class="account-feedback">
<p> <p>
${strings.updated_account_1} ${strings.updated_account_1}
<a href="${updatedUserAccount.editUrl}" title="${strings.updated_account_title}}">${updatedUserAccount.firstName} ${updatedUserAccount.lastName}</a> <a href="${updatedUserAccount.editUrl}" title="${strings.updated_account_title}">${updatedUserAccount.firstName} ${updatedUserAccount.lastName}</a>
${strings.updated_account_2} ${strings.updated_account_2}
<#if emailWasSent?? >${strings.updated_account_notification(updatedUserAccount.emailAddress)}</#if> <#if emailWasSent?? >${strings.updated_account_notification(updatedUserAccount.emailAddress)}</#if>
</p> </p>

View file

@ -9,11 +9,11 @@
<#if (individual.thumbUrl)??> <#if (individual.thumbUrl)??>
<img src="${individual.thumbUrl}" width="90" alt="${individual.name}" /> <img src="${individual.thumbUrl}" width="90" alt="${individual.name}" />
<h1 class="thumb"> <h1 class="thumb">
<a href="${individual.profileUrl}" title="${i18n().view_profile_page_for} ${individual.name}}">${individual.name}</a> <a href="${individual.profileUrl}" title="${i18n().view_profile_page_for} ${individual.name}">${individual.name}</a>
</h1> </h1>
<#else> <#else>
<h1> <h1>
<a href="${individual.profileUrl}" title="${i18n().view_profile_page_for} ${individual.name}}">${individual.name}</a> <a href="${individual.profileUrl}" title="${i18n().view_profile_page_for} ${individual.name}">${individual.name}</a>
</h1> </h1>
</#if> </#if>