Logical map widget

The logical map shows the relationship between assets and between an asset and a type of measurement.

The user can query the logical map via a keyword of the instance. The logical map can be extended to show related items, and the user can analyze the impact between instances.

The framework of a logical map is in three parts:
  1. The logical map and its services. The data is queried from the model server via services and the model server interface.
  2. The crawler and model server, The crawler generates the OWL file based on the configuration.
  3. The user-defined part. This includes the data model and its service, and the configuration for the crawler to generate the OWL file.
Here is sample data that is generated by the crawler. In this example the OWL defines 2 kinds of instance types:
  • substation and asset.
  • Current_Risk a measurement type.
The OWL also defines two relationships:
  • Asset.hasMeasurement references the measurement belonging to the asset.
  • Measurement.associatedToAsset references the asset belonging to the measurement.

The two relationships are an inverse of each other, therefore in the rdf file, only one relationship needs to be defined. After execution of inference.sh from the Jena installation path the other relationship is automatically generated.

<rdf:Description rdf:about="http://ontology#substation">
  <rdf:type rdf:resource="http://www.w3.org/2002/07//owl#class"/>
  <rdfs:lable xml:lang="en">Substation</rdfs:label>
  <rdfs:subClassOf rdf:resource="http://ontology#asset"/>
</red:Description>

<rdf:Description rdf:about="http://ontology#Asset.hasMeasurement">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
  <rdfs:label xml:lang="en">Asset.hasMeasurement</rdfs#label>
  <owl:inverseOf rdf:resource="http://ontology#Measurement.associatedToAsset">
  <rdfs:subClassOf rdf:resource="http://ontology#Relationship"/>
</rdf:Description>

<rdf:Description rdf:about="http://ontology#Current_Risk">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
  <rdfs:label xml:lang="en">Current_Risk</rdfs#label>
  <rdfs:subClassOf rdf:resource="http://ontology#Measurement"/>
  <rdfs:comment>Measurement</rdfs:comment>
</rdf:Description>

<rdf:Description rdf:about="http://ontology#Measurement.associationToAsset">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
  <rdfs:label xml:lang="en">Measurement.associationToAsset</rdfs#label>
  <owl:inverseOf rdf:resource="http://ontology#Asset.hasMeasurement">
  <rdfs:subClassOf rdf:resource="http://ontology#Relationship"/>
</rdf:Description>

The example rdf file defines that Current_Risk_944 is a measurement Measurement.associatedToAsset of substation_2596. After execution of the inference.sh then substation_2596 has the relationship Asset.hasMeasurement and references Current_Risk_944.

The rdf file defines two instances:
  • substation_2596
  • Current_Risk_944
These two instance have the relationship Measurement.associatedToAsset. The Current_Risk_944 is the measurement of the asset substation_2596.
Note: The rdf:resource should refer to an existing id defined in rdf:ID, e.g. rdf:resource of Current_Risk_944 refers to the rdf:ID of substation_2596.
<otl:substation rdf:ID="substation_2596">
  <otl:Object.name>Anytown_North</otl:Object.name>
  <rdfs:label xml:lang="en">Anytown_North</rdfs:label>
  <otl:Object.item.Url>ibm/ife/sample/dno/api/substation/2596</otl:Object.item.Url> 
</otl:substation>

<otl:Current_Risk rdf:ID="Current_Risk_944">
  <otl:Object.name>Current Risk</otl:Object.name>
  <rdfs:label xml:lang="en">Current Risk</rdfs:label>
  <otl:Object_description>Current Risk</otl:Object.description>
  <otl:Object.item.Url>ibm/ife/sample/dno/api/measurement/944</otl:Object.item.Url> 
  <otl:Measurement.accosicatedToAsset rdf:resource="#substation_2596"/>
</otl:Current_Risk>

The example rdf file has the crawler configuration necessary to generate the OWL and RDF files as follows:

Figure 1. Crawler configuration ID:substation
Crawler configuration ID:substation
Figure 2. Crawler configuration ID:Current_Risk
Crawler configuration ID:Current_Risk
Figure 3. Crawler configuration ID:Measurement_associatedToAsset
Crawler configuration ID:Measurement_associatedToAsset
Note: Explanatory notes:
  • The red rectangle ID:"substation" should be the same value as itermsUrl.asset_type, otherwise the rdf:resource will refer to a none existing rdf:ID. The result in the logical map will not be correct.
  • The values for id, value, subClassOf, owl_template, and rdf_template can all be edited.
  • The value for itemsUrl is the service URL and is mandatory. It represents the result returned from the service.
  • The label is used to search and is mandatory.
  • The owl_template is the content of this type in the owl file.
  • The rdf_template is the content of a instance of this type in the rdf file.
  • The variable @{…} is changed to a real value.
