Templates - an introduction

latest update: 2017-06--21    

Introduction

In ISO 15926-7 and -8 the concept of template has been defined. This paper gives an introduction in that concept.

We start with a "shallow" explanation and then a bit more in-depth. For a thorough explanation reading of ISO 15926-7 and of ISO 15926-8 is highly recommended. In this topic we may not violate the copyright owned by ISO. But we may discuss template matters nevertheless.

Some basic wisdom

Information is a relationship between two or more objects that are known by the recipient of that information representation.

For example, when you hear that John Doe and Mary Bloggs are married, that is non-information unless you know these people.

So, in computer terms, we must "declare" the objects before we can represent any information about them. See here.

Shallow explanation

Assume that you want to represent the information that Pipe A is connected to Pump B. In the ISO 15926-2 data model we find a Relationship called ConnectionOfIndividual with two attributes called side1 and side2 :

 

Now we want to represent the fact that this connection is a Flanged Connection, so we classify the Relationship with a ClassOfRelationship:

 

This is still a simple little model, with five things, that we can use for all connections (there are two flavors: direct connection, as above, and indirect connections by means of some intermediary material, such as between a nozzle on a pipe or vesel and a pressure transmitter, interconnected by means of tubing).

These models can be extended in all directions, so we need to "package" them in what ISO 15926-7 calls "Templates", in order to enable re-use.

We put it in a small table in which we list the three objects that are the variables and give each of them a role in the represented information:

ClassifiedDirectConnectionOfTwoIndividuals

Role No

Role Name

Role Object Type

1

hasSide1

dm:PossibleIndividual

2

hasSide2

dm:PossibleIndividual

3

hasConnectionType

dm:ClassOfDirectConnection

When we use that template for our example we get:

ClassifiedDirectConnectionOfTwoIndividuals

Role No

Role Name

Role Object Type

1

hasSide1

Pipe A

2

hasSide2

Pump B

3

hasConnectionType

FLANGED CONNECTION

Before we can use Pipe A, Pump B, and "Flanged Connection" we must declare them (once), thereby using the entity types defined in ISO 15926-2:

:12345

   rdf:type dm:FunctionalPhysicalObject ;

   rdfs:label "Pipe A" ;

   meta:valEffectiveDate "2016-09-21T16:51:00Z"^^xsd:dateTime .

:67890

   rdf:type dm:FunctionalPhysicalObject ;

   rdfs:label "Pump B" ;

   meta:valEffectiveDate "2016-09-21T16:51:00Z"^^xsd:dateTime .

rdl:RDS2229203

   rdf:type dm:ClassOfDirectConnection ;

   rdfs:label "FLANGED CONNECTION" ;

   meta:valEffectiveDate "2016-08-16T00:00:00Z"^^xsd:dateTime .

NOTES

  1. Prefixes  :  ,  dm: ,  rdf: ,  rdfs:  ,  tpl:  ,  and  meta: (and others) are local codes for the place where the item is (to be) stored or defined; these are "unfolded" in the "N-triple" format below;
  2. FunctionalPhysicalObject is a specialization of PossibleIndividual, so it is used legally in this template;
  3. That "FLANGED CONNECTION" has already been declared in the RDL (Reference Data Libary);
  4. For insiders: in the template the fourth role is left out for educational reasons, and so has the WholeLifeIndividual been left out of the declarations.

The template instance then is correctly completed as follows:

ClassifiedDirectConnectionOfTwoIndividuals :87654

Role No

Role Name

Role Object Type

1

hasSide1

:12345

2

hasSide2

:67890

3

hasConnectionType

rdl:RDS2229203

This can easily be converted to a format, called N-triple, that is used for storage, a "triple store" :

<http:/xyz-corp.com/12345>   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/dm/FunctionalPhysicalObject> .

<http:/xyz-corp.com/12345>   <http://www.w3.org/2000/01/rdf-schema#label>       "Pipe A" .

