N-ary Relationship

latest update 2024-09-30  

Introduction

The requirement of adding the concept of N-ary Relationship to ISO 15926-2 has been voiced.
This topic explains that that concept is already in this standard in the form of MultidimensionalObject.

Granted, it is a bit more difficult to grasp, but that is because MultidimensionalObject is more powerful and versatile that a plain N-ary Relationship, because it adds semantics to the N-ary Relationship.

The role of the duo ClassOfMultidimensionalObject and MultidimensionalObject will be explained for:.

Use in certain templates

Let's start with a graph:

The 'Roles' of the ClassOfMultidimensionalObject define the 'Elements' of the member MultidimensionalObject, in the same order.

The formal definitions are:

ClassOfMultidimensionalObject

A ClassOfMultidimensionalObject is a Class whose members are instances of MultidimensionalObject.
The role played by each position in the classified MultidimensionalObject is specified at the same position
in the roles attribute. Constant values that apply to any position in roles are specified in the same position
in the parameters attribute. The cardinalities for the roles attribute are specified by the same position
in the cardinalities attribute.

EXAMPLE The definition of the input to a function y = a + bx to convert Celsius to Fahrenheit with roles [a, b, x]
defining the input MultidimensionalObject, and parameters list [32,1.8] with parameterPosition list [1,2]
is an example of a ClassOfMultidimensionalObject.

EXPRESS specification:

*)
   ENTITY ClassOfMultidimensionalObject 
	SUBTYPE OF(ClassOfAbstractObject);
	cardinalities: 		  OPTIONAL LIST [1:?] OF Cardinality;
	optionalElement: 	  OPTIONAL LIST [1:?] OF boolean;
	parameters: 		  OPTIONAL LIST [1:?] OF Thing; 
	parameterPosition :	  OPTIONAL LIST [1:?] OF integer; 
	roles: 			  LIST [1:?] OF RoleAndDomain;
   END_ENTITY;
(*
Attribute definitions:

cardinalities: the list of cardinalities that apply to the roles. If no Cardinality is specified, then there are no constraints on the cardinality. If the Cardinality is specified, then it shall be specified for all roles.

optionalElement: indicates if the element in this list position in a MultidimensionalObject that is a member of this ClassOfMultidimensionalObject is optional (or mandatory).
The value TRUE means it is optional, the value FALSE means it is mandatory.

parameters: the list of parameters associated with the roles

parameterPosition: the list of positions relative to the roles for the list of parameters.
NOTE This attribute is necessary because the LIST datatype does not allow empty positions.
The list of positions provides the mapping to the role positions.

roles: the roles associated with the 'elements' of the classified MultidimensionalObject

MultidimensionalObject

A MultidimensionalObject is an AbstractObject that is an ordered list of Thing. The significance of the MultidimensionalObject is determined by being a member of a ClassOfMultidimensionalObject that indicates the role played by each of its elements.

NOTE The MultidimensionalObject [A,B,C] is different from [B,C,A].

EXAMPLE [32, 1.8, 20] is a MultidimensionalObject that may be specified to be the input parameters for the function y=a+bx to convert 20 Celsius to Fahrenheit.

EXPRESS specification:

*)
   ENTITY MultidimensionalObject
	SUPERTYPE OF (ONEOF(MultidimensionalPropertySpace, 
				MultidimensionalNumber, 
				MultidimensionalProperty, 
				MultidimensionalNumberSpace, 
				MultidimensionalScale))
	SUBTYPE OF(AbstractObject);
	elements	: LIST [1:?] OF Thing;
	position	: OPTIONAL LIST [1:?] OF INTEGER; 
   END_ENTITY;
