Skip to content

Creating dashboard apps with Semantic Data Interconnect (SDI)

The samples included with this document helps you to use the SDI APIs to quickly create an application that can generate cross-domain schemas, query the data and create a simple dashboard to consume the query data.

Prerequisites

The following prerequisites must be fulfilled to use these samples:

  • You have a REST client to access APIs. For e.g. Postman.
  • Before using the samples, you need to obtain an OAuth bearer access token from MindSphere. Please refer to the self-hosted application MindSphere guideline or contact MindSphere for further details.
  • Register as user in SIOS to access Package for each example.
  • Create the test data using SDI provided REST endpoints using Postman or similar REST client program. All these endpoints are also provided as Postman collection in SIOS. You can modify this as required.
  • Import both the Postman collection from SIOS and the PROD.postman_environment.json file and select PROD as environment.
  • Each example source code has set of instructions that need to be followed. Use “README.md” in the client code to update configuration and environment files for values that need to be updated before the client can work properly. Once the clients and support files are updated with appropriate values, they can be compiled.

Sample applications

Prerequisites to deploy the sample applications

  • Access to MindSphere Launchpad
  • NPM manager installed with NodeJS
  • Download and install Java with JDK and Maven (for crash analytics app only)
  • In order to deploy app on MindSphere Launchpad using Cloud Foundry, the Cloud Foundry set up must already be there on your local system. Please refer to Running Cloud Foundry hosted application or contact MindSphere team in case Cloud Foundry setup is not ready or not working.

The Package-SIOS

The following artifacts are available in SIOS which can be used after logging into SIOS:

  • Source codes of the sample applications (air quality and crash analytics)
  • Sample data
  • Postman collection to use SDI APIs for SDI admin steps (along with sample request & response)

Example 1: Air Quality App

This is a step-by-step guide to leverage SDI services to create a simple air quality index dashboard that shows comparison of air quality across North America. The sample data used in this application is collected from epa.gov and uploaded in SIOS along with Reference app sample code.

To deploy this app, make sure that the prerequisites are fulfilled.

Procedure

  1. Register Data Sources: Create two data registries for monitoring site location and hourly air quality data for your sample application. For more information refer SDI Data Management APIs.
    a. Use the following endpoint to create the hourly air quality data registry so that the hourly air quality data can be uploaded.
1
  POST /dataRegistries

Provide the following values as JSON request while using above endpoint:

1
2
3
4
5
6
  {
    "dataTag": "aqi",
    "filePattern": "hourlydata_[0-9]+.csv",
    "fileUploadStrategy": "replace",
    "sourceName": "airnow"
  }
b. Use the following endpoint to create the monitoring site location data registry.
1
  POST /dataRegistries
Provide the following values as JSON request while using above endpoint:

1
2
3
4
5
6
  {
    "dataTag": "monitoringsites",
    "filePattern": "monitoring_site_locations.csv",
    "fileUploadStrategy": "replace",
    "sourceName": "airnow"
  }
2. Upload Files: Upload the sample data files as provided in sample folder for the created data registry. The /dataUpload endpoint returns filePath. Use this filePath to start data ingest.
3. Data Ingestion: Start data ingest with retrieved filePath. The /ingestJobs endpoint returns jobId that can be used to query or understand the current status of the uploaded file. SDI creates a schema after the job is completed.
This sample application uses CSV files only. If you want to create another application with XML file, then provide a proper defaultRootTag while creating a data registry. For more information on how to work with xml format refer SDI Data Management APIs.
a. Upload monitoring site sample data file using the following endpoint:
1
  POST /dataUpload
b. Start data ingest providing the below request json to POST /ingestJobs endpoint:
1
2
3
4
5
  {
    "dataTag": "monitoringsites",
    "filePath": "monitoring_site_locations.csv",
    "sourceName": "airnow"
  }
c. Repeat the above step and upload hourly sample data file using same URL as above. This endpoint takes the below request json:
1
2
3
4
5
  {
    "dataTag": "aqi",
    "filePath": "hourlydata_001.csv",
    "sourceName": "airnow"
  }

For each ingested file, SDI generates the schema that user can query upon. Use the query service endpoints to create query once files are uploaded successfully and schema is generated. User can verify the status of schema using /ingestJobStatus/{jobId}. This endpoint takes the jobid as request, this jobid is same as returned by above endpoints. Verify that job message in response JSON is “Finished”.

Note

The steps 2 and 3 are applicable if you have your own data lake. If you have data in MindSphere Integrated Data Lake (IDL), you need to follow steps as in SDI Data Management APIs for data ingest. Add link to IDL doc.

4.Query creation: Create a JSON query to be used in Data Query Service. You can choose to create query based on physical schema or create a Semantic model and create business query based on this Semantic model. You can extract out the physical schema by using the following endpoint:

1
  POST /searchSchemas

The json request for this endpoint is as below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  {
    "schemas": [
    {
        "dataTag": "aqi",
        "sourceName": "airnow"
      },
      {
        "dataTag": "monitoringsites",
        "sourceName": "airnow"
      }
    ]
  }

Once collections are created by SDI, you can either generate the Semantic model or create query using extracted physical schema.

Create a physical query

You can create a query by using POST /queries endpoint. refer to the How to write SDI queries document to understand the query format. For example, this sample application selects site, particle pollution parameter, air quality index value, longitude and latitude from two schemas generated above. This data is selected based on common aqsid where particle pollution parameter is PM2.5.

Query Request JSON

This query request will return the queryid. Store the queryid response and use this queryid as an input to sample application. Optionally, you can verify this queryid result by calling GET /queries/{id} endpoint. Here is partial sample response executing above generated queryid.

