test_class.declarator: testdataDirectory = "nav2"
test_class.modifier: private final static
test_class.original_string: private final static String testdataDirectory = "nav2";
test_class.type: String
test_class.var_name: testdataDirectory
test_class.declarator: portlet
test_class.modifier: private
test_class.original_string: private RelatedTopics portlet;
test_class.type: RelatedTopics
test_class.var_name: portlet
test_class.file: ontopia-navigator/src/test/java/net/ontopia/topicmaps/nav2/portlets/pojos/RelatedTopicsTest.java
test_class.identifier: RelatedTopicsTest
test_case.body: @Test
    public void testNoAssociations() throws IOException {
      TopicMapIF tm = load("screwed-up.ltm");
      TopicIF topic = getTopicById(tm, "no-name");
      List headings = portlet.makeModel(topic);
      Assert.assertTrue("topic with no associations had headings",
                 headings.isEmpty());
    }
test_case.class_method_signature: RelatedTopicsTest.testNoAssociations()
test_case.full_signature: @Test public void testNoAssociations()
test_case.identifier: testNoAssociations
test_case.invocations: load getTopicById makeModel assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNoAssociations()
focal_class.declarator: ORDERING_ASC = 1
focal_class.modifier: public static final
focal_class.original_string: public static final int ORDERING_ASC = 1;
focal_class.type: int
focal_class.var_name: ORDERING_ASC
focal_class.declarator: ORDERING_DESC = 2
focal_class.modifier: public static final
focal_class.original_string: public static final int ORDERING_DESC = 2;
focal_class.type: int
focal_class.var_name: ORDERING_DESC
focal_class.declarator: weaktypes
focal_class.modifier: private
focal_class.original_string: private Set weaktypes;
focal_class.type: Set
focal_class.var_name: weaktypes
focal_class.declarator: exclassocs
focal_class.modifier: private
focal_class.original_string: private Set exclassocs;
focal_class.type: Set
focal_class.var_name: exclassocs
focal_class.declarator: exclroles
focal_class.modifier: private
focal_class.original_string: private Set exclroles;
focal_class.type: Set
focal_class.var_name: exclroles
focal_class.declarator: excltopics
focal_class.modifier: private
focal_class.original_string: private Set excltopics;
focal_class.type: Set
focal_class.var_name: excltopics
focal_class.declarator: inclassocs
focal_class.modifier: private
focal_class.original_string: private Set inclassocs;
focal_class.type: Set
focal_class.var_name: inclassocs
focal_class.declarator: incltopics
focal_class.modifier: private
focal_class.original_string: private Set incltopics;
focal_class.type: Set
focal_class.var_name: incltopics
focal_class.declarator: weaktypes_cache
focal_class.modifier: private
focal_class.original_string: private Set weaktypes_cache;
focal_class.type: Set
focal_class.var_name: weaktypes_cache
focal_class.declarator: exclassocs_cache
focal_class.modifier: private
focal_class.original_string: private Set exclassocs_cache;
focal_class.type: Set
focal_class.var_name: exclassocs_cache
focal_class.declarator: exclroles_cache
focal_class.modifier: private
focal_class.original_string: private Set exclroles_cache;
focal_class.type: Set
focal_class.var_name: exclroles_cache
focal_class.declarator: excltopics_cache
focal_class.modifier: private
focal_class.original_string: private Set excltopics_cache;
focal_class.type: Set
focal_class.var_name: excltopics_cache
focal_class.declarator: sort
focal_class.modifier: private
focal_class.original_string: private StringifierIF sort;
focal_class.type: StringifierIF
focal_class.var_name: sort
focal_class.declarator: maxchildren = -1
focal_class.modifier: private
focal_class.original_string: private int maxchildren = -1;
focal_class.type: int
focal_class.var_name: maxchildren
focal_class.declarator: headingOrderQueryString
focal_class.modifier: private
focal_class.original_string: private String headingOrderQueryString;
focal_class.type: String
focal_class.var_name: headingOrderQueryString
focal_class.declarator: headingOrdering = ORDERING_ASC
focal_class.modifier: private
focal_class.original_string: private int headingOrdering = ORDERING_ASC;
focal_class.type: int
focal_class.var_name: headingOrdering
focal_class.declarator: childOrderQueryString
focal_class.modifier: private
focal_class.original_string: private String childOrderQueryString;
focal_class.type: String
focal_class.var_name: childOrderQueryString
focal_class.declarator: childOrdering = ORDERING_ASC
focal_class.modifier: private
focal_class.original_string: private int childOrdering = ORDERING_ASC;
focal_class.type: int
focal_class.var_name: childOrdering
focal_class.declarator: filterquery
focal_class.modifier: private
focal_class.original_string: private String filterquery;
focal_class.type: String
focal_class.var_name: filterquery
focal_class.declarator: tologctx
focal_class.modifier: private
focal_class.original_string: private DeclarationContextIF tologctx;
focal_class.type: DeclarationContextIF
focal_class.var_name: tologctx
focal_class.declarator: aggregateHierarchy
focal_class.modifier: private
focal_class.original_string: private boolean aggregateHierarchy;
focal_class.type: boolean
focal_class.var_name: aggregateHierarchy
focal_class.declarator: aggregateAssociations
focal_class.modifier: private
focal_class.original_string: private Set aggregateAssociations;
focal_class.type: Set
focal_class.var_name: aggregateAssociations
focal_class.declarator: storeid
focal_class.modifier: private
focal_class.original_string: private int storeid;
focal_class.type: int
focal_class.var_name: storeid
focal_class.declarator: tmid
focal_class.modifier: private
focal_class.original_string: private int tmid;
focal_class.type: int
focal_class.var_name: tmid
focal_class.declarator: useOntopolyNames
focal_class.modifier: private
focal_class.original_string: private boolean useOntopolyNames;
focal_class.type: boolean
focal_class.var_name: useOntopolyNames
focal_class.file: ontopia-navigator/src/main/java/net/ontopia/topicmaps/nav2/portlets/pojos/RelatedTopics.java
focal_class.identifier: RelatedTopics
focal_class.class_method_signature: RelatedTopics.setWeakAssociationTypes(Set weaktypes)
focal_class.full_signature: public void setWeakAssociationTypes(Set weaktypes)
focal_class.identifier: setWeakAssociationTypes
focal_class.modifiers: public
focal_class.parameters: (Set weaktypes)
focal_class.return: void
focal_class.signature: void setWeakAssociationTypes(Set weaktypes)
focal_class.class_method_signature: RelatedTopics.setExcludeAssociationTypes(Set types)
focal_class.full_signature: public void setExcludeAssociationTypes(Set types)
focal_class.identifier: setExcludeAssociationTypes
focal_class.modifiers: public
focal_class.parameters: (Set types)
focal_class.return: void
focal_class.signature: void setExcludeAssociationTypes(Set types)
focal_class.class_method_signature: RelatedTopics.setExcludeRoleTypes(Set types)
focal_class.full_signature: public void setExcludeRoleTypes(Set types)
focal_class.identifier: setExcludeRoleTypes
focal_class.modifiers: public
focal_class.parameters: (Set types)
focal_class.return: void
focal_class.signature: void setExcludeRoleTypes(Set types)
focal_class.class_method_signature: RelatedTopics.setExcludeTopicTypes(Set types)
focal_class.full_signature: public void setExcludeTopicTypes(Set types)
focal_class.identifier: setExcludeTopicTypes
focal_class.modifiers: public
focal_class.parameters: (Set types)
focal_class.return: void
focal_class.signature: void setExcludeTopicTypes(Set types)
focal_class.class_method_signature: RelatedTopics.setIncludeAssociationTypes(Set types)
focal_class.full_signature: public void setIncludeAssociationTypes(Set types)
focal_class.identifier: setIncludeAssociationTypes
focal_class.modifiers: public
focal_class.parameters: (Set types)
focal_class.return: void
focal_class.signature: void setIncludeAssociationTypes(Set types)
focal_class.class_method_signature: RelatedTopics.setIncludeTopicTypes(Set types)
focal_class.full_signature: public void setIncludeTopicTypes(Set types)
focal_class.identifier: setIncludeTopicTypes
focal_class.modifiers: public
focal_class.parameters: (Set types)
focal_class.return: void
focal_class.signature: void setIncludeTopicTypes(Set types)
focal_class.class_method_signature: RelatedTopics.setFilterQuery(String query)
focal_class.full_signature: public void setFilterQuery(String query)
focal_class.identifier: setFilterQuery
focal_class.modifiers: public
focal_class.parameters: (String query)
focal_class.return: void
focal_class.signature: void setFilterQuery(String query)
focal_class.class_method_signature: RelatedTopics.setMaxChildren(int maxchildren)
focal_class.full_signature: public void setMaxChildren(int maxchildren)
focal_class.identifier: setMaxChildren
focal_class.modifiers: public
focal_class.parameters: (int maxchildren)
focal_class.return: void
focal_class.signature: void setMaxChildren(int maxchildren)
focal_class.class_method_signature: RelatedTopics.setHeadingOrderQuery(String headingOrderQueryString)
focal_class.full_signature: public void setHeadingOrderQuery(String headingOrderQueryString)
focal_class.identifier: setHeadingOrderQuery
focal_class.modifiers: public
focal_class.parameters: (String headingOrderQueryString)
focal_class.return: void
focal_class.signature: void setHeadingOrderQuery(String headingOrderQueryString)
focal_class.class_method_signature: RelatedTopics.setHeadingOrdering(int headingOrdering)
focal_class.full_signature: public void setHeadingOrdering(int headingOrdering)
focal_class.identifier: setHeadingOrdering
focal_class.modifiers: public
focal_class.parameters: (int headingOrdering)
focal_class.return: void
focal_class.signature: void setHeadingOrdering(int headingOrdering)
focal_class.class_method_signature: RelatedTopics.setChildOrderQuery(String childOrderQueryString)
focal_class.full_signature: public void setChildOrderQuery(String childOrderQueryString)
focal_class.identifier: setChildOrderQuery
focal_class.modifiers: public
focal_class.parameters: (String childOrderQueryString)
focal_class.return: void
focal_class.signature: void setChildOrderQuery(String childOrderQueryString)
focal_class.class_method_signature: RelatedTopics.setChildOrdering(int childOrdering)
focal_class.full_signature: public void setChildOrdering(int childOrdering)
focal_class.identifier: setChildOrdering
focal_class.modifiers: public
focal_class.parameters: (int childOrdering)
focal_class.return: void
focal_class.signature: void setChildOrdering(int childOrdering)
focal_class.class_method_signature: RelatedTopics.setAggregateHierarchy(boolean aggregateHierarchy)
focal_class.full_signature: public void setAggregateHierarchy(boolean aggregateHierarchy)
focal_class.identifier: setAggregateHierarchy
focal_class.modifiers: public
focal_class.parameters: (boolean aggregateHierarchy)
focal_class.return: void
focal_class.signature: void setAggregateHierarchy(boolean aggregateHierarchy)
focal_class.class_method_signature: RelatedTopics.setAggregateAssociations(Set aggregateAssociations)
focal_class.full_signature: public void setAggregateAssociations(Set aggregateAssociations)
focal_class.identifier: setAggregateAssociations
focal_class.modifiers: public
focal_class.parameters: (Set aggregateAssociations)
focal_class.return: void
focal_class.signature: void setAggregateAssociations(Set aggregateAssociations)
focal_class.class_method_signature: RelatedTopics.setTologContext(DeclarationContextIF tologctx)
focal_class.full_signature: public void setTologContext(DeclarationContextIF tologctx)
focal_class.identifier: setTologContext
focal_class.modifiers: public
focal_class.parameters: (DeclarationContextIF tologctx)
focal_class.return: void
focal_class.signature: void setTologContext(DeclarationContextIF tologctx)
focal_class.class_method_signature: RelatedTopics.makeModel(TopicIF topic)
focal_class.full_signature: public List makeModel(TopicIF topic)
focal_class.identifier: makeModel
focal_class.modifiers: public
focal_class.parameters: (TopicIF topic)
focal_class.return: List
focal_class.signature: List makeModel(TopicIF topic)
focal_class.class_method_signature: RelatedTopics.getRoles(TopicIF topic)
focal_class.full_signature: private Collection getRoles(TopicIF topic)
focal_class.identifier: getRoles
focal_class.modifiers: private
focal_class.parameters: (TopicIF topic)
focal_class.return: Collection
focal_class.signature: Collection getRoles(TopicIF topic)
focal_class.class_method_signature: RelatedTopics.isRoleHidden(AssociationRoleIF role, ParsedQueryIF pquery)
focal_class.full_signature: private boolean isRoleHidden(AssociationRoleIF role, ParsedQueryIF pquery)
focal_class.identifier: isRoleHidden
focal_class.modifiers: private
focal_class.parameters: (AssociationRoleIF role, ParsedQueryIF pquery)
focal_class.return: boolean
focal_class.signature: boolean isRoleHidden(AssociationRoleIF role, ParsedQueryIF pquery)
focal_class.class_method_signature: RelatedTopics.isTopicHidden(TopicIF topic, Set hide, ParsedQueryIF pquery)
focal_class.full_signature: private boolean isTopicHidden(TopicIF topic, Set hide, ParsedQueryIF pquery)
focal_class.identifier: isTopicHidden
focal_class.modifiers: private
focal_class.parameters: (TopicIF topic, Set hide, ParsedQueryIF pquery)
focal_class.return: boolean
focal_class.signature: boolean isTopicHidden(TopicIF topic, Set hide, ParsedQueryIF pquery)
focal_class.class_method_signature: RelatedTopics.getSortKey(TopicIF topic, ParsedQueryIF skquery)
focal_class.full_signature: private Object getSortKey(TopicIF topic, ParsedQueryIF skquery)
focal_class.identifier: getSortKey
focal_class.modifiers: private
focal_class.parameters: (TopicIF topic, ParsedQueryIF skquery)
focal_class.return: Object
focal_class.signature: Object getSortKey(TopicIF topic, ParsedQueryIF skquery)
focal_class.class_method_signature: RelatedTopics.getWeakTypes()
focal_class.full_signature: private Set getWeakTypes()
focal_class.identifier: getWeakTypes
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Set
focal_class.signature: Set getWeakTypes()
focal_class.class_method_signature: RelatedTopics.getObjectId(TMObjectIF object)
focal_class.full_signature: private String getObjectId(TMObjectIF object)
focal_class.identifier: getObjectId
focal_class.modifiers: private
focal_class.parameters: (TMObjectIF object)
focal_class.return: String
focal_class.signature: String getObjectId(TMObjectIF object)
focal_class.class_method_signature: RelatedTopics.getOtherRole(AssociationIF assoc,
                                                  AssociationRoleIF role)