(*
Attribute definitions:

elements: the list of Thing that constitute the MultidimensionalObject.
The role of each Thing is determined by a classifying ClassOfMultidimensionalObject.

position: the position of the element relative to the list of roles in the classifying ClassOfMultidimensionalObject. The elements shall be listed in ascending order. This attribute is required when some elements are missing. The EXPRESS list data type does not allow empty elements in the list. This attribute, when present, supplies the mapping information. When this attribute has no value, then all elements are present.

Use as a vanilla n-ary relation

Here is a small case study, in which the template 'IndividualHasPropertyWithValue' is derived from a MultidimensionalObject.

@prefix ex: <https://example.org/data/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dm: <http://data.15926.org/dm/> . # the ISO 15926-2 Upper Ontology
@prefix rdl: <http://data.15926.org/rdl/> . # a vocabulary of ISO 15926-4 Reference Data, extensions of /dm and /lci
@prefix tpl: <http://data.15926.org/tpl/> . # a vocabulary of ISO 15926-7/8 Template Specifications that use /dm, /lci. and /rdl
@prefix meta: <http://data.15926.org/meta/> . # meta data

# REQUIRED A TEMPLATE WITH FOUR RoleAndDomain's:
#      tpl:hasPropertyPossessor AND dm:PossibleIndividual 
#      tpl:hasPropertyType AND dm:ClassOfProperty 
#      tpl:valPropertyValue AND xsd:decimal 
#      tpl:hasScale AND dm:Scale 

### DEFINITION OF ROLES

tpl:hasPropertyPossessor
	rdf:type rdf:Property ;
	rdfs:range dm:PossibleIndividual .

tpl:hasPropertyType
	rdf:type rdf:Property ;
	rdfs:range dm:Property .

tpl:hasPropertyValue
	rdf:type rdf:Property ;
	rdfs:range xsd:decimal .

tpl:hasScale
	rdf:type rdf:Property ;
	rdfs:range dm:Scale .

 ### DEFINITION OF RoleAndDomain's

tpl:c02b9de2-f41f-4ecf-a795-448c35c7a44c
	rdf:type dm:RoleAndDomain ;
	rdfs:subClassOf tpl:hasPropertyPossessor, dm:PossibleIndividual .

tpl:1dd8188c-5522-46bc-9d1b-86448d654a4b
	rdf:type dm:RoleAndDomain ;
	rdfs:subClassOf tpl:hasPropertyType, dm:ClassOfProperty .

tpl:ae1fb5b1-3fbb-485c-8efd-5cd06bb77d37
	rdf:type dm:RoleAndDomain ;
	rdfs:subClassOf tpl:valPropertyValue, xsd:decimal .

tpl:fc01a5fc-8694-496c-869c-c53ae6ae7a2c
	rdf:type dm:RoleAndDomain ;
	rdfs:subClassOf tpl:hasScale, dm:Scale .

### INSTANTIATION OF MultidmensionalObject

tpl:e3f8b37b-1200-4634-80e7-1f049172a314
	rdf:type dm:MultidimensionalObject ;
	rdfs:label "MDO for template IndividualHasPropertyWithValue" ;
	dm:element1 tpl:c02b9de2-f41f-4ecf-a795-448c35c7a44c ; # tpl:hasPropertyPossessor, dm:PossibleIndividual 
	dm:element2 tpl:1dd8188c-5522-46bc-9d1b-86448d654a4b ; # tpl:hasPropertyType, dm:ClassOfProperty
	dm:element3 tpl:ae1fb5b1-3fbb-485c-8efd-5cd06bb77d37 ; # tpl:valPropertyValue, xsd:decimal
	dm:element4 tpl:fc01a5fc-8694-496c-869c-c53ae6ae7a2c . # tpl:hasScale, dm:Scale

### REBRANDING THE element's

tpl:hasPropertyPossessor rdf:type rdf:Property ;
    rdfs:subPropertyOf dm:element1 ;
    rdfs:domain  tpl:e3f8b37b-1200-4634-80e7-1f049172a314 ;
    rdfs:range dm:PossibleIndividual .

tpl:hasPropertyType rdf:type rdf:Property ;
    rdfs:subPropertyOf dm:element2 ;
    rdfs:domain  tpl:e3f8b37b-1200-4634-80e7-1f049172a314 ;
    rdfs:range dm:ClassOfProperty .

tpl:hasPropertyValue rdf:type rdf:Property ;
    rdfs:subPropertyOf dm:element3 ;
    rdfs:domain  tpl:e3f8b37b-1200-4634-80e7-1f049172a314 ;
    rdfs:range xsd:decimal  .

tpl:hasScale rdf:type rdf:Property ;
    rdfs:subPropertyOf dm:element4 ;
    rdfs:domain  tpl:e3f8b37b-1200-4634-80e7-1f049172a314 ;
    rdfs:range dm:Scale .

### RESULTING TEMPLATE DEFINITION

tpl:IndividualHasPropertyWithValue
      rdfs:subClassOf tpl:e3f8b37b-1200-4634-80e7-1f049172a314 ;
      tpl:hasPropertyPossessor dm:PossibleIndividual ;
      tpl:hasPropertyType dm:ClassOfProperty ;
      tpl:valPropertyValue xsd:decimal ;
      tpl:hasScale dm:Scale ;
      meta:valEffectiveDate xsd:dateTime .

### EXAMPLE INSTANTIATION - Vessel V-101 has a mass of 30.57 Metric Ton

ex:fcbfda39-4d1a-4047-b4ca-45ab8d44fca4
      rdf:type tpl:IndividualHasPropertyWithValue ;
      tpl:hasPropertyPossessor ex:847931fd-eade-4beb-b07d-a9e889611c19 ; # V-101
      tpl:hasPropertyType rdl:RDS353339 ; # MASS
      tpl:valPropertyValue "30.57"^^xsd:decimal ;
      tpl:hasScale rdl:RDS2229868 ; # METRIC TON
      meta:valEffectiveDate "2024-07-27T10:19:00Z"^^xsd:dateTime .

Use as the basis for ISO 15926-7 Templates

This use case goes a step further than above one, in that the semantics have to be defined in terms of Part 2 entity types and RDL Classes.
In the Template Specifications that is done with a graph and with FOL - First-Order Logic, as a residue of the days that Part 7 was defined in OWL. Templates are, at present, expressed in RDF(S), so there is little, if any, overlap with respect to tools. It is expected that AI will come to the rescue.

.