The Service.properties file at the location: /opt/IBM/energy/crawler defines some of the properties used in the crawler.
Table 1. Type and parameter mapping
Property Description
serviceBaseURL=http://ip:port The service URL.
serviceUser=sysadmin Service username.
servicePassword=passw0rd Service password.
CLIENT_READ_TIMEOUT=0 Read_timeout.
CLIENT_CONNECT_TIMEOUT=0 Connect_timeout.
owlfile=d:/newfile.owl New OWL file.
rdffile=d:/newrdffile.rdf New rdf file.

ifef.widget.LogicalMap Property

The property for the logical map is:

layoutData:

The data that is used to draw in the logical map.

ifef.widget.LogicalMap Parameters

Th parameters for th logical map are:

keyFields:

Used to identify a record, json object, coming from a call of the model.

namespace:

The namespace of the data as an OWL/rdf file that is generated by the crawler. The namespace is defined in the configuration file of the crawler.

knnDepth:

The depth for the KNN service, K-NearestNeighbor.

impactAnalysisDepth:

The depth of the impact analysis service. It can be temporarily changed by the configuration dialog of the logical map.

instCfg:

The configuration for the instance. It can be temporarily changed by the configuration dialog of the logical map. The user can add or delete items to add or remove one kind of instance. The instType of newly added item here must be generated in OWL files and already imported to model server.

