Creating Semantic Models using Semantic Data Interconnect (SDI) APIs¶
SDI Semantic Service provides end-to-end capability to import/create, retrieve, update or delete the entire ontological models. Currently, this is done with set of APIs that allow users to perform different actions on nodes and edges. There are three major approaches to create Semantic models in SDI:
- Import Semantic Model: When the Data Analyst/Semantic modeler has created Semantic model, SDI provides the ability to optionally import the Semantic model as a starting point. SDI supports Owl file format to import Semantic model. Owl file can be accessed by REST API.
- Infer Semantic Model: SDI leverages extracted schema to infer correlation of data from multiple systems and provides a recommended Semantic model. SDI also provides the initial inferred Semantic model on the basis of schemas extracted. User can provide list of schemas to infer Semantic model. This Inferred Semantic model can then be updated further by Data Analysts/Domain experts according to domain specific relationships.
This ability to infer the Semantic model reduces the investment in skillset, time and resources needed by significant amount and provides an extremely value added starting point for the Data Analysts/Domain experts.
For SDI to get inferred Semantic model, atleast two schemas should be provided. Once schemas are provided, SDI provides an initial recommended Semantic model based on request. This input can then be used to create a complete Semantic model.
SDI defined Semantic Model¶
In most of the cases that requires relations to be established between attributes and data points, SDI Semantic model framework can be used to create models on basis of global defined types of nodes and edges. For more information on Semantic Model refer SDI Semantic Modelling Service.
Prerequisites¶
- Semantic Data Interconnect provisioned to the tenant.
- A SDI role: either SDI admin or SDI semantic user role. Or, technical user credentials.
Example scenario¶
Every Semantic model is associated with a domain. For example, an automotive manufacturer has design, manufacturing, supply chain, marketing & sales, etc. as departments. Every department has its own business terminologies and therefore can be attributed as a domain.
In the sample ontology below, the AirQuality App
Semantic model provides an isolation layer to data analysts or domain experts from rest of the schemas in a tenant and is treated as a separate domain. In SDI, domains are represented by namespace.
Every namespace then consists of further classes and business properties. From the example of Airquality App
which wants to create a dashboard about air quality index in North America, Air quality
and Monitoring Stations
are two classes considered. Air quality
is defined by the properties: sitename
, Quality parameters
(types of air quality parameters) and value
. Similarly, Monitoring Stations
has properties: sitename
, longitude
, latitude
.
Every business property is then mapped to schema properties or columns. You can only define or attach schemas in a namespace which belongs to a tenant in SDI. You can request to get different schemas using POST Method with URI /searchSchemas
.
The Semantic modeler or data analyst user can then can retrieve schemas and start mapping schemas to business properties. The relation type PropertyRelations
is used to define relationships between business properties. Currently, it supports two types of property relations, one-to-one and one-to-many types.
Note
PropertyRelations
is not used currently in query transformation, but will be used in future where actual queries created will consider property relations from Semantic models.
Sample request for creating ontology for Air Quality App
(available in SIOS) is as below:
Request
{
"classes": [{
"name": "AirQualityIndex"
}, {
"name": "Monitoring"
}],
"schemas": [{
"name": "airnow_aqi"
}, {
"name": "airnow_monitoringsites"
}],
"classProperties": [{
"name": "Value",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
}, {
"name": "parameterName",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
}, {
"name": "siteName",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
}, {
"name": "latitude",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
}, {
"name": "longitude",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
}, {
"name": "siteName",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
}],
"schemaProperties": [{
"name": "AQSID",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "date",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "parametername",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "sitename",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "time",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "value",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
}, {
"name": "AQSID",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}, {
"name": "latitude",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}, {
"name": "longitude",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}, {
"name": "parametername",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}, {
"name": "sitecode",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}],
"mappings": [{
"name": "mapping0",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "Value",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [{
"name": "value",
"parentSchema": {
"name": "airnow_aqi"
}
}],
"mappingFunction": {}
}, {
"name": "mapping1",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "parameterName",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [{
"name": "parametername",
"parentSchema": {
"name": "airnow_aqi"
}
}],
"mappingFunction": {}
}, {
"name": "mapping2",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "siteName",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [{
"name": "sitename",
"parentSchema": {
"name": "airnow_aqi"
}
}],
"mappingFunction": {}
}, {
"name": "mapping3",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "latitude",
"parentClass": {
"name": "Monitoring"
}
},
"schemaProperties": [{
"name": "latitude",
"parentSchema": {
"name": "airnow_monitoringsites"
}
}],
"mappingFunction": {}
}, {
"name": "mapping4",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "longitude",
"parentClass": {
"name": "Monitoring"
}
},
"schemaProperties": [{
"name": "longitude",
"parentSchema": {
"name": "airnow_monitoringsites"
}
}],
"mappingFunction": {}
}]
}
Semantic queries can be built using SDI data query service APIs. Every Semantic query is based on a namespace created within SDI. You can retrieve Semantic model from HTTP method:
GET API URL: <Base URL></api/sdi/v3/ontologies/{id}>
Sample response of retrieve ontology for Air Quality App
is as below:
Response
{
"id": "77A435151E126FA07ACB32D20AAF54F5",
"ontologyName": "AirQualityApp",
"createdDate": "2019-10-18T11:01:33.063Z",
"updatedDate": "2019-10-18T11:01:33.064Z",
"classes": [
{
"name": "AirQualityIndex"
},
{
"name": "Monitoring"
}
],
"schemas": [
{
"name": "airnow_aqi"
},
{
"name": "airnow_monitoringsites"
}
],
"classProperties": [
{
"name": "Value",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
},
{
"name": "parameterName",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
},
{
"name": "siteName",
"datatype": "String",
"parentClass": {
"name": "AirQualityIndex"
}
},
{
"name": "latitude",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
},
{
"name": "longitude",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
},
{
"name": "siteName",
"datatype": "String",
"parentClass": {
"name": "Monitoring"
}
}
],
"schemaProperties": [
{
"name": "value",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
},
{
"name": "parametername",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
},
{
"name": "sitename",
"parentSchema": {
"name": "airnow_aqi"
},
"datatype": "String"
},
{
"name": "latitude",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
},
{
"name": "longitude",
"parentSchema": {
"name": "airnow_monitoringsites"
},
"datatype": "String"
}
],
"mappings": [
{
"name": "mapping0",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "Value",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [
{
"name": "value",
"parentSchema": {
"name": "airnow_aqi"
}
}
]
},
{
"name": "mapping1",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "parameterName",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [
{
"name": "parametername",
"parentSchema": {
"name": "airnow_aqi"
}
}
]
},
{
"name": "mapping2",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "siteName",
"parentClass": {
"name": "AirQualityIndex"
}
},
"schemaProperties": [
{
"name": "sitename",
"parentSchema": {
"name": "airnow_aqi"
}
}
]
},
{
"name": "mapping3",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "latitude",
"parentClass": {
"name": "Monitoring"
}
},
"schemaProperties": [
{
"name": "latitude",
"parentSchema": {
"name": "airnow_monitoringsites"
}
}
]
},
{
"name": "mapping4",
"keyMapping": true,
"functionalMapping": false,
"classProperty": {
"name": "longitude",
"parentClass": {
"name": "Monitoring"
}
},
"schemaProperties": [
{
"name": "longitude",
"parentSchema": {
"name": "airnow_monitoringsites"
}
}
]
}
]
}
Related Links¶
Any questions left?
Except where otherwise noted, content on this site is licensed under the Development License Agreement.