mff-uk / dataspecer

https://dataspecer.com
MIT License
24 stars 6 forks source link

Distinction between attributes and associations in a semantic model #803

Open sstenchlak opened 1 week ago

sstenchlak commented 1 week ago

Following the discussion from #449, currently, the semantic model does not provide a mechanism to specify whether a given relationship should be classified as an association or an attribute. This distinction is only on the visual model; however, we need it at the semantic level as well.

There are two potential ways to implement this:

Related issues: #449, #451

skodapetr commented 1 week ago

What is the effective difference for association vs attribute outside of the visual?

jakubklimek commented 1 week ago

@skodapetr Well,

  1. structure editor treats them differently - regardless if the are visualized or not
  2. documentation generators treat them differently. Here, it may or may not be connected to how they are visualized
  3. Maybe some other generators might treat them differently.

What RDFS does is that datatypes are instances of rdfs:Datatype:

rdfs:Datatype is both an instance of and a subclass of rdfs:Class. Each instance of rdfs:Datatype is a subclass of rdfs:Literal.

This corresponds to @sstenchlak second point.

OWL then explicitly distinguishes DatatypeProperty and ObjectProperty. There is a correspondence - datatype properties have instances of rdfs:Datatype as ranges.

This corresponds to @sstenchlak first point.

The same issue will be with distinguishing datatypes and classes. Some classes are datatypes, and then they are ranges for datatype properties.

So the question boils down to whether we annotate both relationships and classes in DS Core (an maintain consistency), or just one of those. I would annotate both, as it might be easier to use, or hide this behind and interface that will allow me to work with datatype/object properties and classes/datatypes, regardless of whether this is annotated in one place or two.

@skodapetr Just a note - the semantic-level distinction is separate from the visual-level distinction - all combinations are possible - DatatypeProperty displayed as a relation or an attribute, and the same for ObjectProperty.

skodapetr commented 1 week ago

Few more questions:

1) Based on the semantic-level distinction is separate from the visual-level distinction, the visual model must be able to store additional information. Why not do something similar for other use-cases?

2) I belive we can have a relationship without a range. Is such relationship is association or attribute? Can I create a property "name" without explicitly stating a range?

3) There is already a "functionality" to distinguish between association and attribute. The disadvantage is, that it is based on a hardcoded list of "primitives" and a hack.