sybila / eBCSgen

eBCSgen - BioChemical Space Language support tool.
https://ebcsgen.readthedocs.io/
MIT License
2 stars 4 forks source link

Rule labels in regulations and regular regulations #97

Closed mopichalova closed 5 months ago

mopichalova commented 6 months ago

This pull request is ensuring all rule labels referenced in regulations exist within the model and makes sure that only correct regular expressions are allowed in regular regulation.

Invalid regulations now trigger new error RegulationParsingError.

Each regulation has now a method check_labels that makes sure labels mentioned in the regulation actually exist in the model.

Close #95 Close #88

mopichalova commented 6 months ago

I've implemented a check_labels method in the Regular regulation to ensure all rule labels used in a regex pattern actually exist in our model.

However, given that our labels are concatenated in the regex without any delimiters (e.g., spaces), I had to resort to generating all possible label permutations to validate against the regex. This approach ensures comprehensive validation but introduces significant time complexity due to the exhaustive permutation process.

I'm concerned about the performance impact and am currently exploring ways to optimize this operation. Do you have any suggestions or insights on more efficient methods to validate regex patterns against our label set without generating permutations? I'd greatly appreciate your input.

xtrojak commented 5 months ago

Feel free to introduce some form of delimiters - don't pay attention to how it is right now.

mopichalova commented 5 months ago

Feel free to introduce some form of delimiters - don't pay attention to how it is right now.

Introduced a ; delimiter for efficiency, ensuring it avoids regex conflicts and label definition. This change simplifies label processing in check_labels.

xtrojak commented 5 months ago

I think we should also add tests covering these changes. We can discuss how to test this.

EDIT: to be continued in #101.