Mapping CFIHOS data model - 2

latest update: 2021-02-16   

Introduction

This topic is to give access to a spreadsheet which, for each CFIHOS data model table, leads you to a mapping to a metamodel representing the applicable declarations and ISO 15926-7 templates.

This topic is a sequel of Mapping CFIHOS data model-1

Details

The spreadsheet starts, on sheet 1, with a representation of each table, like this one for AREA:

TABLE NAME TABLE id ATTRIBUTE ID ATTRIBUTE NAME CLASS & ATTRIBUTE DEFINITION ATTRIBUTE RANGE TABLE NAME
AREA cfihos:00000003     A geographical surface occupied by a Plant.  
AREA   cfihos:00000003.10000001 Area code A code that uniquely identifies the area within the plant  
AREA   cfihos:00000003.10000002 Area name A name describing the location of an area within the plant.  
AREA   cfihos:00000003.10000005 Plant code The plant the area is part of PLANT


Note that the CFIHOS unique code of the attributes is preceded by the code of the table, making the concatenated code unique for the entire data model. This allows us to define each attribute with its domain and range. This is stored in the cfihos: endpoint http://data.15926.org/cfihos/

The arrows on sheet 1 lead to sheet 2, where you will find the RDF version of that table, where we use the AREA table again as an example:

PREDICATE LABEL TABLE ROW UUID  PREDICATE rdfs:range
rdfs:domain LEGEND:  sw:UUID-xxx  sw:primaryKey  sw:[predicate name]
UUID-003 sw:UUID-003 rdfs:subClassOf sw:Area
Area code sw:UUID-003 sw:areaCode003 xsd:string
Area name sw:UUID-003 sw:areaName003 xsd:string
Plant code sw:UUID-003 sw:plantCode003 sw:Plant


In the topic Mapping CFIHOS data model-1  the ins and outs of this conversion have been explained. In the code the primary key of the table will be defined as indicated,

Note to RDF insiders: this is not exactly following the RDF rules, but a practical solution for a complicated RDF solution, which would be an overkill in this case.


The arrows at the righthand side of sheet 2 lead to sheet 3, where a metamodel of the applicable declarations and templates is defined, again for the AREA table:

MAPPING OF CFIHOS AREA TABLE
first block represents the RDF version of the CFIHOS data model V1.4
UUID OF TABLE ROW = DOMAIN PREDICATE RANGE LABEL OF PREDICATE
sw:UUID-003 rdf:type sw:Area  
sw:UUID-003 sw:areaCode003 xsd:string Area code
sw:UUID-003 sw:plantCode003 sw:Plant Plant code
sw:UUID-003 sw:areaName003 xsd:string Area name




IND-wholeLifeIndividualDeclaration Declaration of WholeLifeIndividual tip:CFIHOS-IND-AREA-areaDeclaration
TIP DECLARATION PREDICATES   SCRIPT RANGE
tip:IND-wholeLifeIndividualDeclaration_var_Label rdfs:label replace "Area code"^^xsd:string
tip:IND-wholeLifeIndividualDeclaration_var_EntityType rdf:type fixed dm:SpatialLocation
tip:IND-wholeLifeIndividualDeclaration_var_WorldType rdf:type select lci:NonActualIndividual | dm:ActualIndividual
tip:IND-wholeLifeIndividualDeclaration_var_EssentialType rdf:type fixed rdl:RDS282689
tip:IND-wholeLifeIndividualDeclaration_var_LifecycleActivity meta:hasLifecycleActivity memberOf cfihos:50000121
tip:IND-wholeLifeIndividualDeclaration_var_EffectiveDate meta:valEffectiveDate effDate "valEffectiveDate"^^xsd:dateTime




IND-isLocatedRelativeTo tpl:RelativeLocationOfIndividual tip:CFIHOS-IND-AREA-plantCode
TIP SIGNATURE PREDICATES   SCRIPT RANGE
tip:IND-isLocatedRelativeTo_label [EssentialType] individual [hasLocated] is located [hasRelativeLocationType] [EssentialType] individual [hasLocator] replace "[PLANT AREA] individual  [Area code] is located [INSIDE] [PLANT] individual [Plant code]"@en
tip:IND-isLocatedRelativeTo_var_Label-1 tpl:hasLocated uuidOf "Area code"^^xsd:string
tip:IND-isLocatedRelativeTo_var_Label-2 tpl:hasLocator uuidOf "Plant code"^^xsd:string
tip:IND-isLocatedRelativeTo_var_Label-3 tpl:hasRelativeLocationType fixed rdl:RDS2229920
tip:IND-isLocatedRelativeTo_var_LifecycleActivity meta:hasLifecycleActivity memberOf cfihos:50000121
tip:IND-isLocatedRelativeTo_var_EffectiveDate meta:valEffectiveDate effDate "valEffectiveDate"^^xsd:dateTime




IND-isIdentifiedWithString tpl:ClassifiedIdentificationOfIndividual tip:CFIHOS-IND-AREA-areaName
TIP SIGNATURE PREDICATES   SCRIPT RANGE
tip:IND-isIdentifiedWithString_label [EssentialType] individual [hasIdentified] has an [hasIdentificationType] [valIdentifier] replace "[PLANT AREA] individual [Area code] has an [IDENTIFICATION BY PLANT AREA NAME] [Area name]"@en
tip:IND-isIdentifiedWithString_var_Label-1 tpl:hasIdentified uuidOf "Area code"^^xsd:string
tip:IND-isIdentifiedWithString_var_Value-1 tpl:valIdentifier replace "Area name"^^xsd:string
tip:IND-isIdentifiedWithString_var_Label-2 tpl:hasIdentificationType fixed rdl:RDS2227020
tip:IND-isIdentifiedWithString_var_LifecycleActivity meta:hasLifecycleActivity memberOf cfihos:50000121
tip:IND-isIdentifiedWithString_var_EffectiveDate meta:valEffectiveDate effDate "valEffectiveDate"^^xsd:dateTime

