Skip to content

Python ontology parser rejects a reverse verbalization of a relationship #445

Description

@FactEngineCommunity

In standard Fact-Based Modelling, a relationship can be described naturally from either participant’s perspective (as below):

While the 'verbalizes' documentation is for a list, the loader for the verbalizes field can accept a list of verbalizations in only one role-order.
I.e. The reverse-fact-type-reading, "{Company} employs {Person}" is rejected, while "{Person} works for {Company}" is accepted.

version: 0.2.0.dev0
name: ReverseReading
ontology:
  - concept: Person
    type: EntityType
    relationships:
      - name: works for
        roles:
          - concept: Company
        verbalizes:
          - '{Person} works for {Company}'
          - '{Company} employs {Person}'
  - concept: Company
    type: EntityType
...

Loading this file with OssieParser().parse(path) raises:
ValueError: Role 0: 'Person:Person' does not match verbalization role 'Company:None'

The first reading loads if the second is removed. In _parse_verbalization(), each placeholder is compared with relationship.role(idx), so every verbalization must follow the declared role order. The call starts in OssieParser.parse() and passes through the spec converter.

Expected behaviour: Both readings should be accepted as verbalizations of the same relationship, with its declared roles unchanged. If fixed role order is intentional, could that restriction be documented? This was observed against Ossie checkout cc919e9.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions