opencaesar / oml

Ontological Modeling Language (OML)
https://opencaesar.github.io/oml/
Apache License 2.0
24 stars 4 forks source link

Syntax support for inverses #79

Open NicolasRouquette opened 3 years ago

NicolasRouquette commented 3 years ago

User Story

As an ontology author, I would like oml syntactic support for referring to an inverse of a relation entity or of a property that does not have a named inverse so that I can author vocabularies that require this expressiveness..

Detailed Description

Description providing additional details and context.

There are a few places where OML lacks syntax for referring to an inverse relation entity or property:

Specialization of an inverse relation entity.

This is currently not possible. For example, suppose that there is a relation R with domain A and range B and forward property r:

relation entity R [
  from A
  to B
  forward r
]

In OWL functional syntax, the above means (ignoring the rule):

Declaration(Class :R))
Declaration(ObjectProperty :r))
ObjectPropertyDomain(:r, :A)
ObjectPropertyRange(:r, :B)

Elsewhere, one may need to define S, a specialization of the inverse of R for some domain C that may be B or a specialization and for some range D that may be A or a specialization.

It would be useful to define S as follows with a new OML keyword inverse() like the following:

relation entity S :> inverse(R) [
  from C
  to D
  forward s
]

The syntax above would map in OML to the following in functional syntax:

Declaration(Class :S))
SubClassOf(:S, :R)
Declaration(ObjectProperty :s))
ObjectPropertyDomain(:s, :C)
ObjectPropertyRange(:s, :D)
SubObjectPropertyOf(:s ObjectInverseOf(:r))

It is currently not possible to do this.

Restriction of an inverse property

This is currently not possible. For example, suppose that there is a relation R with domain A and range B and forward property r without a named inverse:

relation entity R [
  from A
  to B
  forward r
]

There is currently no syntax to specify a restriction on the inverse of r.

Propose adding new syntax like the following based on a new OML keyword inverse() like the following:

concept C :> A
concept D :> B [
  restricts all relation inverse(r) to C
]

This syntax should be available for all OML restrictions of entity relation properties.

OML syntax extension

The proposed OML keyword inverse() and syntax could be replaced with something else that achieves the expressive intent of this ticket.

Acceptance Criteria

Sub-task List

melaasar commented 2 years ago

re: Specialization of an inverse relation entity

Instead, you can do the following and it should have the same intended semantics:

relation entity S :> R [
  from D
  to C
  reverse s
]
melaasar commented 2 years ago

re: Restriction of an inverse property

Couldn't you simply add a name to the reverse property?

NicolasRouquette commented 2 years ago

Well, to be clear, we need to look at the mapping of :> for a relation entity.

I expect that S :> R means:

This usually works with asserting D :> B and C :> A, if not, this may be inferred by the reasoner.

That is:

relation entity S :> R [
  from D
  to C
  reverse s
]

and

relation entity S :> R [
  from C
  to D
  forward s
]

mean completely different things.

melaasar commented 2 years ago

When you declare:

relation entity S :> R [
  from D
  to C
  reverse s
]

You get:

Declaration(Class :S))
SubClassOf(:S, :R)
Declaration(ObjectProperty :s))
ObjectPropertyDomain(:s, :C)
ObjectPropertyRange(:s, :D)
SubObjectPropertyOf(:s ObjectInverseOf(:r))

In your last comment, if you labeled the forward/reverse, you get the following (which is the same as above):

S.forward  (inverse of s) :> R.forward (r)
S.reverse (s) :> R.reverse (inverse of r)
NicolasRouquette commented 2 years ago

In your example, the reverse property of S is a sub-object property of the reverse property of R.

The point of the proposed syntax is to make the forward property of the specializing relation a sub-object property of the reverse property of the specialized relation.

Clarifying the original example:

concept A
concept B

relation entity R [
  from A
  to B
  forward r
]

concept C :> B
concept D :> A

relation entity S :> inverse(R) [
  from C
  to D
  forward s
]

That is:

Declaration(Class :A))
Declaration(Class :B))
Declaration(Class :R))
Declaration(ObjectProperty :r))
ObjectPropertyDomain(:r, :A)
ObjectPropertyRange(:r, :B)

Declaration(Class :C))
SubClassOf(:C, :B)
Declaration(Class :D))
SubClassOf(:D, :A)
Declaration(Class :S))
SubClassOf(:S, :R)
Declaration(ObjectProperty :s))
ObjectPropertyDomain(:s, :C)
ObjectPropertyRange(:s, :D)
SubObjectPropertyOf(:s ObjectInverseOf(:r))
melaasar commented 2 years ago

Nic, those inferences are exactly what you get with:

relation entity S :> R [
  from D
  to C
  reverse s
]

Where do you see the difference?

NicolasRouquette commented 2 years ago

The difference is that the domain of S must be C, not D; similarly the range must be D, not C. Finally, the forward property of S must be the inverse of the forward property of R.

melaasar commented 2 years ago

Since "s" is a reverse, its domain is the "to" of the relation (i.e., C), and its range is the "from" of the relation (i.e., D), which is what you want and said above.

melaasar commented 2 years ago

and since "s" is a reverse, it becomes subproperty of the super relationentity's reverse. Since R's reverse is unnamed, we can refer to it as inverseOf (r), i.e.,

s :> inverseof (r)

which is what you want.

NicolasRouquette commented 2 years ago

This would be a completely different situation.

Consider the original example split in two parts:

relation entity S [
  from C
  to D
  forward s
]

Then later, we can add:

ref relation entity S :> inverse(R), R2, inverse(R3)

or:

ref relation entity S :> R, inverse(R2), R3

The point here is that the two specialization axioms are completely independent of the definition of S and R, R2 and R3; however, it does make a difference whether we specialize the relation R or inverse(R).

melaasar commented 2 years ago

OK so the requirement here is to be able to declare the specialization between S and R without having to change S (since this is possible as I suggested).

NicolasRouquette commented 2 years ago

yes