In the top of this spreadsheet is, for easy cross-reference purposes, a repeat of the RDF code on the second sheet. The attribute labels are to be used in the CSV file for this table. For each instance of AREA the values of these three attributes are to be used as input for the "scripts", which are SPARQL scripts. Below is a table that briefly explains the possible scripts:

SCRIPT ACTION
anyUUID assign a new UUID
effDate enter the applicable meta:valEffectiveDate, the default is the system clock
fixed use this exclusively
memberOf the given value shall be a member of the given class
rdlIdOf find and use the RDL identifier that belongs to the given label
replace replace the predicates [red text] with the given predicate value
replace+decide replace + decide [IS | IS NOT] in template label, based on a Boolean value
select select from given options (and then make it 'fixed')
uuidOf find and use the UUID that belongs to the given label
value enter a given Literal of the given type 
dateTimeValue use given date as effective date


When the script actions have been finished the ISO 15926-7 code has been generated.

Assume a CSV file:

AREA Area code Area name Plant code
AREA 14 Utility area 6000
       

That input will generate this code:

# Area '14'
# Declaration - sw:areaCode003
:7286dcc6-c71a-42ff-818e-cb94778dd96d rdf:type dm:SpatialLocation, dm:WholeLifeIndividual, dm:ActualIndividual, rdl:RDS282689  ; # PLANT AREA
    rdfs:label "14" ;
    meta:hasLifecycleActivity cfihos:60001657 ; # plant design
    meta:valEffectiveDate "2019-04-23T00:00:00Z"^^xsd:dateTime .

# sw:plantCode003
:ad77c06c-b6a5-475f-a4e2-76c299378e04  rdf:type  tpl:RelativeLocationOfIndividual ;
    rdfs:label "[PLANT AREA] individual  [14] is located [INSIDE] [PLANT] individual [6000]"@en ;
    tpl:hasLocated  :7286dcc6-c71a-42ff-818e-cb94778dd96d ;
    tpl:hasLocator :b2232870-7950-449a-bc6a-b7f5b14a7c0e ; # the UUID of Plant 6000 (declared earlier)
    tpl:hasRelativeLocationType  rdl:RDS2229920 ; #
INSIDE
    meta:hasLifecycleActivity cfihos:60001657 ; # plant design
    meta:valEffectiveDate "2019-04-23T00:00:00Z"^^xsd:dateTime .
 
# sw:areaName003
:f36a3be5-9c57-471d-95b6-d38a457645a2  rdf:type tpl:ClassifiedIdentificationOfIndividual ;
    rdfs:label "[PLANT AREA] individual [14] has an [IDENTIFICATION BY PLANT AREA NAME] [Utility area]"@en ;
    tpl:hasIdentified  :7286dcc6-c71a-42ff-818e-cb94778dd96dd ;
    tpl:valIdentifier  "Utility area" ;
    tpl:hasIdentificationType  rdl:RDS2227020 ; #
IDENTIFICATION BY PLANT AREA NAME
    meta:hasLifecycleActivity cfihos:60001657 ; # plant design
    meta:valEffectiveDate "2019-04-23T00:00:00Z"^^xsd:dateTime .

that can be converted to triples:

<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/dm/ActualIndividual> .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/dm/SpatialLocation> .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/dm/WholeLifeIndividual> .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/rdl/RDS282689> .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://www.w3.org/2000/01/rdf-schema#label> "14" .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://data.15926.org/meta/hasLifecycleActivity> <http://data.15926.org/cfihos/60001657> .
<http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> <http://data.15926.org/meta/valEffectiveDate> "2019-04-23T00:00:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/tpl/RelativeLocationOfIndividual> .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://www.w3.org/2000/01/rdf-schema#label> "[PLANT AREA] individual  [14] is located [INSIDE] [PLANT] individual [6000]"@en .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://data.15926.org/tpl/hasLocated> <http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96d> .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://data.15926.org/tpl/hasLocator> <http://www.p1234.xyz-corp.com/b2232870-7950-449a-bc6a-b7f5b14a7c0e> .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://data.15926.org/tpl/hasRelativeLocationType> <http://data.15926.org/rdl/RDS2229920> .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://data.15926.org/meta/hasLifecycleActivity> <http://data.15926.org/cfihos/60001657> .
<http://www.p1234.xyz-corp.com/ad77c06c-b6a5-475f-a4e2-76c299378e04> <http://data.15926.org/meta/valEffectiveDate> "2019-04-23T00:00:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/tpl/ClassifiedIdentificationOfIndividual> .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://www.w3.org/2000/01/rdf-schema#label> "[PLANT AREA] individual [14] has an [IDENTIFICATION BY PLANT AREA NAME] [Utility area]"@en .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://data.15926.org/tpl/hasIdentified> <http://www.p1234.xyz-corp.com/7286dcc6-c71a-42ff-818e-cb94778dd96dd> .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://data.15926.org/tpl/valIdentifier> "Utility area" .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://data.15926.org/tpl/hasIdentificationType> <http://data.15926.org/rdl/RDS2227020> .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://data.15926.org/meta/hasLifecycleActivity> <http://data.15926.org/cfihos/60001657> .
<http://www.p1234.xyz-corp.com/f36a3be5-9c57-471d-95b6-d38a457645a2> <http://data.15926.org/meta/valEffectiveDate> "2019-04-23T00:00:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

and stored in a triple store.