基本構成

標準の Manufacturing Data Engine(MDE)のデプロイでは、データの取り込みを開始するために必要な構成設定はデフォルトで適用されません。

このガイドでは、MDE の基本的な設定について説明します。たとえば、システムがエンドツーエンドで動作することをテストする場合などです。このガイドでは、3 つのアーキタイプすべてについて、メッセージ クラス、タイプ、パーサーを作成する方法を説明します。

Manufacturing Connect edge(MCe)を使用してデータを取り込む場合は、代わりにデフォルトの構成パッケージをデプロイします。

この構成は、MDE API またはウェブ インターフェースを使用して完了できます。

メッセージ クラス

このセクションでは、MDE で使用可能なメッセージ クラスの例を示します。

numeric のメッセージ クラス

basic-numeric メッセージ クラスの例を次に示します。

REST

POST /configuration/v1/message-classes

{
   "name": "basic-numeric",
   "priority": 2000,
   "expression": "#root.event['value'] instanceof T(Number) && #root.event['timestamp'] != null && #root.event['tagName'] != null"
}

ウェブ インターフェース

メッセージ クラス名: basic-numeric

  1. MDE ウェブ インターフェースで、[メッセージ クラス] をクリックします。
  2. [Add new Message Class] をクリックします。
  3. [Message Class name] に basic-numeric と入力します。
  4. 次の式をコピーして、[] ボックスに貼り付けます。

       #root.event['value'] instanceof T(Number) && #root.event['timestamp'] != null && #root.event['tagName'] != null
    
  5. 優先度を 2000 に変更します。

  6. [作成] をクリックします。

    Basic-numeric MC

discrete のメッセージ クラス

basic-discrete メッセージ クラスの例を次に示します。

REST

POST /configuration/v1/message-classes

   {
      "name": "basic-discrete",
      "priority": 1975,
      "expression": "#root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['timestamp'] != null && #root.event['tagName'] != null"
   }

ウェブ インターフェース

メッセージ クラス名: basic-discrete

  1. MDE ウェブ インターフェースで、[メッセージ クラス] をクリックします。
  2. [Add new Message Class] をクリックします。
  3. [Message Class name] に basic-discrete と入力します。
  4. 次の式をコピーして、[] ボックスに貼り付けます。

       #root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['timestamp'] != null  && #root.event['tagName'] != null
    
  5. 優先度を 1975 に変更します。

  6. [作成] をクリックします。

    Basic-discrete MC

continuous のメッセージ クラス

basic-continuous メッセージ クラスの例を次に示します。

REST

POST /configuration/v1/message-classes

   {
      "name": "basic-continuous",
      "priority": 1950,
      "expression": "#root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['startTimestamp'] != null && #root.event['endTimestamp'] != null && #root.event['tagName'] != null"
   }

ウェブ インターフェース

メッセージ クラス名: basic-continuous

  1. MDE ウェブ インターフェースで、[メッセージ クラス] をクリックします。
  2. [Add new Message Class] をクリックします。
  3. [Message Class name] に basic-continuous と入力します。
  4. 次の式をコピーして、[] ボックスに貼り付けます。

    #root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['startTimestamp'] != null && #root.event['endTimestamp'] != null && #root.event['tagName'] != null
    
  5. 優先度を 1950 に変更します。

  6. [作成] をクリックします。

    Basic-continuous MC

このセクションでは、MDE で使用可能な型について説明します。

numeric の型

basic-numeric タイプの例を次に示します。

REST

POST /configuration/v1/types

{
   "archetype": "NUMERIC_DATA_SERIES",
   "name": "basic-numeric"
}

ウェブ インターフェース

名前: basic-numeric

  1. MDE ウェブ インターフェースで、[タイプ] をクリックします。
  2. [Add new Type] をクリックします。
  3. [Type name] に「basic-numeric」と入力します。
  4. [アーキタイプ] のプルダウンで NUMERIC_DATA_SERIES を選択します。

    Basic-numeric 型

  5. [ストレージ設定] セクションを開きます。

  6. [BigQuery に送信] オプションを切り替えます。

  7. [作成] をクリックします。

discrete の型

basic-discrete タイプの例を次に示します。

REST

POST /configuration/v1/types

{
   "archetype": "DISCRETE_DATA_SERIES",
   "name": "basic-discrete"
}

ウェブ インターフェース

名前: basic-discrete

  1. MDE ウェブ インターフェースで、[タイプ] をクリックします。
  2. [Add new Type] をクリックします。
  3. [Type name] に「basic-discrete」と入力します。
  4. [アーキタイプ] のプルダウンで [DISCRETE_DATA_SERIES] を選択します。

    Basic-discrete 型

  5. [ストレージ設定] セクションを開きます。

  6. [BigQuery に送信] オプションを切り替えます。

  7. [作成] をクリックします。