<http:/xyz-corp.com/12345>   <http://data.15926.org/meta/valEffectiveDate>         "2016-09-21T16:51:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

 

<http:/xyz-corp.com/67890>   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/dm/FunctionalPhysicalObject> .

<http:/xyz-corp.com/67890>   <http://www.w3.org/2000/01/rdf-schema#label>       "Pump B" .

<http:/xyz-corp.com/67890>   <http://data.15926.org/meta/valEffectiveDate>         "2016-09-21T16:51:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

 

<http:/xyz-corp.com/87654>   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.15926.org/tpl/ClassifiedDirectConnectionOfTwoIndividuals> .

<http:/xyz-corp.com/87654>   <http://data.15926.org/tpl/hasSide1>                      <http:/xyz-corp.com/12345> .

<http:/xyz-corp.com/87654>   <http://data.15926.org/tpl/hasSide2>                      <http:/xyz-corp.com/67890> .

<http:/xyz-corp.com/87654>   <http://data.15926.org/tpl/hasConnectionType>      <http://data.15926.org/rdl/RDS2229203> .

<http:/xyz-corp.com/87654>   <http://data.15926.org/meta/valEffectiveDate>        "2016-09-21T16:51:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

All objects have a URI (http:// address), except for the "Literals" (text strings, dateTimes, etc).

When a declared object or template is no longer valid, e.g.  when Pipe A and Pump B are no longer connected (in this example on the P&ID), the template is made invalid by adding one triple:

<http:/xyz-corp.com/87654>   <http://data.15926.org/meta/valDeprecationDate>   "2017-06-21T14:37:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

All plant and plant component lifecycle information follows the same pattern of declared objects and templates.

Using the standard query language SPARQL all information valid now or at a given date-time can be fetched via the rdfs:label or via other information. For example, if you don't know the label of the pipe, you can ask for the objects that are connected with Pump B. For components use subtags, such as "Pump B IMP".

Each object has an ID that is part of its URI, most objects have a label, sometimes more. Your SSN (Social Security Number) is your ID, your name is your label.

Using templates allows for placing the represented information in a period in time, between the valEffectiveDate and the valDeprecationDate., thus filling your Archive with integrated lifecycle information.


More in-depth explanation

Template types

A template represents a complex n-ary relationship between independent objects. There are four types of template:

Proto-templates

Basically these are representing all ISO 15926-2 entity data types that have one or more attributes. These are listed in ISO 15926-7 Annex D. A typical example of a proto-template is the one for CompositionOfIndividual:

Proto-template

First Role

Second Role

CompositionOfIndividualTemplate

hasPart

hasWhole

PossibleIndividual

PossibleIndividual

This means that the first role of the template is "hasPart" and instances of the first role must be instances of the entity type PossibleIndividual. The second role is "hasWhole" and instances of this role must also be instances of the entity type PossibleIndividual.

In the template language this is represented by:

     CompositionOfIndividualTemplate(y, z) <-> exists u(CompositionOfIndividualTriple(u, y, z))

      CompositionOfIndividualTriple(x, y, z) <-> CompositionOfIndividual(x) & hasPart(x, y) & hasWhole(x, z)

For the full ontology click here.

Templates

A Template has only ISO 15926-2 and or ISO 15926-3 entity data types in the expansion of its template axiom. See here for a typical template expressed in OWL.

Orthogonally to the above two types of template are Lifted and Lowered Templates:

Lifted Templates

Lifted templates represent information in a manner that fully complies with ISO 15926-2. Lifted templates serve as a reference for the exact semantics of the lowered templates.

Lifted templates can be instantiated by applying the First Order Logic axiom, specified in the applicable Template Specification, to the instantiated lowered template. An instance of a lifted template can be used for:

  • providing the full semantics for OWL reasoning (this may be superseded by ISO 15926-12)
  • mapping to another format, for example as defined in ISO 10303-21 (so-called "Part 21 files");
  • validating entity data types of data connected to the template (be it not with OWL tools!);
  • storing and/or exchanging in full lifted format (very verbose).

Lowered Templates

Lowered templates represent information in the form of an n-ary relationship, a collector of n unary relations with independent external things. These things also form the "leafs" of the companion lifted template graph.

NOTE - By convention we mean Lowered Template when we say Template.

Example

If we consider the template ClassOfParticipationDefinition we can show the Lifted and the Lowered Template:

Combined graph

Graph of Lifted Template

Graph of Lowered Template

Example of a Template Signature

For the above (lowered) template ClassOfParticipationDefinition the signature is:

Order

Role Name

Role Object Type

1

hasActivityType

dm:ClassOfActivity

2

hasParticipantType

dm:ClassOfIndividual

3

hasParticipantRole

dm:Role

4

hasDefined dm:ClassOfParticipation

5

hasCardinalityOfActivity

dm:Cardinality

6

hasCardinalityOfParticipant

dm:Cardinality

Template signature of ClassOfParticipationDefinition

Template Language

As we have seen above a template is defined as follows:

"A template is a set comprising of a first-order logic predicates for which a definition is stated as an axiom, a template signature and a template axiom expansion.".

The (reduced) set of symbols used in the template language are:

Operator

Symbol

conjunction

&

equivalence

<->

existential quantification

exists

Example of an Axiom

The definition of an axiom is:  "An axiom is a self-consistent statement about the primitive terms that form the basis for discourse. A first-order theory consists of a set of axioms in a particular first-order signature. The set of axioms is often finite."

Below is the axiom for above template ClassOfParticipationDefinition:

    ClassOfParticipationDefinition(x1, x2, x3, x4, x5, x6) <->
    ClassOfActivity(x1) & 
    ClassOfIndividual(x2) & 
    Role(x3) &
    Cardinality(x5) &
    Cardinality(x6) &
    exists u1 exists u2 exists u3(
          ClassOfActivity(u1) &
          ClassOfTemporalWholePartTemplate(u1, x1) &
          ClassOfIndividual(u2) &
          ClassOfTemporalWholePartTemplate(u2, x2) &
          ParticipatingRoleAndDomain(u3) &
          SpecializationByDomainTemplate(u3, u2) &
          SpecializationByRoleTemplate(u3, x3) & 
          ClassOfParticipationTriple(x4, u3, u1) &
          end1Cardinality(x4, x6) &
          end2Cardinality(x4, x5)) .

Representation and Storage in triple format

The representation of the above mentioned template ClassOfParticipationDefinition in triple format is shown below:

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>

<http://data.posccaesar.org/tpl/ClassOfParticipationDefinition> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>

<http://www.w3.org/2002/07/owl#Thing> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasActivityType>

<http://data.posccaesar.org/rdl/RDS9706787> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasParticipantType>

<http://data.posccaesar.org/rdl/RDS430694> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasParticipantRole>

<http://data.posccaesar.org/rdl/RDS24374382> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasDefined>

<http://data.posccaesar.org/rdl/RDS40405459> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasCardinalityOfActivity>

<http://data.posccaesar.org/rdl/RDS6754984> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/tpl/hasCardinalityOfParticipant>

<http://data.posccaesar.org/rdl/RDS7093093> .

<http://www.p1234.xyz-corp.com/T3759787283FB45028BAB9B5DB2982E9C>

<http://data.posccaesar.org/meta/valEffectiveDate>

"2014-06-22T00:00:00+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

Example of storage of an instance of ClassOfParticipationDefinition in triple format

In this format all information is stored in an ISO 15926-9 (work in progress) compliant "triple store" called "Fašade".

In-depth explanation

The in-depth explanation can only be found in the official ISO standards:

  • ISO 15926-7 - Implementation methods for the integration of distributed systems: Template methodology
  • ISO 15926-8 - Implementation methods for the integration of distributed systems: Web Ontology Language (OWL) implementation