focal_class.full_signature: private static AssociationRoleIF getOtherRole(AssociationIF assoc,
                                                  AssociationRoleIF role)
focal_class.identifier: getOtherRole
focal_class.modifiers: private static
focal_class.parameters: (AssociationIF assoc,
                                                  AssociationRoleIF role)
focal_class.return: AssociationRoleIF
focal_class.signature: AssociationRoleIF getOtherRole(AssociationIF assoc,
                                                  AssociationRoleIF role)
focal_class.class_method_signature: RelatedTopics.mapToObjectIds(Set objects)
focal_class.full_signature: private Set mapToObjectIds(Set objects)
focal_class.identifier: mapToObjectIds
focal_class.modifiers: private
focal_class.parameters: (Set objects)
focal_class.return: Set
focal_class.signature: Set mapToObjectIds(Set objects)
focal_class.class_method_signature: RelatedTopics.updateCache(TopicMapIF topicmap)
focal_class.full_signature: private void updateCache(TopicMapIF topicmap)
focal_class.identifier: updateCache
focal_class.modifiers: private
focal_class.parameters: (TopicMapIF topicmap)
focal_class.return: void
focal_class.signature: void updateCache(TopicMapIF topicmap)
focal_class.class_method_signature: RelatedTopics.parse(TopicMapIF tm, String query)
focal_class.full_signature: private ParsedQueryIF parse(TopicMapIF tm, String query)
focal_class.identifier: parse
focal_class.modifiers: private
focal_class.parameters: (TopicMapIF tm, String query)
focal_class.return: ParsedQueryIF
focal_class.signature: ParsedQueryIF parse(TopicMapIF tm, String query)
focal_class.class_method_signature: RelatedTopics.istrue(ParsedQueryIF pquery, TopicIF topic)
focal_class.full_signature: private boolean istrue(ParsedQueryIF pquery, TopicIF topic)
focal_class.identifier: istrue
focal_class.modifiers: private
focal_class.parameters: (ParsedQueryIF pquery, TopicIF topic)
focal_class.return: boolean
focal_class.signature: boolean istrue(ParsedQueryIF pquery, TopicIF topic)
focal_class.class_method_signature: RelatedTopics.compareHeadings(Object o1, Object o2)
focal_class.full_signature: private int compareHeadings(Object o1, Object o2)
focal_class.identifier: compareHeadings
focal_class.modifiers: private
focal_class.parameters: (Object o1, Object o2)
focal_class.return: int
focal_class.signature: int compareHeadings(Object o1, Object o2)
focal_class.class_method_signature: RelatedTopics.compareChildren(Object o1, Object o2)
focal_class.full_signature: private int compareChildren(Object o1, Object o2)
focal_class.identifier: compareChildren
focal_class.modifiers: private
focal_class.parameters: (Object o1, Object o2)
focal_class.return: int
focal_class.signature: int compareChildren(Object o1, Object o2)
focal_class.class_method_signature: RelatedTopics._compare(Object o1, Object o2)
focal_class.full_signature: private int _compare(Object o1, Object o2)
focal_class.identifier: _compare
focal_class.modifiers: private
focal_class.parameters: (Object o1, Object o2)
focal_class.return: int
focal_class.signature: int _compare(Object o1, Object o2)
focal_class.class_method_signature: RelatedTopics.setUseOntopolyNames(boolean useOntopolyNames)
focal_class.full_signature: public void setUseOntopolyNames(boolean useOntopolyNames)
focal_class.identifier: setUseOntopolyNames
focal_class.modifiers: public
focal_class.parameters: (boolean useOntopolyNames)
focal_class.return: void
focal_class.signature: void setUseOntopolyNames(boolean useOntopolyNames)
focal_method.body: public List makeModel(TopicIF topic) {
      // first, validate the configuration
      if (excltopics != null && !excltopics.isEmpty() &&
          incltopics != null && !incltopics.isEmpty())
        throw new OntopiaRuntimeException("Configuration fields includeTopicTypes and excludeTopicTypes cannot both be specified.");
      if (exclassocs != null && !exclassocs.isEmpty() &&
          inclassocs != null && !inclassocs.isEmpty())
        throw new OntopiaRuntimeException("Configuration fields includeAssociationTypes and excludeAssociationTypes cannot both be specified.");
          
      // then, update the configuration cache
      updateCache(topic.getTopicMap());
  
      ParsedQueryIF pquery = null;
      if (filterquery != null)
        pquery = parse(topic.getTopicMap(), filterquery);
  
      ParsedQueryIF headingOrderQuery = null;
      if (headingOrderQueryString != null)
        headingOrderQuery = parse(topic.getTopicMap(), headingOrderQueryString);
        
      ParsedQueryIF childOrderQuery = null;
      if (childOrderQueryString != null)
        childOrderQuery = parse(topic.getTopicMap(), childOrderQueryString);
      
      // group associations by the headings they will wind up under
      Map typemap = new HashMap();
      Iterator it = getRoles(topic).iterator();
      while (it.hasNext()) {
        AssociationRoleIF role = (AssociationRoleIF) it.next();
        if (isRoleHidden(role, pquery))
          continue; // if the filter hides this association we just skip it
  
        AssociationIF assoc = role.getAssociation();
        if (getWeakTypes().contains(getObjectId(assoc.getType()))) {
          // this is a weak type
          if (assoc.getRoles().size() != 2)
            throw new OntopiaRuntimeException("Weak associations cannot be " +
                                              "n-ary or unary");
          AssociationRoleIF other = getOtherRole(assoc, role);
          TopicIF player = other.getPlayer();
          TopicIF ttype = null;
          if (player.getTypes().size() > 0)
            ttype = (TopicIF) player.getTypes().iterator().next();
          String key = getObjectId(ttype);
          Heading heading = (Heading) typemap.get(key);
          if (heading == null) {
            heading = new Heading(ttype);
            if (headingOrderQuery != null)
              heading.setSortKey(getSortKey(ttype, headingOrderQuery));
            typemap.put(key, heading);
          }
          Association child = new Association(role, false);
          if (childOrderQuery != null)
            child.setSortKey(getSortKey(child.getPlayer(), childOrderQuery));
          heading.addChild(child);
        } else {
          // not a weak type
          String key = getObjectId(assoc.getType()) + "." +
                       getObjectId(role.getType());
          Heading heading = (Heading) typemap.get(key);
          if (heading == null) {
            heading = new Heading(assoc.getType(), role.getType());
            if (headingOrderQuery != null)
              heading.setSortKey(getSortKey(assoc.getType(), headingOrderQuery));
            typemap.put(key, heading);
          }
          Association child = new Association(role, true);
          if (childOrderQuery != null)
            child.setSortKey(getSortKey(child.getPlayer(), childOrderQuery));
          heading.addChild(child);
        }
      }
  
      // sort the headings
      List headings = new ArrayList(typemap.values());
      Collections.sort(headings);
  
      // sort the children
      for (int i=0; i < headings.size(); i++) {
        Heading heading = (Heading)headings.get(i);
        Collections.sort(heading.children);      
      }
      
      // we're done
      return headings;
    }
focal_method.class_method_signature: RelatedTopics.makeModel(TopicIF topic)
focal_method.full_signature: public List makeModel(TopicIF topic)
focal_method.identifier: makeModel
focal_method.invocations: isEmpty isEmpty isEmpty isEmpty updateCache getTopicMap parse getTopicMap parse getTopicMap parse getTopicMap iterator getRoles hasNext next isRoleHidden getAssociation contains getWeakTypes getObjectId getType size getRoles getOtherRole getPlayer size getTypes next iterator getTypes getObjectId get setSortKey getSortKey put setSortKey getSortKey getPlayer addChild getObjectId getType getObjectId getType get getType getType setSortKey getSortKey getType put setSortKey getSortKey getPlayer addChild values sort size get sort
focal_method.modifiers: public
focal_method.parameters: (TopicIF topic)
focal_method.return: List
focal_method.signature: List makeModel(TopicIF topic)