Skip to content

PropMatch Encoder Bugs #113

Description

@abhishekreddyallu

Property encoder workflows have dispatch, prompt-context, and inverse-label inconsistencies

1. Keyword dispatch breaks property LLM encoder overrides

Location: ontoaligner/encoder/llm.py:39, ontoaligner/encoder/llm.py:44

Current code used keyword dispatch:

self.get_owl_items(owl=source)
self.get_owl_items(owl=target)

But PropertyLLMEncoder overrides use a different parameter name, such as:

def get_owl_items(self, prop):

This caused property encoding to fail.

Observed before fix:

TypeError: ... got an unexpected keyword argument 'owl'

Fix:

encoded_source = self.get_owl_items(source)
encoded_target = self.get_owl_items(target)

Verified after fix:

PropertyLLMEncoder completed successfully.
PropertyFullTextLLMEncoder completed successfully.

2. Full-text property context was missing from LLM prompts

Location: ontoaligner/encoder/property.py
Related: ontoaligner/aligner/llm/dataset.py

The PropertyFullTextLLMEncoder and the PropertyFullTextLLMDataset were not using a consistent encoded schema.

The encoder prepared domain/range/inverse context, but the prompt dataset was reading fields in a way that could leave these sections empty or process already-encoded text incorrectly.

Expected prompt fields as PropMatchEncoder:

domain_text
range_text
inverse_text

Fix in PropertyFullTextLLMEncoder:

return {
    **prop,
    "domain_text": domain_text,
    "range_text": range_text,
    "inverse_text": inverse_text,
    "text": combined_text,
}

Fix in PropertyFullTextLLMDataset:

source_domain = self.preprocess(input_data["source"].get("domain_text", ""))
target_domain = self.preprocess(input_data["target"].get("domain_text", ""))

source_range = self.preprocess(input_data["source"].get("range_text", ""))
target_range = self.preprocess(input_data["target"].get("range_text", ""))

source_inverse = self.preprocess(input_data["source"].get("inverse_text", ""))
target_inverse = self.preprocess(input_data["target"].get("inverse_text", ""))

Verified after fix:

PropertyFullTextLLMDataset created successfully

Domain present: True
Range present: True
Inverse present: True

PASS: Full-text property context is present in the generated prompt.

3. Inverse labels were split character-by-character

Location: ontoaligner/encoder/property.py:136
Location: ontoaligner/encoder/property.py:264

OntologyProperty.extract_data() stores inverse_label as a string.

Example:

"inverse_label": "transforms into"

But the encoders used " ".join(...) on inverse_label, which could split a string into characters.

Problem pattern:

inverse_text = ""
        if property['inverse_of']:
            inverse_text = " ".join(property['inverse_label']) if len(property['inverse_label']) > 0 else ""

This can produce incorrect text such as:

t r a n s f o r m s   i n t o

Fix:

inverse_text = ""
if property.get("inverse_of"):
    inverse_text = property.get("inverse_label") or ""

And for PropertyFullTextLLMEncoder:

inverse_text = ""
if prop.get("inverse_of"):
    inverse_text = prop.get("inverse_label") or ""

Verified after fix:

Raw inverse label: 'transforms into'
Encoded inverse: 'transforms into'
PASS: inverse label remains a complete string.

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