Package net.sourceforge.yagsbook.encyclopedia.indexing

Examples of net.sourceforge.yagsbook.encyclopedia.indexing.Topic


        if (subjectName == null) {
            subjectName = getTitle();
        }

        return new Topic(subjectUri, subjectName);
    }
View Full Code Here


                    Node    node = list.item(i);

                    String  uri = getTextNode(node, "@uri");
                    String  name = getTextNode(node);

                    topics.add(new Topic(uri, name));
                }
            } catch (XMLException e) {
            }

            return topics;
View Full Code Here

        Iterator    iter = entry.getTopics();

        Log.info("Processing entry ["+entry.getUri()+"/"+entry.getTitle()+"]");

        while (iter.hasNext()) {
            Topic      topic = (Topic)iter.next();
            Index      idx = (Index)indices.get(topic.getUri());

            if (idx == null) {
                idx = new Index(topic.getUri(), topic.getName());
                indices.put(topic.getUri(), idx);
            }
            idx.add(entry);
        }

        Index       all = (Index)indices.get("all");
View Full Code Here

    testGetSubject() {
        final String    URI = "test";
        final String    NAME = "Test Subject";
       
        MockArticle     mock = new MockArticle();
        mock.setSubject(new Topic(URI, NAME));
       
        try {
            Article     article = new Article("test", mock.toXML());
           
            Topic       subject = article.getSubject();
            assertEquals("Subject has wrong uri", URI, subject.getUri());
            assertEquals("Subject has wrong name", NAME, subject.getName());
        } catch (IOException e) {
            fail("Failed to parse article");
        }
    }
View Full Code Here

       
        MockArticle     mock = new MockArticle();
       
        Topic[]         topics = new Topic[NUMBER];
        for (int i=0; i < NUMBER; i++) {
            topics[i] = new Topic(URI+i, NAME+i);
        }
        mock.setTopics(topics);
       
        try {
            Article     article = new Article("test", mock.toXML());
            Iterator    iter = article.getTopics();
           
            int count = 0;
            while (iter.hasNext()) {
                Topic   topic = (Topic) iter.next();
               
                if (count >= NUMBER) {
                    fail("Too many topics returned");
                }
                assertEquals("Topic uri "+count+" was wrong",
                             topics[count].getUri(), topic.getUri());
                assertEquals("Topic name "+count+" was wrong",
                             topics[count].getName(), topic.getName());
                count++;
            }
            assertEquals("Too few topics returned", NUMBER, count);
        } catch (IOException e) {
            fail("Failed to parse article");
View Full Code Here

           
            if (subjectSet == null) {
                subjectSet = new TreeSet();
                subjectList.put(subject, subjectSet);
            }
            subjectSet.add(new Topic(uri, entry.getTitle()));
        }
    }
View Full Code Here

            iter = subjectSet.iterator();
        }
       
        Vector      vector = new Vector();
        while (iter.hasNext()) {
            Topic   topic = (Topic)iter.next();
            IEntry  entry = getEntry(topic.getUri());
            if (!includeParent && entry.getUri().equals(subject.getUri())) {
                continue;
            }
            vector.add(entry);
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.yagsbook.encyclopedia.indexing.Topic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.