Skip to content

incorrect PENMAN encoding oof triple list with duplicate :instance triple #113

@jheinecke

Description

@jheinecke

I found an (possible) issue with doubled instances (e.g. twice n / name instead a simple n in the second case) in a penman notation. Parsing the following graph
with

g = penman.decode(amr)
for x in g.triples:
    print(x)
(a2 / and
         :op1 (c2 / country
                 :name (n / name))
         :op2 (c3 / country
                 :name (n / name))
)

returns

('a2', ':instance', 'and')
('a2', ':op1', 'c2')
('c2', ':instance', 'country')
('c2', ':name', 'n')
('n', ':instance', 'name')
('a2', ':op2', 'c3')
('c3', ':instance', 'country')
('c3', ':name', 'n')
('n', ':instance', 'name')

with ('n', ':instance', 'name') twice
If I want to re-encode this triples into penman with pm = penman.encode(penman.Graph(tr)); print(pm) I get the incorrect penman

(a2 / and
    :op1 (c2 / country
             :name (n / name
                      / name))

I wonder where the bug is. I agree that the initial penman is at least suboptimal since n / name occurs twice ant should have only n in the second place. since n's concept is name in both cases that sould not be an fatal error.
Or is it the fact that ('n', ':instance', 'name') occurs twice which creates an incorrect penman.
So if the initial penman graph is acceptable, than there is clearly a problem in the decode/encode methods ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions