Commit 659c0b8e authored by Andrei Popescu's avatar Andrei Popescu
Browse files

path corrections

parent 7c47cc16
Pipeline #54882 passed with stage
in 35 seconds
......@@ -19,133 +19,96 @@ sdm:refDevice rdf:type rdf:Property;
rdfs:range sdm:RefDevice.
sdm:refTargetDevice rdf:type rdf:Property;
rdfs:range sdm:RefTargetDevice.
sdm:totalActiveEnergyImport rdfs:range xsd:integer.
sdm:totalReactiveEnergyImport rdfs:range xsd:integer.
sdm:totalApparentEnergyImport rdfs:range xsd:integer.
sdm:totalActiveEnergyExport rdfs:range xsd:integer.
sdm:totalReactiveEnergyExport rdfs:range xsd:integer.
sdm:totalApparentEnergyExport rdfs:range xsd:integer.
sdm:frequency rdfs:range xsd:integer.
sdm:totalActivePower rdfs:range xsd:integer.
sdm:totalReactivePower rdfs:range xsd:integer.
sdm:totalApparentPower rdfs:range xsd:integer.
sdm:activeEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ActiveEnergyImport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:reactiveEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ReactiveEnergyImport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:apparentEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ApparentEnergyImport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:activeEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ActiveEnergyExport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:reactiveEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ReactiveEnergyExport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:apparentEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ApparentEnergyExport.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:activePower rdf:type rdf:Property;
rdfs:range sdm:ActivePower.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:reactivePower rdf:type rdf:Property;
rdfs:range sdm:ReactivePower.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:apparentPower rdf:type rdf:Property;
rdfs:range sdm:ApparentPower.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:totalPowerFactor rdfs:range xsd:integer.
sdm:powerFactor rdf:type rdf:Property;
rdfs:range sdm:PowerFactor.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:totalDisplacementPowerFactor rdfs:range xsd:integer.
sdm:displacementPowerFactor rdf:type rdf:Property;
rdfs:range sdm:DisplacementPowerFactor.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:current rdf:type rdf:Property;
rdfs:range sdm:Current.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:N rdf:type rdf:Property;
rdfs:range sdm:N.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:N rdfs:range xsd:integer.
sdm:phaseVoltage rdf:type rdf:Property;
rdfs:range sdm:PhaseVoltage.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:phaseToPhaseVoltage rdf:type rdf:Property;
rdfs:range sdm:PhaseToPhaseVoltage.
sdm:L12 rdf:type rdf:Property;
rdfs:range sdm:L12.
sdm:L23 rdf:type rdf:Property;
rdfs:range sdm:L23.
sdm:L31 rdf:type rdf:Property;
rdfs:range sdm:L31.
sdm:L12 rdfs:range xsd:integer.
sdm:L23 rdfs:range xsd:integer.
sdm:L31 rdfs:range xsd:integer.
sdm:thdVoltage rdf:type rdf:Property;
rdfs:range sdm:ThdVoltage.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:thdCurrent rdf:type rdf:Property;
rdfs:range sdm:ThdCurrent.
sdm:L1 rdf:type rdf:Property;
rdfs:range sdm:L1.
sdm:L2 rdf:type rdf:Property;
rdfs:range sdm:L2.
sdm:L3 rdf:type rdf:Property;
rdfs:range sdm:L3.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
......@@ -19,7 +19,10 @@
"sdm:PhaseVoltage": "phaseVoltage",
"sdm:PhaseToPhaseVoltage": "phaseToPhaseVoltage",
"sdm:ThdVoltage": "thdVoltage",
"sdm:ThdCurrent": "thdCurrent"
"sdm:ThdCurrent": "thdCurrent",
"sdm:L1": "L1",
"sdm:L2": "L2",
"sdm:L3": "L3"
},
"sources": {
......
......@@ -108,11 +108,11 @@ var JsonProcessor = /** @class */ (function () {
return;
};
JsonProcessor.jsonTraverseRecursive = function (writer, depth, path, mainJsonObject, prop) {
// We only deal to depths <= 1; the following setups take care of that.
var tmpPath;
var propType;
var subProperties;
var propDescription;
console.log("depth", depth, "prop", prop);
if (depth == 0) {
propType = path[2].properties[prop].type;
subProperties = path[2].properties[prop].properties; //
......@@ -122,33 +122,45 @@ var JsonProcessor = /** @class */ (function () {
//let subSubItems = path[2].properties[prop].items;
}
if (depth == 1) {
console.log("depth", depth);
tmpPath = path[2].properties[mainJsonObject]; // adapt the path at depth 1 for the currently mainObject
console.log(mainJsonObject);
console.log("path2", path[2]);
tmpPath = path[2].properties[mainJsonObject]; // adapt the path at depth 1 for the currently mainObject
console.log("tmppath", tmpPath);
propType = tmpPath.type;
console.log("property", prop);
console.log("prop", tmpPath);
propType = tmpPath.properties[prop].type;
console.log("proptype", propType);
subProperties = tmpPath.properties;
propDescription = tmpPath.description;
//let directEnum = path.properties[prop].enum;
//let subSubProperties = path.properties[prop].properties;
//let subItems = path.properties[prop].items;
}
if (depth > 1) {
// Base cases
if (depth > 2) {
return;
}
// We assume it is an object or an array
if (propType == 'number') {
if (this.termMap.has(prop) == false) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'xsd:integer'));
}
return;
}
if (propType == 'boolean') {
if (this.termMap.has(prop) == false) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'xsd:boolean'));
}
return;
}
// Recursive step
if (propType == 'object' || propType == 'array') {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdf:type', 'rdf:Property')); // Add the property and its label
var newClassName = rdfTools_1.RDFTools.capitalizeFirstLetter(prop); // Since it is an object/array, we give it a new class as a range
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'sdm:' + newClassName));
if (this.termMap.has(prop) == false) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdf:type', 'rdf:Property')); // Add the property and its label
var newClassName = rdfTools_1.RDFTools.capitalizeFirstLetter(prop); // Since it is an object/array, we give it a new class as a range
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'sdm:' + newClassName));
}
depth += 1;
console.log("depth increase", depth);
// properties = ?;
//path = ?;
mainJsonObject = JsonProcessor.getJsonObject('sdm:' + rdfTools_1.RDFTools.capitalizeFirstLetter(prop));
for (var prop_1 in subProperties) {
this.jsonTraverseRecursive(this.writer, depth, this.path, this.mainJsonObject, prop_1);
this.jsonTraverseRecursive(this.writer, depth, path, mainJsonObject, prop_1);
}
}
return;
......
......@@ -135,31 +135,27 @@ export class JsonProcessor {
static jsonTraverseRecursive (writer, depth, path, mainJsonObject, prop){
// We only deal to depths <= 1; the following setups take care of that.
let tmpPath;
let propType;
let subProperties;
let propDescription;
console.log("depth", depth, "prop", prop);
if (depth == 0){
propType = path[2].properties[prop].type;
subProperties = path[2].properties[prop].properties; //
propDescription = path[2].properties[prop].description;
//let directEnum = path[2].properties[prop].enum;
//let subSubProperties = path[2].properties[prop].properties;
//let subSubItems = path[2].properties[prop].items;
}
if (depth == 1){
console.log("depth",depth);
console.log(mainJsonObject);
console.log("path2", path[2]);
tmpPath = path[2].properties[mainJsonObject]; // adapt the path at depth 1 for the currently mainObject
console.log("tmppath",tmpPath);
tmpPath = path[2].properties[mainJsonObject]; // adapt the path at depth 1 for the currently mainObject
propType = tmpPath.type;
console.log(mainJsonObject);
console.log("property", prop);
console.log("prop", tmpPath);
propType = tmpPath.properties[prop].type;
console.log("proptype", propType);
subProperties = tmpPath.properties;
propDescription = tmpPath.description;
//let directEnum = path.properties[prop].enum;
......@@ -167,28 +163,38 @@ export class JsonProcessor {
//let subItems = path.properties[prop].items;
}
if(depth > 1){
// Base cases
if(depth > 2){
return;
}
// We assume it is an object or an array
if (propType == 'number'){
if (this.termMap.has(prop) == false) {
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'xsd:integer'));
}
return;
}
if (propType == 'boolean'){
if (this.termMap.has(prop) == false) {
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'xsd:boolean'));
}
return;
}
// Recursive step
if(propType == 'object' || propType =='array'){
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdf:type', 'rdf:Property')); // Add the property and its label
const newClassName = RDFTools.capitalizeFirstLetter(prop); // Since it is an object/array, we give it a new class as a range
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'sdm:'+newClassName));
depth += 1;
console.log("depth increase",depth);
// properties = ?;
//path = ?;
if (this.termMap.has(prop) == false) {
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdf:type', 'rdf:Property')); // Add the property and its label
const newClassName = RDFTools.capitalizeFirstLetter(prop); // Since it is an object/array, we give it a new class as a range
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'sdm:'+newClassName));
}
depth += 1;
mainJsonObject = JsonProcessor.getJsonObject('sdm:'+ RDFTools.capitalizeFirstLetter(prop));
for (let prop in subProperties){
this.jsonTraverseRecursive(this.writer, depth, this.path, this.mainJsonObject, prop);
this.jsonTraverseRecursive(this.writer, depth, path, mainJsonObject, prop);
}
}
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment