Sparnatural icon indicating copy to clipboard operation
Sparnatural copied to clipboard

Automatically display in the UI the inverse of properties specified in the config ?

Open tfrancart opened this issue 9 months ago • 6 comments

When I have a relation from A to B, I would like to be able in the UI to search from B to A, without the need to explicitely configure the inverse relation in the config. This would be an extra option in the "green arrows":

Image

Idea: in the UI, we could revert the arrows when the "inverse" is selected:

Image

See also #625 which is the same idea but for transitive path

tfrancart avatar Mar 28 '25 11:03 tfrancart

I like the idea!

Would it then also reverse range and domain to show applicable properties? Or would this only work for properties that are symmetric/reciprocal (like the example above)?

ch-sander avatar Apr 16 '25 12:04 ch-sander

Would it then also reverse range and domain to show applicable properties? Or would this only work for properties that are symmetric/reciprocal (like the example above)?

Yes actually the example above is a special case of a property with the same class as domain and range. But in general this would not work. What we would actually need is to automatically show in the UI the inverse of the properties specified in the configuration. Most of the time, tools do that by displaying labels such as "is xxxxx of":

Image

Image

But we could play on the direction of the arrows from left to right to show that

tfrancart avatar Apr 16 '25 13:04 tfrancart

What we would actually need is to automatically show in the UI the inverse of the properties specified in the configuration.

So, the owl would say P2 is inverse of P1, and the UI would suggest P1 even if is no property shape in the config.

I certainly misunderstand. Anyways, I would especially like dynamic inversions via property paths ^ so that inverse properties don't need to be defined anywhere, and range and domain are virtually flipped/inverted, too. But this might overload the UI property selector widget admittedly. But maybe properties for this to be allowed require a config bool flag, like for optional and not exist.

ch-sander avatar Apr 16 '25 17:04 ch-sander

So, the owl would say P2 is inverse of P1, and the UI would suggest P1 even if is no property shape in the config.

No. Only P1 is in the config, the UI would still display "inverse of P1".

Another use-case for link between membership and persons, where the inverse link of membership to person would be useful:

Image

tfrancart avatar Oct 08 '25 16:10 tfrancart

... automatically show in the UI the inverse of the properties specified in the configuration. ... Only P1 is in the config, the UI would still display "inverse of P1".

What I am thinking is the following:

  1. Sparnatural receives in its config both the SHACL and the OWL
  2. The OWL declares inverse properties (e.g. Pi inverseOf P)
  3. The SHACL contains a PropertyShape using P, connecting classes C1 and C2
  4. The SHACL does not contain a PropertyShape using Pi connecting classes C2 and C1
  5. Then a new Property Shape is inserted in the SHACL, with:
  • Property Path ^P (not Pi as it is not asserted in the graph)
  • domain C2 and range C1
  • label : the label of Pi

So basically the presence of the inverse property in the ontology would serve to 1/ detect an inverse is necessary 2/ read its label.

This can be controlled by a configuration parameter.

tfrancart avatar Dec 11 '25 13:12 tfrancart

I think that's a good and intelligible setup. However, a toggle or configuration parameter that allows to invert any property that has a shape for range and domain could be useful, and puts less burden on the designer of the configuration...

ch-sander avatar Dec 11 '25 13:12 ch-sander