001package de.deepamehta.facets;
002
003import de.deepamehta.core.DeepaMehtaObject;
004import de.deepamehta.core.RelatedTopic;
005import de.deepamehta.core.Topic;
006import de.deepamehta.core.model.facets.FacetValueModel;
007
008import java.util.List;
009
010
011
012public interface FacetsService {
013
014    // ### TODO: rename to getFacetValue?
015    RelatedTopic getFacet(long topicId, String facetTypeUri);
016
017    /**
018     * Retrieves a facet value.
019     * ### TODO: rename to getFacetValue?
020     *
021     * @param   object          The facetted object: a topic, association, a type ...
022     * @param   facetTypeUri    URI of the facet type.
023     *
024     * @return  The retrieved facet value (including its child topics) or <code>null</code> if no such topic extists.
025     */
026    RelatedTopic getFacet(DeepaMehtaObject object, String facetTypeUri);
027
028    // ---
029
030    // ### TODO: rename to getFacetValues?
031    List<RelatedTopic> getFacets(long topicId, String facetTypeUri);
032
033    /**
034     * Retrieves the values of a multi-facet.
035     * ### TODO: rename to getFacetValues?
036     *
037     * @param   object          The facetted object: a topic, association, a type ...
038     * @param   facetTypeUri    URI of the facet type.
039     *
040     * @return  The retrieved facet values (including their child topics). The list may be empty.
041     */
042    List<RelatedTopic> getFacets(DeepaMehtaObject object, String facetTypeUri);
043
044    // ---
045
046    Topic getFacettedTopic(long topicId, List<String> facetTypeUris);
047
048    void addFacetTypeToTopic(long topicId, String facetTypeUri);
049
050    // ---
051
052    void updateFacet(long topicId, String facetTypeUri, FacetValueModel value);
053
054    /**
055     * Updates a facet.
056     *
057     * @param   object          The facetted object: a topic, association, a type ...
058     * @param   facetTypeUri    URI of the facet type.
059     * @param   facetValue      The new facet value.
060     */
061    void updateFacet(DeepaMehtaObject object, String facetTypeUri, FacetValueModel value);
062
063    // ---
064
065    boolean hasFacet(long topicId, String facetTypeUri, long facetTopicId);
066}