diff --git a/webapp/rdf/auth/everytime/permission_config.n3 b/webapp/rdf/auth/everytime/permission_config.n3 index f4d4b0665..172c55ca8 100644 --- a/webapp/rdf/auth/everytime/permission_config.n3 +++ b/webapp/rdf/auth/everytime/permission_config.n3 @@ -25,12 +25,12 @@ auth:ADMIN auth:hasPermission simplePermission:UseAdvancedDataToolsPages ; auth:hasPermission simplePermission:UseMiscellaneousAdminPages ; auth:hasPermission simplePermission:UseSparqlQueryPage ; - auth:hasPermission simplePermission:PageViewableAdmin ; + auth:hasPermission simplePermission:PageViewableAdmin ; - # Uncomment the following permission line to enable the SPARQL update API. - # Before enabling, be sure that the URL api/sparqlUpdate is secured by SSH, - # so passwords will not be sent in clear text. -# auth:hasPermission simplePermission:UseSparqlUpdateApi ; + # Uncomment the following permission line to enable the SPARQL update API. + # Before enabling, be sure that the URL api/sparqlUpdate is secured by HTTPS, + # so passwords will not be sent in clear text. + #auth:hasPermission simplePermission:UseSparqlUpdateApi ; # permissions for CURATOR and above. auth:hasPermission simplePermission:EditOntology ; diff --git a/webapp/rdf/display/everytime/vitroSearchProhibited.n3 b/webapp/rdf/display/everytime/vitroSearchProhibited.n3 new file mode 100644 index 000000000..7110c0fbc --- /dev/null +++ b/webapp/rdf/display/everytime/vitroSearchProhibited.n3 @@ -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: . +# @prefix vitroDisplay: . +# @prefix rdf: . +# @prefix example: . +# +# vitroDisplay:SearchIndex +# rdf:type owl:Thing ; +# vitroDisplay:excludeClass example:classToExclude ; \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java index e3ba1e473..7a074acb9 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/CollatedObjectPropertyTemplateModel.java @@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -139,39 +140,31 @@ public class CollatedObjectPropertyTemplateModel extends // others will be removed List> filteredList = new ArrayList>(); Set processedObjects = new HashSet(); - //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 filteredObjects = new HashSet(); for (Map outerMap : statementData) { String objectUri = outerMap.get(objectVariableName); + if (processedObjects.contains(objectUri)) { continue; } processedObjects.add(objectUri); - //Get most specific type for this particular - List mostSpecificTypes = this.getSortedMostSpecificType(objectUri); - //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 + List> dataForThisObject = new ArrayList>(); + //Retrieve the statements that are related to this specific object for (Map innerMap : statementData) { - //Check both the object uri and that the subclass returned matches - //the most specific type - if (innerMap.get(objectVariableName) == objectUri) { - //At this point, the statement data will already have the most specific type - //represented - String subclass = innerMap.get(SUBCLASS_VARIABLE_NAME); - if(mostSpecificTypes.contains(subclass)) { - filteredList.add(innerMap); - filteredObjects.add(objectUri); - } else { - 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()); - } - } + if (innerMap.get(objectVariableName).equals(objectUri)) { + // Subclass should at this point contain the most specific + // type already + dataForThisObject.add(innerMap); } } - + + if(log.isDebugEnabled()) { + 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)); + } statementData.retainAll(filteredList); @@ -179,33 +172,25 @@ public class CollatedObjectPropertyTemplateModel extends if (log.isDebugEnabled()) { log.debug("Data after subclass filtering"); 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 - //An alternative would be to ensure that the default form, or any form that utilizes collation - //will return most specific type within the listview select/construct queries so the resulting - //statement data has that value - List getMostSpecificTypesForObject(String objectURI) { - WebappDaoFactory wadf = ModelAccess.on(vreq).getWebappDaoFactory(); - return wadf.getIndividualDao().getIndividualByURI(objectURI).getMostSpecificTypeURIs(); + + //Subclass variable should already contain most specific type + //If there is more than one most specific type, then order alphabetically + private class DataComparatorBySubclass implements + Comparator> { + + @Override + public int compare(Map map1, Map map2) { + + String subclass1 = map1.get(SUBCLASS_VARIABLE_NAME); + String subclass2 = map2.get(SUBCLASS_VARIABLE_NAME); + + return subclass1.compareTo(subclass2); + + } } - //This will return a single most specific type for an object - //If there are multiple most specific types, the list will be sorted alphabetically and - //the first one will be returned - List getSortedMostSpecificType(String objectURI) { - List mostSpecificTypeURIs = this.getMostSpecificTypesForObject(objectURI); - Collections.sort(mostSpecificTypeURIs); - return mostSpecificTypeURIs; - } - // Collate the statements by subclass. diff --git a/webapp/web/WEB-INF/ontologies/search/vitroSearchProhibited.n3 b/webapp/web/WEB-INF/ontologies/search/vitroSearchProhibited.n3 deleted file mode 100644 index ba3ed6838..000000000 --- a/webapp/web/WEB-INF/ontologies/search/vitroSearchProhibited.n3 +++ /dev/null @@ -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: . -# @prefix vitroDisplay: . -# @prefix rdf: . -# @prefix example: . -# -# vitroDisplay:SearchIndex -# rdf:type owl:Thing ; -# vitroDisplay:excludeClass example:classToExclude ; \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl index f76707992..ee9a542c9 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl @@ -25,7 +25,7 @@