001package de.deepamehta.core;
002
003import de.deepamehta.core.model.TopicModel;
004
005
006
007/**
008 * Specification of a topic -- DeepaMehta's central data object.
009 *
010 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
011 */
012public interface Topic extends DeepaMehtaObject {
013
014    void update(TopicModel model);
015
016    // ---
017
018    /**
019     * Searches this topic's child topics for a topic of the given type.
020     * Only the child topics which are already loaded into memory are searched; the DB is not accessed.
021     * <p>
022     * The first topic found is returned, according to a depth-first search.
023     * For multiple-value childs the first topic is returned.
024     * If the given type matches this topic directly it is returned immediately.
025     * <p>
026     * The search is driven by this topic's type definition. That is child topics which do not adhere
027     * to the type definition are not found.
028     * <p>
029     * TODO: make this generic by moving to DeepaMehtaObject interface?
030     *
031     * @return  the found topic, or <code>null</code>.
032     */
033    Topic findChildTopic(String topicTypeUri);
034
035    // ---
036
037    Topic loadChildTopics();
038    Topic loadChildTopics(String assocDefUri);
039
040    // ---
041
042    TopicModel getModel();
043}