Request
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
              {
  "name": "AirQualityQuery",
  "desc": "Query on the physical schema for air data quality",
  "statement": {
    "from": [
      "\"airnow_aqi\"",
      "\"airnow_monitoringsites\""
    ],
    "joins": [
      {
        "joinType": "INNER",
        "relationship": [
          {
            "betweenSchemas": [
              "\"airnow_aqi\"",
              "\"airnow_monitoringsites\""
            ],
            "joinCondition": {
              "onColumns": [
                {
                  "columns": [
                    "\"airnow_aqi\".\"aqsid\"",
                    "\"airnow_monitoringsites\".\"aqsid\""
                  ],
                  "operator": "="
                }
              ]
            }
          }
        ]
      }
    ],
    "selectAttrs": [
      "\"airnow_aqi\".\"sitename\"",
      "\"airnow_aqi\".\"parametername\"",
      "\"airnow_aqi\".\"value\"",
      "\"airnow_monitoringsites\".\"latitude\"",
      "\"airnow_monitoringsites\".\"longitude\""
    ],
    "whereClause": {
      "operator": "and",
      "expressions":[
          {
            "operator":"=",
            "columns":[
                "\"airnow_aqi\".\"parametername\""
            ],
            "value" : "'PM2.5'"
          },
      {
            "operator":"=",
            "columns":[
                "\"airnow_aqi\".\"parametername\"",
                "\"airnow_monitoringsites\".\"parametername\""
            ]
          }
          ]
        }
      }
    }

Query Response JSON

Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    {
      "status": "current",
      "timestamp": "2019-10-18T07:01:01.354Z",
      "data": [
          {
              "\"airnow_aqi\".\"sitename\"": "Mount Pearl",
              "\"airnow_aqi\".\"parametername\"": "PM2.5",
              "\"airnow_aqi\".\"value\"": 3.0,
              "\"airnow_monitoringsites\".\"latitude\"": 47.505,
              "\"airnow_monitoringsites\".\"longitude\"": -52.7947
          },
          {
              "\"airnow_aqi\".\"sitename\"": "Mount Pearl",
              "\"airnow_aqi\".\"parametername\"": "PM2.5",
              "\"airnow_aqi\".\"value\"": 29.0,
              "\"airnow_monitoringsites\".\"latitude\"": 47.505,
              "\"airnow_monitoringsites\".\"longitude\"": -52.7947
          },
          {
              "\"airnow_aqi\".\"sitename\"": "MacPherson Avenue - ",
              "\"airnow_aqi\".\"parametername\"": "PM2.5",
              "\"airnow_aqi\".\"value\"": 1.0,
              "\"airnow_monitoringsites\".\"latitude\"": 48.95224,
              "\"airnow_monitoringsites\".\"longitude\"": -57.92207
          }
    ]
  }

Create a business/semantic based query

  1. After physical schema is extracted, create a Semantic model from physical schema using Developer Usage doc for Semantic Modelling Service.

    a. Infer the schema based on system generated schemas. Use POST /inferOntology endpoint and provide two schemas to infer. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  {
    "schemas": [
    {
      "schemaName": "airnow_monitoringsites"
      },
      {
        "schemaName": "airnow_aqi"
        }
        ]
        }

b. Modify the business facade response to match business need. Here is sample for the schemas used above:

