NIHVIVO-568 Add comments, explaining that the list of mostSpecificTypes is not returned in random order, but is instead ordered by ascending values of "label".

This commit is contained in:
j2blake 2012-03-19 16:46:20 +00:00
parent 53b870da2a
commit af8fc9e0a9

View file

@ -404,6 +404,17 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
/**
* Finds all mostSpecificTypes of an individual that are members of a classgroup.
* Returns a list of type labels.
*
* Note that the Map returned is a LinkedHashMap, which means that an iterator
* will return the entries in the order in which the keys were inserted in the map.
* Since the SPARQL query included an "ORDER BY ?label" clause, and since an
* iterator through that ResultSet was used to add entries to the map, an iterator
* on the map will return entries that are sorted by label (value, not key).
*
* While this sorting order is not specified as a requirement (maybe it should be?),
* it is certainly useful that the types are returned in some order that is
* replicable, so an individual with multiple mostSpecificTypes, will always see
* the same list in the same order. (See https://issues.library.cornell.edu/browse/NIHVIVO-568)
* **/
public Map<String, String> getMostSpecificTypesInClassgroupsForIndividual(String subjectUri) {