continuous の型

basic-continuous タイプの例を次に示します。

REST

POST /configuration/v1/types

{
   "archetype": "CONTINUOUS_DATA_SERIES",
   "name": "basic-continuous"
}

ウェブ インターフェース

名前: basic-continuous

  1. MDE ウェブ インターフェースで、[タイプ] をクリックします。
  2. [Add new Type] をクリックします。
  3. [Type name] に「basic-continuous」と入力します。
  4. [アーキタイプ] のプルダウンで [CONTINUOUS_DATA_SERIES] を選択します。

    Basic-continuous 型

  5. [ストレージ設定] セクションを開きます。

  6. [BigQuery に送信] オプションを切り替えます。

  7. [作成] をクリックします。

パーサー

このセクションでは、MDE で使用できるさまざまなパーサーの概要について説明します。パーサーを作成する前に、タイプが完全にプロビジョニングされ、active であることを確認してください。この処理には 3 分ほどかかることがあります。

numeric のパーサー

basic-numeric パーサーの例を次に示します。

REST

POST /configuration/v1/parsers

{
   "name": "basic-numeric-to-basic-numeric",
   "messageClassName": "basic-numeric",
   "typeReference": {
         "name": "basic-numeric",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"timestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    eventTimestamp: input.timestamp;\n}\n\ndef MapData(input) {\n    numeric: input.value;\n}"
}

ウェブ インターフェース

名前: basic-numeric-to-basic-numeric

  1. MDE ウェブ インターフェースで、[パーサー] をクリックします。
  2. [新しいパーサーを追加] をクリックします。
  3. [Parser name] に「basic-numeric-to-basic-numeric」と入力します。
  4. [メッセージ クラス名] のプルダウンで [basic-numeric] を選択します。
  5. 次の Whistle コードをコピーして、[パーサー] ボックスに貼り付けます。

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "timestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        eventTimestamp: input.timestamp;
     }
    
     def MapData(input) {
        numeric: input.value;
     }
    
  6. [Type] のプルダウンで [basic-numeric | version: 1] を選択します。

  7. [作成] をクリックします。

    Basic-numeric パーサー

discrete のパーサー

basic-discrete パーサーの例を次に示します。

REST

POST /configuration/v1/parsers

{
   "name": "basic-discrete-to-basic-discrete",
   "messageClassName": "basic-discrete",
   "typeReference": {
         "name": "basic-discrete",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"timestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    eventTimestamp: input.timestamp;\n}\n\ndef MapData(input) {\n    complex: input.value;\n}\n"
}

ウェブ インターフェース

名前: basic-discrete-to-basic-discrete

  1. MDE ウェブ インターフェースで、[パーサー] をクリックします。
  2. [新しいパーサーを追加] をクリックします。
  3. [Parser name] に「basic-numeric-to-basic-discrete」と入力します。
  4. [メッセージ クラス名] のプルダウンで [basic-discrete] を選択します。
  5. 次の Whistle コードをコピーして、[パーサー] ボックスに貼り付けます。

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "timestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        eventTimestamp: input.timestamp;
     }
    
     def MapData(input) {
        complex: input.value;
     }
    
  6. [Type] のプルダウンで [basic-discrete | version: 1] を選択します。

  7. [作成] をクリックします。

    Basic-discrete パーサー

continuous のパーサー

basic-continuous パーサーの例を次に示します。

REST

POST /configuration/v1/parsers

{
   "name": "basic-continuous-to-basic-continuous",
   "messageClassName": "basic-continuous",
   "typeReference": {
         "name": "basic-continuous",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nduration: $root.duration;\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"startTimestamp\" and $.field != \"endTimestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    continuousTimestamp: {\n        eventTimestampStart: input.startTimestamp;\n        eventTimestampEnd: input.endTimestamp;\n    };\n}\n\ndef MapData(input) {\n    complex: input.value;\n}\n"
}

ウェブ インターフェース

名前: basic-continuous-to-basic-continuous

  1. MDE ウェブ インターフェースで、[パーサー] をクリックします。
  2. [新しいパーサーを追加] をクリックします。
  3. [Parser name] に「basic-numeric-to-basic-continuous」と入力します。
  4. [メッセージ クラス名] のプルダウンで [basic-continuous] を選択します。
  5. 次の Whistle コードをコピーして、[パーサー] ボックスに貼り付けます。

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     duration: $root.duration;
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "startTimestamp" and $.field != "endTimestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        continuousTimestamp: {
           eventTimestampStart: input.startTimestamp;
           eventTimestampEnd: input.endTimestamp;
        };
     }
    
     def MapData(input) {
        complex: input.value;
     }
    
  6. [Type] のプルダウンで [basic-continuous | version: 1] を選択します。

  7. [作成] をクリックします。

    Basic-continuous パーサー