INCATools / dosdp-tools

Utility for working with DOSDP design patterns and OWL ontologies
MIT License
24 stars 5 forks source link

Provide a way to define labels with regular expression replacement patterns #476

Open matentzn opened 1 year ago

matentzn commented 1 year ago

Right now, we are able to define simple lexical patterns like this:

"% biome" to define classes like "desert biome". Now the interesting thing is that in the case of biomes we define them in terms of "ecosystems", which means that the filler class is called something like "desert ecosystem". Now, we don't want to label our new class "desert ecosystem biome" - that's silly.

What would be good if we had a more flexible way to specify patterns for labels and definitions. For example something like:

text: "% biome"
match: r'(.*) ecosystem (biome)'
replacement: "$1 $2"

This would not be used for inference, just as a postprocessing step after the label is generated. I guess one may want to provide multiple match and replace rules, so his would be more flexible:

text: "% biome"
postprocessing:
  - match: r'(.*) ecosystem (biome)'
     replacement: "$1 $2"

@cmungall sounds a bit too crazy?

balhoff commented 1 year ago

Pretty sure you can do this already 😀

See https://github.com/INCATools/dead_simple_owl_design_patterns/blob/c9333788e675d865323d119dd77a71635d343e24/src/schema/dosdp_schema.yaml#L202C10-L220

Example: https://github.com/geneontology/go-ontology/blob/master/src/design_patterns/activator_activity.yaml