Infer Ontology Response
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
          {
  "classes": [
      {
          "name": "airnow_monitoringsites",
          "description": ""
      },
      {
          "name": "airnow_aqi",
          "description": ""
      }
  ],
  "classProperties": [
      {
          "name": "latitude",
          "description": "",
          "datatype": "DOUBLE",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "epareg",
          "description": "",
          "datatype": "SERIAL",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "sitecode",
          "description": "",
          "datatype": "LONG",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "agencyid",
          "description": "",
          "datatype": "SERIAL",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "parametername",
          "description": "",
          "datatype": "us_state",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "gmtoffset",
          "description": "",
          "datatype": "LONG",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "longitude",
          "description": "",
          "datatype": "DOUBLE",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "elevation",
          "description": "",
          "datatype": "DOUBLE",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "status",
          "description": "",
          "datatype": "SERIAL",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "aqsid",
          "description": "",
          "datatype": "LONG",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "sitename",
          "description": "",
          "datatype": "SERIAL",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "agencyname",
          "description": "",
          "datatype": "String",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "countrycode",
          "description": "",
          "datatype": "us_state",
          "parentClass": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "parametername",
          "description": "",
          "datatype": "us_state",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "gmtoffset",
          "description": "",
          "datatype": "LONG",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "date",
          "description": "",
          "datatype": "DATE_EU",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "reportingunits",
          "description": "",
          "datatype": "us_state",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "aqsid",
          "description": "",
          "datatype": "LONG",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "sitename",
          "description": "",
          "datatype": "SERIAL",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "time",
          "description": "",
          "datatype": "String",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "value",
          "description": "",
          "datatype": "DOUBLE",
          "parentClass": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "datasource",
          "description": "",
          "datatype": "String",
          "parentClass": {
              "name": "airnow_aqi"
          }
      }
  ],
  "schemas": [
      {
          "name": "airnow_monitoringsites",
          "description": ""
      },
      {
          "name": "airnow_aqi",
          "description": ""
      }
  ],
  "schemaProperties": [
      {
          "name": "latitude",
          "description": "",
          "datatype": "DOUBLE",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "epareg",
          "description": "",
          "datatype": "SERIAL",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "sitecode",
          "description": "",
          "datatype": "LONG",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "agencyid",
          "description": "",
          "datatype": "SERIAL",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "parametername",
          "description": "",
          "datatype": "us_state",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "gmtoffset",
          "description": "",
          "datatype": "LONG",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "longitude",
          "description": "",
          "datatype": "DOUBLE",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "elevation",
          "description": "",
          "datatype": "DOUBLE",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "status",
          "description": "",
          "datatype": "SERIAL",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "aqsid",
          "description": "",
          "datatype": "LONG",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "sitename",
          "description": "",
          "datatype": "SERIAL",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "agencyname",
          "description": "",
          "datatype": "String",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "countrycode",
          "description": "",
          "datatype": "us_state",
          "parentSchema": {
              "name": "airnow_monitoringsites"
          }
      },
      {
          "name": "parametername",
          "description": "",
          "datatype": "us_state",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "gmtoffset",
          "description": "",
          "datatype": "LONG",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "date",
          "description": "",
          "datatype": "DATE_EU",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "reportingunits",
          "description": "",
          "datatype": "us_state",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "aqsid",
          "description": "",
          "datatype": "LONG",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "sitename",
          "description": "",
          "datatype": "SERIAL",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "time",
          "description": "",
          "datatype": "String",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "value",
          "description": "",
          "datatype": "DOUBLE",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      },
      {
          "name": "datasource",
          "description": "",
          "datatype": "String",
          "parentSchema": {
              "name": "airnow_aqi"
          }
      }
  ],
  "mappings": [
      {
          "name": "defaultMapping6bd3198d-ee97-4707-b84b-6fc29b8267d7",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "latitude",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "latitude",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMappingbd390cf4-d4b4-42f9-8bf2-e4d049cae217",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "epareg",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "epareg",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMappingdd22fa32-b154-4cc1-a391-0f28ab61b111",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "sitecode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "sitecode",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping92d0b99a-874b-4aee-b33d-ae309e66ab3c",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "agencyid",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "agencyid",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping5c0a5f8d-b890-423b-b662-54074c1b91f7",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "parametername",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping2d05f01b-1fe0-4daf-9326-6f74fd48baf3",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "gmtoffset",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMappingc972d03b-d055-4094-a6fb-64e42da1d49a",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "longitude",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "longitude",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping8a3a65ee-4843-4f0b-a125-5a6c7aa91222",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "elevation",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "elevation",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping396715dc-567d-4fc2-a38e-4e3239df705c",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "status",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "status",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping201df28f-f74e-4ef7-a107-e5f852f7884b",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "aqsid",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMappinga7f888de-4e52-4c45-9969-ed4c4370cd98",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "sitename",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "sitename",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMappinge9669c7d-1409-4f06-933a-713fe9381047",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "agencyname",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "agencyname",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping00b64b9f-19ac-4d95-ad65-ff84a7915d97",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "countrycode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "schemaProperties": [
              {
                  "name": "countrycode",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_monitoringsites"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping085747cf-1859-47c3-a853-339e6e0763db",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "parametername",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping8959ed8d-de19-4100-9c48-f83181f78ff6",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "gmtoffset",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping552c77a6-a146-48e5-8a03-a0be702ec9bf",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "date",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "date",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMappingb5f8fc0b-9363-4c04-818b-6efe0270d693",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "reportingunits",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "reportingunits",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMappingddb0c56a-7b98-4d2d-95b2-9dbbd6079eb3",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "aqsid",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping59b96d0c-db14-45f1-b626-e2ca72515b7b",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "sitename",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "sitename",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMappinga3c732f7-a50e-4035-aa0c-b1190a1ff941",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "time",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "time",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMapping690bd1e1-6fb0-46a3-92b2-5a8922b7c7e2",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "value",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "value",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      },
      {
          "name": "defaultMappinged3b019d-048b-414a-8655-5801437c6d22",
          "description": "",
          "functionalMapping": false,
          "keyMapping": true,
          "classProperty": {
              "name": "datasource",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          },
          "schemaProperties": [
              {
                  "name": "datasource",
                  "order": "",
                  "parentSchema": {
                      "name": "airnow_aqi"
                  }
              }
          ]
      }
  ],
  "propertyRelations": [
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "latitude",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "value",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "longitude",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "value",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "elevation",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "value",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "exact default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "reportingunits",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "countrycode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "parametername",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "countrycode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "reportingunits",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "sitecode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "sitecode",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "exact default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "partial default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "gmtoffset",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "exact default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "aqsid",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      },
      {
          "name": "exact default",
          "description": "",
          "relationType": "one-to-one",
          "startClassProperty": {
              "name": "sitename",
              "parentClass": {
                  "name": "airnow_monitoringsites"
              }
          },
          "endClassProperty": {
              "name": "sitename",
              "parentClass": {
                  "name": "airnow_aqi"
              }
          }
      }
  ]
}

The sample response received from infer ontology will be used as request to create ontology.

c. Use POST /ontologyJobs to create ontology by providing above Ontology Response JSON as input.

2.Create business query by referring to the How to create SDI queries. This should return the queryid similar to Physical schema based query. Provide the queryid in sample application.
Here is sample business query created from two schemas extracted above with default class and property node names.

  • Business Query Request: Sample business query request JSON created using POST /queries.
Business Query Request
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
           {
    "isBusinessQuery": true,
    "name": "Air Quality Query for semantic",
    "spacename": "infer airnow",
    "ontologyId": "82F65989D810C9A6CA04C1487A502F82",
    "statement": {
      "from": [
        "\"airnow_monitoringsites\"", 
        "\"airnow_aqi\""
      ],
    "joins": [
      {
        "joinType": "INNER",
        "relationship": [
          {
            "betweenSchemas": [
              "\"airnow_monitoringsites\"", 
              "\"airnow_aqi\""
            ],
            "joinCondition": {              
              "onColumns": [
                {
                  "columns": [
                    "\"airnow_monitoringsites\".\"sitename\"", 
                    "\"airnow_aqi\".\"sitename\""
                  ],
                  "operator": "="
                }
              ]
            }
          }
        ]
      }
    ],
    "selectAttrs": [
      "\"airnow_monitoringsites\".\"latitude\"", 
      "\"airnow_monitoringsites\".\"epareg\"", 
      "\"airnow_monitoringsites\".\"sitecode\"", 
      "\"airnow_aqi\".\"sitename\"", 
      "\"airnow_aqi\".\"datasource\""
    ],
    "whereClause": {      
      "operator": "or",
      "expressions":[
          {
            "operator":"=",
            "columns":[
                "\"airnow_monitoringsites\".\"sitecode\""
            ],
            "value" : "102"
          },
      {
            "operator":"=",
            "columns":[
                "\"airnow_monitoringsites\".\"aqsid\"", 
                "\"airnow_aqi\".\"aqsid\""
            ]
          }
        ]
      }
    }
  }
  • Business Query Response JSON: Sample response from business query using GET /queries/{id}/results – replace id with the queryid from the response.
Business Query Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    {
        "status": "current",
        "timestamp": "2019-10-18T07:24:22.805Z",
        "data": [
        {
          "\"airnow_monitoringsites\".\"latitude\"": 47.6528,
          "\"airnow_monitoringsites\".\"epareg\"": "CA",
          "\"airnow_monitoringsites\".\"sitecode\"": "0102",
          "\"airnow_aqi\".\"sitename\"": "St. John's",
          "\"airnow_aqi\".\"datasource\"": "Newfoundland & Labrador DEC"
        },
        {
          "\"airnow_monitoringsites\".\"latitude\"": 47.6528,
          "\"airnow_monitoringsites\".\"epareg\"": "CA",
          "\"airnow_monitoringsites\".\"sitecode\"": "0102",
          "\"airnow_aqi\".\"sitename\"": "St. John's",
          "\"airnow_aqi\".\"datasource\"": "Newfoundland & Labrador DEC"
        },
        {
          "\"airnow_monitoringsites\".\"latitude\"": 46.4425,
          "\"airnow_monitoringsites\".\"epareg\"": "CA",
          "\"airnow_monitoringsites\".\"sitecode\"": "2001",
          "\"airnow_aqi\".\"sitename\"": "Charette",
          "\"airnow_aqi\".\"datasource\"": "Meteorological Service of Canada"
          }
        ]
      }

3.Use the queryid from the query created from the above steps.

Downloading the sample code

To download the sample code, refer the The Package-SIOS section. This sample code is in zip format. Follow the below steps below to proceed further:

  • Unzip the sample code downloaded to your local directory.

For example: D:\workdir\sdi-aqi-app, henceforth known as WORKING_DIR.

Editing and building code

  1. In the manifest.yml file in WORKING_DIR, do the following changes:
    • Update tenant name in route
    • Update the QUERY_ID with queryid generated in earlier steps
    • Update the MDSP_GATEWAY_URL with MindSphere gateway url https://gateway.eu1.mindsphere.io
    • Update the QUERY_SERVICE_PATH with SDI data query service path /api/sdi/v3/queries/
  2. Open the command line shell and browse to WORKING_DIR.
  3. Run npm install command.
  4. Verify that build is successful.

The project is now ready to be deployed on Cloud Foundry.

Deploying the sample code

After the Cloud Foundry set up is complete, follow the below steps to proceed with the front end deployment on Cloud Foundry:

Verify Cloud Foundry workspace access

  1. Access https://login.cf.eu1.mindsphere.io/passcode, in the browser and login with webkey. Copy the generated PASSCODE.
  2. Open the command line shell and execute the following command:
    cf login -a https://api.cf.eu1.mindsphere.io --sso-passcode <PASSCODE>

Use the copied PASSCODE from the previous step.

Push the code to Cloud Foundry

  1. Navigate to WORKING_DIR.
  2. Run cf push. This will push the code to Cloud Foundry.
  3. Verify that push is successful.
  4. Copy the Cloud Foundry URL given in the route. This URL will be used in the App setup in Developer Cockpit.

Register Cloud Foundry App on MindSphere

Creating an Application

  1. Log into MindSphere Launchpad and access Developer Cockpit.
  2. Click "Create new application" and enter the "Display Name" and "Description" of the app. Create app
  3. In the Component textbox, enter the value as “air-quality-app”.
  4. Paste the Route URL copied during push operation into the Direct URL textbox.
  5. In the "Components" section, add endpoint for component by clicking “+” icon beside route text box.
  6. In add new endpoint popup, enter “/**” in path text box and click "Save".
  7. Add Icon, if necessary and click Save.

The application will be created.

Adding Scope

  1. In the “Authorization Management” tab, search for the newly created app and click on it.
  2. Click “Add Scope” and enter “user” in the textbox.
  3. Click the “User” checkbox and click “Save”.
  4. Click on “Add Scope” again and enter “admin” in the textbox.
  5. Click on the “Admin” checkbox and click “Save”.

Register an application

  1. Navigate back to Dashboard and choose the newly created app.
  2. Click “Register”. If an access role warning appears, it can be ignored.
  3. Confirm Registration.

Adding Roles

Note

Only the Admin has access to add "Roles".

  1. In the MindSphere Launchpad, click “Settings” and select “User”.
  2. Select your name from the list of users.
  3. Click on the Edit icon. This will open a popup with your user details along with Unassigned and Assigned Roles.
  4. The Admin and User role should be appearing on the unassigned section.
  5. Move the admin and user role to Assigned Roles section. Now, navigate back to MindSphere Launchpad and you should be able to see the Starter Application Tile on the Launchpad. Click on that tile to launch your application. It might take some time for it to load when you register it for the very first time.

Example 2: Crash Analytics App

This is a step-by-step guide to leverage SDI services to create a simple crash analytics dashboard. This reference app is an example where design data is compared with operational data. Operational data is obtained from public NHTSA data source, which is MindSphere provided data retrieved from devices connected to MindSphere. Another source of data is design data from PLM system, for which data is obtained from Siemens Teamcenter product.

To deploy this app, make sure that the prerequisites are fulfilled.

Procedure

  1. Register Custom Data Type: Create a data type for vin number the following endpoint:
1
    POST /dataTypes

Below is the request json:

1
2
3
4
5
6
    {
      "name": "VIN_NUMBER",
      "patterns": [
        "[A-HJ-NPR-Z0-9]{12}"
      ]
    }

Note

Step 1 is optional in SDI. This steps enables customers to provide custom data types during registration. SDI will identify schema attributes with custom data types provided and provide it as additional data type in POST /searchSchemas endpoint.

2.Register Data Sources: Create seven data registries for airbag, state, vehicle incidents, vehicle make, vehicle model, product plm xml and realized product for your sample application. For more information on creating data registries refer SDI Data Management.

Use POST /dataRegistries endpoint to create each data registry so that you can upload the respective data. SDI then extracts schema for the same.

a. For airbag data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
          {
        "dataTag": "airbag",
        "filePattern": "[a-z]+.csv",
        "fileUploadStrategy": "replace",
        "sourceName": "nhtsa"
  }

b. For state data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
          {
      "dataTag": "state",
      "filePattern": "[a-z]+.csv",
      "fileUploadStrategy": "replace",
      "sourceName": "nhtsa"
  }

c. For vehicle incidents data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
        {
      "dataTag": "vehicle",
      "filePattern": "[a-zA-Z0-9]+.csv",
      "fileUploadStrategy": "append",
      "sourceName": "nhtsa"
}

d. For vehicle make data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
          {
      "dataTag": "make",
      "filePattern": "[a-z]+.csv",
      "fileUploadStrategy": "replace",
      "sourceName": "nhtsa"
  }

e. For vehicle model data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
          {
      "dataTag": "model",
      "filePattern": "[a-z]+.csv",
      "fileUploadStrategy": "replace",
      "sourceName": "nhtsa"
  }

f. For realized product data registry, provide the below values as JSON request while using the POST /dataRegistries endpoint.

Request
1
2
3
4
5
6
7
        {
    "dataTag": "realizedproduct",
    "filePattern": "[a-zA-Z0-9]+.xml",
    "fileUploadStrategy": "append",
    "defaultRootTag":"RealisedProductRevision",
    "sourceName": "teamcenter"
}

3.Upload Files: Upload the sample data files as provided in sample folder for data registry created above. /dataUpload returns filePath and use this filePath to start data Ingest.
4.Data Ingestion: Start data ingest with the retrieved filePath. The endpoint /ingestJobs returns jobId that can be used to query or understand the current state of the uploaded file. SDI creates a schema after the job is completed.
This sample application uses CSV files only. If you want to create another application with XML file, then provide a proper defaultRootTag while creating a data registry.
For more information on how to work with xml format refer SDI Data Management APIs.

a. Upload vehicle model sample data file using POST /dataUpload endpoint.
b. Start data ingest providing this request json to POST /ingestJobs endpoint:

1
2
3
4
5
      {
        "dataTag": "model",
        "filePath": "vehiclemodel.csv",
        "sourceName": "nhtsa"
      }
c. Repeat steps a and b for vehicle make sample data file using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
    {
      "dataTag": "make",
      "filePath": "vehiclemake.csv",
      "sourceName": "nhtsa"
    }
d. Repeat steps a and b for realized product sample data file using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
    {
      "dataTag": "realizedproduct",
      "filePath": "realizedproductJTJHA31U2400Lexus.xml",
      "sourceName": "teamcenter"
    }
e. Repeat steps a and b for vehicle incidents sample data file for 2015 year using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
    {
      "dataTag": "vehicle",
      "filePath": "nhtsa2015.csv",
      "sourceName": "nhtsa"
    }
f. Repeat steps a and b for vehicle incidents sample data file for 2017 year using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
  {
    "dataTag": "vehicle",
    "filePath": "nhtsa2017.csv",
    "sourceName": "nhtsa"
  }
g. Repeat steps a and b for airbag sample data file using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
    {
      "dataTag": "airbag",
      "filePath": "airbag.csv",
      "sourceName": "nhtsa"
    }
h. Repeat steps a and b for state sample data file using same URL, and /ingestJobs endpoint takes below request json:
1
2
3
4
5
  {
    "dataTag": "state",
    "filePath": "state.csv",
    "sourceName": "nhtsa"
  }

Note

The steps 3 and 4 are applicable if you have your own data lake. If you have data in MindSphere Integrated Data Lake (IDL), you need to follow steps as in SDI Data Management APIs for data ingest.

5.Query creation: Create a JSON query to be used in Data Query Service . The user can choose to create query based on physical schema or create a Semantic model and create business query based on this Semantic model. First step towards creating Semantic model or query is to understand the physical schema generated by SDI, you can extract out the physical schema by using POST /searchSchemas endpoint. This endpoint takes below json as request:

Request
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
          {
    "schemas": [
    {
        "dataTag": "airbag",
        "sourceName": "nhtsa"
      },
      {
        "dataTag": "state",
        "sourceName": "nhtsa"
      },
      {
        "dataTag": "vehicle",
        "sourceName": "nhtsa"
      },
      {
        "dataTag": "make",
        "sourceName": "nhtsa"
      },
      {
        "dataTag": "model",
        "sourceName": "nhtsa"
      },
      {
        "dataTag": "realizedproduct",
        "sourceName": "teamcenter"
      }
    ]
  }

After collections are created by SDI service, you can either generate the Semantic model or create query using extracted physical schema.

  • Physical query creation – Deployed Combination 2015: Create a query to by calling POST /queries endpoint. For example, this sample application selects attributes from five schemas generated above.
Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    {
      "name": "Deployed Combination 2015",
            "isBusinessQuery": false,
            "statement":
            {

                "from": [
                  "\"nhtsa_airbag\"",
                    "\"nhtsa_state\"",
                    "\"nhtsa_vehicle\"",
                    "\"nhtsa_model\"",
                    "\"nhtsa_make\""
                    ],
                "selectAttrs": [
                    "\"nhtsa_airbag\".\"def\"",
                    "\"nhtsa_state\".\"def\"",
                    "\"nhtsa_vehicle\".\"vin\"",
                    "\"nhtsa_vehicle\".\"caseyear\"",
                    "\"nhtsa_make\".\"def\"",
                    "\"nhtsa_model\".\"def\""

                ],
                "joins":[ {
                    "joinType": "INNER",
                    "relationship": [
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_airbag\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"airbag\"",
                                            "\"nhtsa_airbag\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_state\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"regstate\"",
                                            "\"nhtsa_state\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_make\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"make\"",
                                            "\"nhtsa_make\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_model\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"model\"",
                                            "\"nhtsa_model\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        }

                    ]
                }],
                "whereClause": {
            "operator": "and",
            "expressions": [
                {
                "operator": "=",
                "columns": [
                "nhtsa_airbag.def"
                ],
                "value": "'Deployed- Combination'"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.caseyear"
                ],
                "value": "2015"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.pnumber"
                ],
                "value": "1"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_make.id",
                "nhtsa_model.makeid"
                ]
              }
            ]
                }
        }
    }

This query request will return the queryid. Capture the queryid response and use this queryid as an input to sample application. Optionally, you can verify this queryid result by using GET /queries/{id} endpoint.

  • Physical query creation - Deployed Combination 2015 and 2017

Create a query to by using POST /queries endpoint. For example, this sample application selects attributes from five schemas generated above.

Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    {
            "name": "Deployed- Combination 2015 and 2017",
            "desc": "Deployed- Combination 2015 and 2017",
            "isBusinessQuery": false,

            "statement": {
                "from": [
                  "\"nhtsa_airbag\"",
                    "\"nhtsa_state\"",
                    "\"nhtsa_vehicle\"",
                    "\"nhtsa_model\"",
                    "\"nhtsa_make\""
                    ],
                "selectAttrs": [
                    "\"nhtsa_airbag\".\"def\"",
                    "\"nhtsa_state\".\"def\"",
                    "\"nhtsa_vehicle\".\"vin\"",
                    "\"nhtsa_vehicle\".\"caseyear\"",
                    "\"nhtsa_make\".\"def\"",
                    "\"nhtsa_model\".\"def\""

                ],
                "joins": [ {
                    "joinType": "INNER",
                    "relationship": [
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_airbag\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"airbag\"",
                                            "\"nhtsa_airbag\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_state\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"regstate\"",
                                            "\"nhtsa_state\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_make\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"make\"",
                                            "\"nhtsa_make\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_model\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"model\"",
                                            "\"nhtsa_model\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        }

                    ]
                }],
                "whereClause": {
            "operator": "and",
            "expressions": [
                {
                "operator": "=",
                "columns": [
                "nhtsa_airbag.def"
                ],
                "value": "'Deployed- Combination'"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.pnumber"
                ],
                "value": "1"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_make.id",
                "nhtsa_model.makeid"
                ]
              }
            ]
                }
            }
    }
  • Physical query creation – Deployed Side 2015

Create a query by using POST /queries endpoint. For example, this sample application selects attributes from five schemas generated above.

Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    {
            "name": "Deployed: Side (Door, Seatback) 2015",
            "description": "Deployed: Side (Door, Seatback) 2015",
            "isBusinessQuery": false,
            "statement": {
                "from": [
                  "\"nhtsa_airbag\"",
                    "\"nhtsa_state\"",
                    "\"nhtsa_vehicle\"",
                    "\"nhtsa_model\"",
                    "\"nhtsa_make\""
                    ],
                "selectAttrs": [
                    "\"nhtsa_airbag\".\"def\"",
                    "\"nhtsa_state\".\"def\"",
                    "\"nhtsa_vehicle\".\"vin\"",
                    "\"nhtsa_vehicle\".\"caseyear\"",
                    "\"nhtsa_make\".\"def\"",
                    "\"nhtsa_model\".\"def\""

                ],
                "joins": [{
                    "joinType": "INNER",
                    "relationship": [
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_airbag\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"airbag\"",
                                            "\"nhtsa_airbag\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_state\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"regstate\"",
                                            "\"nhtsa_state\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_make\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"make\"",
                                            "\"nhtsa_make\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "betweenSchemas": [
                                "\"nhtsa_vehicle\"",
                                "\"nhtsa_model\""
                            ],
                            "joinCondition": {
                                "onColumns": [
                                    {
                                        "operator": "=",
                                        "columns": [
                                            "\"nhtsa_vehicle\".\"model\"",
                                            "\"nhtsa_model\".\"id\""
                                        ]
                                    }
                                ]
                            }
                        }

                    ]
                }],
                "whereClause": {
            "operator": "and",
            "expressions": [
                {
                "operator": "=",
                "columns": [
                "nhtsa_airbag.def"
                ],
                "value": "'Deployed- Side (door'"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.caseyear"
                ],
                "value": "2015"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.pnumber"
                ],
                "value": "1"
              },
              {
                "operator": "=",
                "columns": [
                "nhtsa_make.id",
                "nhtsa_model.makeid"
                ]
              }
            ]
                }
            }
    }
  • Physical query creation – Deployed Side 2015 and 2017

Create a query to by calling POST /queries endpoint. For example, this sample application selects attributes from five schemas generated above.

Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
    {
          "name": "Deployed: Side (Door, Seatback) 2015 and 2017 ",
          "desc": "Deployed: Side (Door, Seatback) 2015 and 2017 ",
          "isBusinessQuery": false,
          "statement": {
              "from": [
                "\"nhtsa_airbag\"",
                  "\"nhtsa_state\"",
                  "\"nhtsa_vehicle\"",
                  "\"nhtsa_model\"",
                  "\"nhtsa_make\""
                  ],
              "selectAttrs": [
                  "\"nhtsa_airbag\".\"def\"",
                  "\"nhtsa_state\".\"def\"",
                  "\"nhtsa_vehicle\".\"vin\"",
                  "\"nhtsa_vehicle\".\"caseyear\"",
                  "\"nhtsa_make\".\"def\"",
                  "\"nhtsa_model\".\"def\""

              ],
              "joins": [{
                  "joinType": "INNER",
                  "relationship": [
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_airbag\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"airbag\"",
                                          "\"nhtsa_airbag\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_state\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"regstate\"",
                                          "\"nhtsa_state\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_make\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"make\"",
                                          "\"nhtsa_make\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_model\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"model\"",
                                          "\"nhtsa_model\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      }

                  ]
              }],
              "whereClause": {
          "operator": "and",
          "expressions": [
              {
              "operator": "=",
              "columns": [
              "nhtsa_airbag.def"
              ],
              "value": "'Deployed- Side (door'"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_vehicle.pnumber"
              ],
              "value": "1"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_make.id",
              "nhtsa_model.makeid"
              ]
            }
          ]
              }
          }
  }
  • Physical query creation – Deployed Front 2015

Create a query to by calling POST /queries endpoint. For example, this sample application selects attributes from five schemas generated above.

Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    {
          "name": "Deployed- Front 2015",
          "desc": "Deployed- Front 2015",
          "isBusinessQuery": false,
          "statement": {
              "from": [
                "\"nhtsa_airbag\"",
                  "\"nhtsa_state\"",
                  "\"nhtsa_vehicle\"",
                  "\"nhtsa_model\"",
                  "\"nhtsa_make\""
                  ],
              "selectAttrs": [
                  "\"nhtsa_airbag\".\"def\"",
                  "\"nhtsa_state\".\"def\"",
                  "\"nhtsa_vehicle\".\"vin\"",
                  "\"nhtsa_vehicle\".\"caseyear\"",
                  "\"nhtsa_make\".\"def\"",
                  "\"nhtsa_model\".\"def\""

              ],
              "joins": [{
                  "joinType": "INNER",
                  "relationship": [
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_airbag\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"airbag\"",
                                          "\"nhtsa_airbag\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_state\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"regstate\"",
                                          "\"nhtsa_state\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_make\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"make\"",
                                          "\"nhtsa_make\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_model\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"model\"",
                                          "\"nhtsa_model\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      }

                  ]
              }],
              "whereClause": {
          "operator": "and",
          "expressions": [
              {
              "operator": "=",
              "columns": [
              "nhtsa_airbag.def"
              ],
              "value": "'Deployed- Front'"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_vehicle.caseyear"
              ],
              "value": "2015"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_vehicle.pnumber"
              ],
              "value": "1"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_make.id",
              "nhtsa_model.makeid"
              ]
            }
          ]
              }
          }
  }
  • Physical query creation – Deployed Front 2015 and 2017

Create a query to by calling POST /queries endpoint by referring to the Creating JSON Query using SDI to understand the query format. For example, this sample application selects attributes from five schemas generated above.

Request
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
    {
          "name": "Deployed- Front  2015 and 2017",
          "desc": "Deployed- Front  2015 and 2017",
          "isBusinessQuery": false,
          "statement": {
              "from": [
                "\"nhtsa_airbag\"",
                  "\"nhtsa_state\"",
                  "\"nhtsa_vehicle\"",
                  "\"nhtsa_model\"",
                  "\"nhtsa_make\""
                  ],
              "selectAttrs": [
                  "\"nhtsa_airbag\".\"def\"",
                  "\"nhtsa_state\".\"def\"",
                  "\"nhtsa_vehicle\".\"vin\"",
                  "\"nhtsa_vehicle\".\"caseyear\"",
                  "\"nhtsa_make\".\"def\"",
                  "\"nhtsa_model\".\"def\""

              ],
              "joins": [{
                  "joinType": "INNER",
                  "relationship": [
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_airbag\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"airbag\"",
                                          "\"nhtsa_airbag\".\"id\""
                                      ]
                                  }
                              ]

                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_state\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"regstate\"",
                                          "\"nhtsa_state\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_make\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"make\"",
                                          "\"nhtsa_make\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_model\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"model\"",
                                          "\"nhtsa_model\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      }

                  ]
              }],
              "whereClause": {
          "operator": "and",
          "expressions": [
              {
              "operator": "=",
              "columns": [
              "nhtsa_airbag.def"
              ],
              "value": "'Deployed- Front'"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_vehicle.pnumber"
              ],
              "value": "1"
            },
            {
              "operator": "=",
              "columns": [
              "nhtsa_make.id",
              "nhtsa_model.makeid"
              ]
            }
          ]
          }
  }
  • Physical query creation – Deployed PLM Combination 2015

Create a query to by calling POST /queries endpoint by referring to the Creating JSON Query using SDI to understand the query format. For example, this sample application selects attributes from three schemas generated above.

Request
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
    {
          "description": "",
          "isBusinessQuery": false,
          "name": "Create - Deployed PLM Combination 2015 - NHTSA and Teamcenter",
          "statement": {
              "from": [
                  "nhtsa_vehicle",
                  "nhtsa_airbag",
                  "teamcenter_realizedproduct"
              ],
              "selectAttrs": [
                  "\"nhtsa_vehicle\".\"vin\"",
                  "\"nhtsa_airbag\".\"def\"",
                  "\"nhtsa_vehicle\".\"modelyr\"",
                  "\"nhtsa_vehicle\".\"caseyear\"",
                  "\"nhtsa_vehicle\".\"licstate\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._accessrefs\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._id\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._masterref\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._serialnumber\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata.uservalue._valueref\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata.uservalue._title\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._manufactureddate\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._application\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._version\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._partnumber\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._isserialised\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._manufacturerref\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata._id\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision._effectivityrefs\"",
                  "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._label\""
              ],
              "joins": [{
                  "joinType": "INNER",
                  "relationship": [
                              {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"nhtsa_airbag\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                                  {
                                      "operator": "=",
                                      "columns": [
                                          "\"nhtsa_vehicle\".\"airbag\"",
                                          "\"nhtsa_airbag\".\"id\""
                                      ]
                                  }
                              ]
                          }
                      },
                      {
                          "betweenSchemas": [
                              "\"nhtsa_vehicle\"",
                              "\"teamcenter_realizedproduct\""
                          ],
                          "joinCondition": {
                              "onColumns": [
                          {
                        "operator": "=",
                        "columns": [
                        "\"nhtsa_vehicle\".\"vin\"",
                      "\"teamcenter_realizedproduct\".\"realisedproductrevision._serialnumber\""
                    ]
                  }
                  ]
                }
              }
              ]
              }],
              "whereClause": {
              "operator": "and",
                "expressions": [
                {
                "operator": "=",
                "columns": [
                "nhtsa_airbag.def"
                ],
                "value": "'Deployed- Combination'"
                },
                {
                "operator": "=",
                "columns": [
                "nhtsa_vehicle.caseyear"
              ],
          "value": "2015"
              },
                {
                    "operator": "=",
                    "columns": [
                    "nhtsa_vehicle.pnumber"
                ],
                "value": "1"
              }
            ]
          }
      }
  }
  • Physical query creation – Deployed PLM Combination 2015 and 2017 Create a query to by calling POST /queries endpoint. For example, this sample application selects attributes from three schemas generated above.
Request
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    {
    "description": "",
    "name": "Create - Deployed PLM Combination 2015 and 2017 - NHTSA and Teamcenter",
    "isBusinessQuery": false,
    "statement": {
      "from": [
        "nhtsa_vehicle",
        "nhtsa_airbag",
        "teamcenter_realizedproduct"
      ],
      "selectAttrs": [
        "\"nhtsa_vehicle\".\"vin\"",
        "\"nhtsa_airbag\".\"def\"",
        "\"nhtsa_vehicle\".\"modelyr\"",
        "\"nhtsa_vehicle\".\"caseyear\"",
        "\"nhtsa_vehicle\".\"licstate\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._accessrefs\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._id\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._masterref\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._serialnumber\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata.uservalue._valueref\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata.uservalue._title\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._manufactureddate\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._application\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._version\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._partnumber\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._isserialised\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._manufacturerref\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.userdata._id\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision._effectivityrefs\"",
        "\"teamcenter_realizedproduct\".\"realisedproductrevision.applicationref._label\""
      ],
      "joins": [
        {
          "joinType": "INNER",
          "relationship": [
            {
              "betweenSchemas": [
                "\"nhtsa_vehicle\"",
                "\"nhtsa_airbag\""
              ],
              "joinCondition": {
                "onColumns": [
                  {
                    "operator": "=",
                    "columns": [
                      "\"nhtsa_vehicle\".\"airbag\"",
                      "\"nhtsa_airbag\".\"id\""
                    ]
                  }
                ]
              }
            },
            {
              "betweenSchemas": [
                "\"nhtsa_vehicle\"",
                "\"teamcenter_realizedproduct\""
              ],
              "joinCondition": {
                "onColumns": [
                  {
                    "operator": "=",
                    "columns": [
                      "\"nhtsa_vehicle\".\"vin\"",
                      "\"teamcenter_realizedproduct\".\"realisedproductrevision._serialnumber\""
                    ]
                  }
                ]
              }
            }
          ]
        }
      ],
      "whereClause": {
        "operator": "and",
        "expressions": [
          {
            "operator": "=",
            "columns": [
              "nhtsa_airbag.def"
            ],
            "value": "'Deployed- Combination'"
          },
          {
            "operator": "=",
            "columns": [
              "nhtsa_vehicle.pnumber"
            ],
            "value": "1"
          }
        ]
      }
    }
  }

4.Final step is to use the queryids from the queries created above in sample code. So preserve these ids and use it in the sample code. Follow the Description of Code section below and modify sample code to consume the query and see the dashboard. You can use either business query or physical query.

Samples description

Each sample client has set of instructions that need to be followed. Use “README.md” in the client code to update configuration and environment files for values that need to be updated before the client can work properly. Once the clients and support files are updated with appropriate values, they can be compiled.

Downloading the sample code

  • To download the sample code, refer the The Package-SIOS section. This sample code is in zip format. Follow the below steps below to proceed further:
  • Unzip the sample code downloaded to your local directory For example: D:\workdir\edi-car-crash-analytics-app, henceforth known as WORKING_DIR.
  • The WORKING_DIR will contain two sub folders underneath:
    • car-crash-analysis-dashboard: This project contains the dashboard UI related codebase. This code processes the data collected by calling the backend endpoints and displays the dashboard to user.
    • car-crash-analysis-backend: This is a backend project built over Java Spring Boot Maven and requires to be run over the web server. This project retrieves the data by executing query based on the queryid created in previous steps.

Editing and building the backend code

  1. In the manifest.yml file in WORKING_DIR car-crash-analysis-backend, do the following changes:
    • update the DATA_QUERY_SERVICE_ENDPOINT with query service path
    • Update the Query Mapping section if needed
    • Update the route as it will bind the app to route
  2. Open the terminal and navigate to WORKING_DIR\air-quality-analysis-backend.
  3. Run mvn clean install.
  4. Verify that build is successful. Project is now ready to be deployed on Cloud Foundry.

Editing and Deploying the frontend code

  1. In manifest.yml file from WORKING_DIR car-crash-analysis-dashboard, update the route as it will bind the app to route.
  2. Open the terminal and navigate to WORKING_DIR car-crash-analysis-dashboard.
  3. Run npm install and verify whether dependencies were downloaded successfully.
  4. Run npm run build.
  5. Verify that build is successful and a dist folder is generated. Project is now ready to be deployed on Cloud Foundry.

Deploying the sample code

After the Cloud Foundry set up is complete, follow the below steps to proceed with the front end deployment on Cloud Foundry:

Verify Cloud Foundry workspace access

  1. Access https://login.cf.eu1.mindsphere.io/passcode in the browser and login with webkey. Copy the generated PASSCODE.
  2. Open the command line shell and execute the following command: cf login -a https://api.cf.eu1.mindsphere.io --sso-passcode <PASSCODE> Use the copied PASSCODE from the previous step.

Once the Cloud Foundry access is verified, follow the below steps:

Deploying frontend project on Cloud Foundry:

  1. Open the terminal and navigate to WORKING_DIR car-crash-analysis-dashboard.
  2. Run cf push. This will push the code to Cloud Foundry.
  3. Verify that push is successful.
  4. Copy the Cloud Foundry URL given in the route. This URL will be used in the app setup in Developer Cockpit.

Deploying backend project on Cloud Foundry

  1. Navigate to WORKING_DIR car-crash-analysis-backend.
  2. Open the command line shell and execute cf push.
  3. Copy the Cloud Foundry URL given in the route. This URL will be used in the app setup in Developer Cockpit.

Register Cloud Foundry App on MindSphere

Creating an Application

  1. Log on to the MindSphere Launchpad and access Developer Cockpit.
  2. Click "Create new application" and enter the "Display Name" and "Description" of the app. Create app
  3. In the Components textbox, enter the value as “car-crash-analysis-ui”.
  4. Paste the Route URL copied from Frontend deployment step into the Direct URL textbox.
  5. In the "Components" section, add endpoint for component by clicking “+” icon beside route textbox.
  6. In the Components textbox, enter the value as “car-crash-analysis-service”.
  7. Paste the Route URL copied from Backend deployment step into the Direct URL textbox.
  8. Go to the Component Section and Add Endpoint for “frontend” component. Repeat the steps for each of this following item.
    • Add Endpoint for “/”
    • Add Endpoint for “/static/**”
  9. Navigate to the Component Section and Add Endpoint for “backend” component. Repeat the steps for each of this following item.
    • Add Endpoint for “/query/**”
    • Add Endpoint for “/rawQuery/**”
    • Add Endpoint for “/queryMapping/**”
  10. Add Icon if necessary and click Save.

The application will be created.

Adding Scopes

For information on adding scope refer Adding scopes section.

Register an app

For information on registering app refer Register App section.

Adding roles for an app

For information on adding access refer Adding roles section.

Troubleshooting

REST endpoints for Postman

  1. Import the provided Postman collection, JSON into Postman.
  2. Once collection is imported, provide proper bearer authorization token as shown below for one of the endpoint: Troubleshooting

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.