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