001package de.monochromata.anaphors.cog;
002
003import de.monochromata.anaphors.ast.ASTBasedAnaphora;
004import de.monochromata.anaphors.ast.relatedexp.RelatedExpression;
005import de.monochromata.anaphors.cog.transform.CheckResult;
006import de.monochromata.anaphors.cog.transform.PreparatoryTransformation;
007
008/**
009 * Used to represent (potential) resolutions of anaphors based on a cognitive
010 * model.
011 * <p>
012 * Anaphor resolution may require a preparatory AST transformation. Anaphor
013 * resolution eventually happens by obtaining an AST-based
014 * {@link ASTBasedAnaphora} relation that can be underspecified.
015 *
016 * @param <N>  The node type in the AST
017 * @param <E>  The expression type
018 * @param <T>  The type type
019 * @param <B>  The binding type
020 * @param <TB> The type binding type
021 * @param <S>  The scope type (optional)
022 * @param <I>  The type used to represent identifiers
023 * @param <QI> The type used to represent qualified identifiers
024 * @param <R>  The sub-type of related expression to use
025 * @param <A>  The sub-type of AST-based anaphora to use
026 */
027public interface Resolution<N, E, T, B, TB extends B, S, I, QI, R extends RelatedExpression<N, T, B, TB, S, QI, R>, A extends ASTBasedAnaphora<N, E, T, B, TB, S, I, QI, R, A>> {
028
029        /**
030         * The check result is obtained from the {@link PreparatoryTransformation} and
031         * can be used to actually perform the preparatory transformation.
032         *
033         * @return a check result with {@link CheckResult#canPerformTransformation()}
034         *         returning {@literal true}.
035         * @see PreparatoryTransformation#canPerform(de.monochromata.anaphors.cog.memory.Chunk,
036         *      Object, Object)
037         * @see PreparatoryTransformation#perform(CheckResult, ASTBasedAnaphora)
038         * @see #getPreparatoryTransformation()
039         */
040        public CheckResult<N, E, S> getCheckResult();
041
042        /**
043         * @return a preparatory AST transformation that yields the AST-based
044         *         {@link ASTBasedAnaphora} relation.
045         * @see #getPreliminaryAnaphora()
046         * @see PreparatoryTransformation#perform(CheckResult, ASTBasedAnaphora)
047         * @see #getCheckResult()
048         */
049        public PreparatoryTransformation<N, E, T, B, TB, S, I, QI, R, A> getPreparatoryTransformation();
050
051        /**
052         * The preliminary anaphora might be used to signal to users which anaphora
053         * relations are available, e.g. in case of referential ambiguity.
054         *
055         * @return a preliminary anaphora relation comparable to the one that could be
056         *         re-resolved after the preparatory transformation has been applied.
057         * @see #getPreparatoryTransformation()
058         */
059        public A getPreliminaryAnaphora();
060
061}