"None" Type Proposal

iRel Requirements
iRel Interface (v1_0)
EntArr Proposal (v1 1)
iRel Use Cases

Proposal: Addition of relation type NONE

This proposal should be considered "next to" the EntArr (v1.1) proposal. This proposal is designed to provide the same core functionality contained in the EntArr proposal, while being more consistent and interoperable with the v1.0 iRel interface.

The following additions to the iRel 1.0 interface and data model are proposed:

Relation Type

We propose to add a relation type None to the existing types Ent, Set, and Both. For relations having None on a side, the types of objects participating in the relation on that side of the interface are only known by traversing all entities, sets, or both on the other side of the interface (depending on the relation type on that other side). In other words, the relations are one-way, from the side opposite the None side to the None side.

Adding None to the relation types in iRel 1.0, the following two-sided relation types would be allowed:

  • Entity-Entity
  • Entity-Set
  • Set-Set
  • Entity-Both
  • Set-Both
  • Both-Both
  • Entity-None
  • Set-None
  • Both-None

Type None-None does not make any sense since then there would be no relations at all.

For type Both-None, both entities and sets on the side opposite the None would participate in the relation.

API

Get

Functionality to get relations for entities/sets on the None side will be supported, but will have efficiency equal to O(N), where N is the number of entities and/or sets on the other side of the relation. In other words, satisfying this query will require traversal of all entities and/or sets on the other side of the relation.

  • iRel_getEntEntRelation (/*in*/ EntityHandle, /*out*/ EntityHandle*)
  • iRel_getEntSetRelation (/*in*/ EntityHandle, /*out*/ EntitySetHandle*)
  • iRel_getEntSetIterRelation (/*in*/ EntityHandle, /*out*/ EntityIterator*)
  • iRel_getSetEntRelation (/*in*/ EntitySetHandle, /*out*/ EntityHandle*)
  • iRel_getSetSetRelation (/*in*/ EntitySetHandle, /*out*/ EntitySetHandle*)

Set

Setting the relation on the non-None side of the relation will be more efficient than for other types, since no relations on the opposite side need be updated.

  • iRel_rmvEntEntRelation (/*in*/ EntityHandle, /*in*/ EntityHandle)
  • iRel_rmvEntSetRelation (/*in*/ EntityHandle, /*in*/ EntitySetHandle)
  • iRel_rmvSetEntRelation (/*in*/ EntitySetHandle, /*in*/ EntityHandle)
  • iRel_rmvSetSetRelation (/*in*/ EntitySetHandle, /*in*/ EntitySetHandle)

Attempting to set the relations for entities or sets on the None side will result in an error.

Remove

  • iRel_rmvEntEntRelation (/*in*/ EntityHandle, /*in*/ EntityHandle)
  • iRel_rmvEntSetRelation (/*in*/ EntityHandle, /*in*/ EntitySetHandle)
  • iRel_rmvSetEntRelation (/*in*/ EntitySetHandle, /*in*/ EntityHandle)
  • iRel_rmvSetSetRelation (/*in*/ EntitySetHandle, /*in*/ EntitySetHandle)

Like setting relations, removing relations on the non-None side will be more efficient than for other types, since no relations on the opposite side need be updated.

Change Type

Changing the relation type from Ent, Set, or Both to None on a side will be O(1), assuming the relations on the side going to None type do not need to be removed from entities or sets. Going from a None to an Ent, Set, or Both, will require O(N), where N is the number of entities, sets, or both (depending on the new relation type) on the side opposite the changing None side.

  • changePairType (/*in*/ iRel_PairHandle, /*in*/ typeOfSide1, /*in*/ typeOfSide2)

Infer Relation

  • iRel_inferAllRelations (/*in*/ iRel_PairHandle)
  • iRel_inferAllRelationsAndType (/*in*/ iRel_PairHandle)
  • iRel_inferEntRelations (/*in*/ iRel_PairHandle, /*in*/ EntityHandle)
  • iRel_inferSetRelations (/*in*/ iRel_PairHandle, /*in*/ EntitySetHandle)
  • iRel_inferEntArrRelations (/*in*/ iRel_PairHandle, /*in*/ EntityHandle*)
  • iRel_inferSetArrRelations (/*in*/ iRel_PairHandle, /*in*/ EntitySetHandle*)

Notes

  • The new relation type None has a cost no worse than that of the Ent or Set side opposite an EntArray relation type. In that proposal, to recover the entities or sets related to an entity or set opposite the EntArray side required traversal of the entities or sets on the EntArr side. The same applies to finding entities or sets related to an entity or set on the None side of the relation.
  • Changing relation type from None to Ent or Set is straightforward, requiring only a traversal of entities or sets on the other side of the relation. Thus, this new relation type fits nicely with the other existing relation types.
  • One-sided relations have been requested for supporting fields; this proposal satisfies that request.