001package de.monochromata.anaphors.ast; 002 003import de.monochromata.anaphors.ast.reference.Referent; 004import de.monochromata.anaphors.ast.reference.strategy.ReferentializationStrategy; 005import de.monochromata.anaphors.ast.relatedexp.RelatedExpression; 006import de.monochromata.anaphors.ast.relatedexp.strategy.RelatedExpressionStrategy; 007import de.monochromata.anaphors.ast.strategy.AnaphorResolutionStrategy; 008 009/** 010 * The relation between anaphor and related expression. Because instances of 011 * this type contain AST nodes, they should be short-lived and must not be 012 * persisted. 013 * 014 * @param <N> The node type in the AST 015 * @param <E> The expression type 016 * @param <T> The type type 017 * @param <B> The binding type 018 * @param <TB> The type binding type 019 * @param <S> The scope type (optional) 020 * @param <I> The type used to represent identifiers 021 * @param <QI> The type used to represent qualified identifiers 022 * @param <R> The sub-type of related expression to use 023 * @param <A> The sub-type of AST-based anaphora to use 024 */ 025public interface ASTBasedAnaphora<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>> 026 extends RelatedExpressionPart<N, E, T, B, TB, S, I, QI, R>, AnaphorPart<N, E, T, B, TB, S, I, QI, R, A> { 027 028 /** 029 * Returns an identifier of the kind of anaphora relationship in the format 030 * <code><relatedExpressionStrategy>-<anaphorResolutionStrategy>-<referentializationStrategy></code> 031 * 032 * @return An identifier of the kind of anaphora relationship 033 * @see RelatedExpressionStrategy#getKind() 034 * @see AnaphorResolutionStrategy#getKind() 035 * @see ReferentializationStrategy#getKind() 036 */ 037 default String getKind() { 038 return KindComposition.getKind(this, this); 039 } 040 041 public RelatedExpressionPart<N, E, T, B, TB, S, I, QI, R> getRelatedExpressionPart(); 042 043 public AnaphorPart<N, E, T, B, TB, S, I, QI, R, A> getAnaphorPart(); 044 045 @Override 046 default R getRelatedExpression() { 047 return getRelatedExpressionPart().getRelatedExpression(); 048 } 049 050 @Override 051 default RelatedExpressionStrategy<N, T, B, TB, S, QI, R> getRelatedExpressionStrategy() { 052 return getRelatedExpressionPart().getRelatedExpressionStrategy(); 053 } 054 055 @Override 056 default String getAnaphor() { 057 return getAnaphorPart().getAnaphor(); 058 } 059 060 @Override 061 default E getAnaphorExpression() { 062 return getAnaphorPart().getAnaphorExpression(); 063 } 064 065 @Override 066 default Referent<TB, S, I, QI> getReferent() { 067 return getAnaphorPart().getReferent(); 068 } 069 070 @Override 071 default AnaphorResolutionStrategy<N, E, T, B, TB, S, I, QI, R, A> getAnaphorResolutionStrategy() { 072 return getAnaphorPart().getAnaphorResolutionStrategy(); 073 } 074 075 @Override 076 default ReferentializationStrategy<E, TB, S, I, QI> getReferentializationStrategy() { 077 return getAnaphorPart().getReferentializationStrategy(); 078 } 079 080 @Override 081 default B getBinding() { 082 return getAnaphorPart().getBinding(); 083 } 084 085 @Override 086 default TB resolveType(final S scope) { 087 return getAnaphorPart().resolveType(scope); 088 } 089 090 /** 091 * Returns a description of the anaphora relation, to enable users to 092 * distinguish multiple anaphora relations that are referentially ambiguous. 093 * <p> 094 * The reference description does not contain information about the anaphor, but 095 * only information on the related expression and the referent. 096 */ 097 public String getReferenceDescription(); 098 099 /** 100 * @return {@literal true} if this anaphora relation is underspecified, i.e. is 101 * not explicated. 102 * @see #isExplicated() 103 * @deprecated The state of an anaphor should be represented internally in an 104 * implementation-specific way. This method will be removed in the 105 * future. 106 */ 107 @Deprecated 108 public boolean isUnderspecified(); 109 110 /** 111 * @return {@literal true} if this anaphora relation is explicated, i.e. is not 112 * underspecified. 113 * @see #isUnderspecified() 114 * @deprecated The state of an anaphor should be represented internally in an 115 * implementation-specific way. This method will be removed in the 116 * future. 117 */ 118 @Deprecated 119 public boolean isExplicated(); 120}