For example: Add one instance type:
{"instType":"undergroundline", "canBeOnMap":true, "checked":false, "label":"Underground
        Line", "instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/undergroundline.png"}
The instance type is defined in the configuration file of crawler:
Figure 4. Configuration file of the crawler
Configuration file of the crawler
  • canBeOnMap - the instance can be displayed on map. If true, then there must be a “Highlight On Map” action for this instance.
  • checked - Determines if this instance type is used to filter the search result.
  • instStyle - The icon used for this instance type
  • label - The text display in configuration dialog.
relationshipCfg:

The configuration for the relationship. It can be temporarily changed by the configuration dialog of logical map. The user can add or delete item here to add or remove one kind of relationship. The relationship must be generated in the OWL file and already be imported to the model server.

For example: Add one relationship.
{"relationship":"http://ontology#Asset.NewRelationship", "checked":true, "label":"New Relationship", "relationshipStyle":"#ffa500"}
  • relationship - the relationship defined in the OWL file.
  • checked - determines if this relationship is used to filter the search result.
  • relationsihpStyle - the color for this relationship. If the value is not in range of ColorPalette, then black(#000000) is used.
  • label - the text displayed in the configuration dialog.
An sample configuration
{
                "id": "logicalMap",
                "module": "lmap/widget/logicalmap/LogicalMap",
                "container": "logicalMapTab",
                "properties":["layoutData"],
                "parameters": {                   
        "keyFields":
        ["ASSET_TYPE",
        "ASSET_ID"],                   
        "namespace":"http://ontology#",                   
        "knnDepth":1,                   
        "impactAnalysisDepth":6,       
        "instCfg":[{"instType":"substation",
        "canBeOnMap":true, "checked":true, 
"label":"@{nls.CfgDlgInstSubstation}", 
"instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/substation.png"},
     {"instType":"overheadline", "canBeOnMap":true, "checked":true, 
"label":"@{nls.CfgDlgInstOverheadline}", 
"instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/overheadline.png"},
     {"instType":"wind_farm", "canBeOnMap":true, "checked":false, 
"label":"@{nls.CfgDlgInstWindFarm}", 
"instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/wind_farm.png"},
     {"instType":"Measurement", "canBeOnMap":false, "checked":false, 
"label":"@{nls.CfgDlgInstMeasurement}", 
"instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/measurement.png"},
     {"instType":"Default", 
      "instStyle":"/ibm/ife/logicalmap/test/logicalmap/icon/measurement.png"}
            ],      
"relationshipCfg":[
     {"relationship":"http://ontology#Asset.Connects", "checked":true, "label":"@{nls.CfgDlgRealConnects}",
"relationshipStyle":"#7fff00"},                           
     {"relationship":"http://ontology#Asset.Connected",
"checked":true, "label":"@{nls.CfgDlgRealConnected}", "relationshipStyle":"#ffa500"},
     {"relationship":"http://ontology#Asset.Contains",
"checked":false, "label":"@{nls.CfgDlgRealContains}", "relationshipStyle":"#6495ed"},
     {"relationship":"http://ontology#Asset.Contained",
"checked":false, "label":"@{nls.CfgDlgRealContained}", "relationshipStyle":"#7b68ee"},
     {"relationship":"http://ontology#Asset.hasMeasurement", 
"checked":true, "label":"@
     {nls.CfgDlgRealHasMeasurement}", "relationshipStyle":"#f08080"},
     {"relationship":"http://ontology#Measurement.associatedToAsset", 
"checked":true, "label":"@
     {nls.CfgDlgRealAssociatedToAsset}",
"relationshipStyle":"#ff4500"},
     {"relationship":"http://ontology#Asset.hasPrimaryMeasurement",
      "checked":true, "label":"@
     {nls.CfgDlgRealHasPrimaryMeasurement}", "relationshipStyle":"#b22222"},
     {"relationship":"http://ontology#Measurement.Is_Primary_Measurement_Of", 
      "checked":true, "label":"@
     {nls.CfgDlgRealIsPrimaryMeasurementOf}", "relationshipStyle":"#ffd700"},
     {"relationship":"http://www.w3.org/2000/01/rdf-schema#subClassOf", 
        "checked":true, "label":"@{nls.CfgDlgRealSubClassOf}",
        "relationshipStyle":"#ffe4c4"},
     {"relationship":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
      "checked":true, "label":"@{nls.CfgDlgRealType}", 
      "relationshipStyle":"#da70d6"}        ]                 }
    }

Related configuration for the logical map

There are three other configurations to support the logical map:
  1. Logical map layouts - used to draw logical maps with different layouts.
    • Property -

      rawLayoutData: the data used to draw the logical map.

    • Parameter -

      The id of logical map.

    Configuration sample:

    { 
    "id": "logicalMapLayouts", 
    "module": "lmap/behavior/LogicalMapLayouts", 
    "properties":["rawLayoutData"], 
    "parameters": { "logicalMap":"@{logicalMap}" } }
  2. Logical map previewcard helper - used as the helper class for more actions of logical map previewcard.
    • Parameters:
      • logicalMap: the ID of logical map.
      • highlightOnMap: the common highlight on the map support.

      Configuration sample:

      {
                      "id":"logicMapPreviewCardHelper",
                      "module":"lmap/widget/logicalmap/LogicMapPreviewCardHelper",
                      "parameters":{
                                      "logicalMap":"@{logicalMap}",
                                      "highlightOnmap":"@{highlightOnMap.highlightOnMap}"
                      }
          }
  3. Logical map previewcard - Refer to PreviewCard widget for information about the parameters.

    The property “NAME” is required to display the relationship or instance information without an item URL, for example: Instance type:substation, in the previewcard. For example: {"label":"@{dno_nls.NAME}","name":"NAME", "isKey": true}.

    A sample configuration is given:
    "id":"logicalMapPreviewCard",
         "module": "ifef/widget/previewcard/PreviewCard",
         "properties":["data"],
         "parameters": {
              "titleProperty": "NAME",
              "position": "_position",
              "properties":[
                {"label":"@{dno_nls.Measurement_ID}", "name":"MEASUREMENT_ID", "isKey": true},
                {"label":"@{dno_nls.Asset_ID}", "name":"ASSET_ID", "isKey": true},
                {"label":"@{dno_nls.FARM_ID}", "name":"FARM_ID", "isKey": true},
                {"label":"@{dno_nls.Measurement_Type}", "name":"MEASUREMENT_TYPE", "isKey": true}, 
                {"label":"@{dno_nls.ID}","name":"ID", "isKey": true}, 
                {"label":"@{dno_nls.NAME}","name":"NAME", "isKey": true},
                {"label":"@{dno_nls.Serial_Number}","name":"SERIAL_NUMBER", "isKey": true},
                {"label":"@{dno_nls.UNIT}","name":"UNIT", "isKey": true},
                {"label":"@{dno_nls.Description}","name":"DESCRIPTION", "isKey": true},
                {"label":"@{dno_nls.Create_Date}","name":"CREATE_DATE"},
                {"label":"@{dno_nls.Installation_Date}","name":"INSTALLATION_DATE"},
                {"label":"@{dno_nls.STATUS}",
              "name":"STATUS",
              "isKey": true,
              "render":{
              "templates":[
                    {
                         "condition":"STATUS==0",
                         "content":"<span
    style='background-color:green'>${Acceptable}</span>",                                                                                                               
                         "variables":{
                         "Acceptable":"@{dno_nls.Acceptable}"
                                         }
                                    },
                                    {
                         "condition":"STATUS==1",
                         "content":"<span
    style='background-color:orange'>${Caution}</span>",
                         "variables":{
                              "Caution":"@{dno_nls.Caution"}
                                     }
                                     },                                                                                               
                                     {
                         "condition":"STATUS==2",
                         "content":"<span
    style='background-color:red'>${Critical}</span>",
                         "variables":{
                              "Critical":"@{dno_nls.Critical}"
                                          }
                                      }
                                 ]
                            }
                        },
                        {"label":"@{dno_nls.Location}","name":"LOCATION"},
                   ]"
              "moreActions":[
         ]
         }
    }