amrisi / amr-guidelines

250 stars 87 forks source link

:mod + constant in figure/table references: trouble with inverses #235

Open nschneid opened 6 years ago

nschneid commented 6 years ago

The rule for figure references involves putting a string under :mod:

Example: Figure 6a [isi_0002.564]

(f / figure
    :mod "6a")

Similarly, a number for table references:

Example: Table 5 [isi_0002.563]

(t / table
    :mod 5)

As raised by https://github.com/goodmami/penman/issues/19#issuecomment-412642623, this breaks code which assumes that all :mod relations are the inverse of :domain, which suggests that they will only link variables, not a variable and a constant (string or number).

So: Should VARIABLE :mod CONSTANT not be considered equivalent to VARIABLE :domain-of CONSTANT? I.e. is this an exception where :mod has no inverse? Or should we assume that a :domain relation can be headed by a constant?

Or, should we change the guideline for references to treat the figure/table as a named entity, thus putting the constant under name :op1 rather than :mod?

Related: #194, https://github.com/snowblink14/smatch/issues/10

goodmami commented 4 years ago

FWIW in Penman I decided to treat both :domain and :mod as primary (non-inverse) roles. This is following @ulfulf's advice in #194

All roles listed at http://www.isi.edu/~ulf/amr/lib/roles.html are primary (i.e. non-inverse) roles [...]

Thus, :domain-of is the inverse of :domain and :mod-of is the inverse of :mod. In order to resolve the idea described in the Guidelines that the inverse of :domain is :mod and vice-versa, I now have a penman.transform.canonicalize_roles() function that normalizes :domain-of to :mod and :mod-of to :domain, but this step is optional.

This method allows both :domain and :mod to links variables with constants, however such edges cannot be inverted as the source of a relation must always be a variable.

From my point of view this issue can be closed. If anything, the Guidelines can be updated to more carefully describe how :domain and :mod can be inverses of the other.