Commit 5846bca1 authored by Andrei Popescu's avatar Andrei Popescu
Browse files

improved and cleaned

parent 659c0b8e
Pipeline #54884 passed with stage
in 22 seconds
......@@ -16,99 +16,94 @@
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
sdm:refDevice rdf:type rdf:Property;
rdfs:range sdm:RefDevice.
rdfs:range sdm:RefDevice;
rdfs:label "Relationship. Device(s) used to obtain the measurement."@en.
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.
rdfs:range sdm:RefTargetDevice;
rdfs:label "Relationship. Device(s) for which the measurement was taken."@en.
sdm:totalActiveEnergyImport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilowatt hour (kWh)'. Total energy imported i.e. consumed since metering started (since `dateEnergyMeteringStarted`)."@en.
sdm:totalReactiveEnergyImport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilovolt-ampere-reactive-hour (kVArh)'. Total energy imported i.e. consumed (with regards to fundamental frequency reactive power) since the metering start date (`dateEnergyMeteringStarted`)"@en.
sdm:totalApparentEnergyImport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilovolt-ampere-hour (kVAh)'. Total energy imported i.e. consumed (with regards to apparent power) since the metering start date (`dateEnergyMeteringStarted`)"@en.
sdm:totalActiveEnergyExport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilowatt hour (kWh)'. Total energy exported since metering started (since `dateEnergyMeteringStarted`)."@en.
sdm:totalReactiveEnergyExport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilovolt-ampere-reactive-hour (kVArh)'. Total fundamental frequency reactive energy exported since metering started (since `dateEnergyMeteringStarted`)."@en.
sdm:totalApparentEnergyExport rdfs:range xsd:integer;
rdfs:label "Property. Model:'https://schema.org/Number'. Units:'kilovolt-ampere-reactive-hour (kVArh)'. Total energy exported (with regards to apparent power) since the metering start date (`dateEnergyMeteringStarted`)"@en.
sdm:frequency rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'Hertz (Hz)'. The frequency of the circuit."@en.
sdm:totalActivePower rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'watt (W)'. Active power consumed (counting all phases)"@en.
sdm:totalReactivePower rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'volt-ampere-reactive (VAr)'. Reactive power consumed (counting all phases)"@en.
sdm:totalApparentPower rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'volt-ampere (VA)'. Apparent power consumed (counting all phases)."@en.
sdm:activeEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ActiveEnergyImport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ActiveEnergyImport;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilowatt hour (kWh)'. Active energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:L1 rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilowatt hour (kWh)'. Active energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:L2 rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilowatt hour (kWh)'. Active energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:L3 rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilowatt hour (kWh)'. Active energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:reactiveEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ReactiveEnergyImport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ReactiveEnergyImport;
rdfs:label "Property. Model:'kilovolt-ampere-reactive-hour (kVArh)'. Units:'http://schema.org/StructuredValue'. Fundamental frequency reactive energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:apparentEnergyImport rdf:type rdf:Property;
rdfs:range sdm:ApparentEnergyImport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ApparentEnergyImport;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilovolt-ampere-hour (kVAh)'. Apparent energy imported i.e. consumed per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:activeEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ActiveEnergyExport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ActiveEnergyExport;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilowatt hour (kWh)'. Active energy exported per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:reactiveEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ReactiveEnergyExport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ReactiveEnergyExport;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilovolt-ampere-reactive-hour (kVArh)'. Fundamental frequency reactive energy exported per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:apparentEnergyExport rdf:type rdf:Property;
rdfs:range sdm:ApparentEnergyExport.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ApparentEnergyExport;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'kilovolt-ampere-hour (kVAh)'. Apparent energy exported per phase since the metering start date. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:activePower rdf:type rdf:Property;
rdfs:range sdm:ActivePower.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ActivePower;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'watt (W)'.Active power consumed per phase. The actual values will beconveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3. "@en.
sdm:reactivePower rdf:type rdf:Property;
rdfs:range sdm:ReactivePower.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ReactivePower;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'volts-ampere-reactive (VAr)'. Fundamental frequency reactive power. The actual values will be conveyed by subproperties whose names will be equal to the name of each of the alternating current phases: L1, L2, L3."@en.
sdm:apparentPower rdf:type rdf:Property;
rdfs:range sdm:ApparentPower.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:totalPowerFactor rdfs:range xsd:integer.
rdfs:range sdm:ApparentPower;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'volt-ampere (VA)'. Apparent power consumed per phase. The actual values will be conveyed by subproperties which names will be equal to the name of each of the alternating current phases: L1, L2, L3"@en.
sdm:totalPowerFactor rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'-1 to +1'. Power factor including all phases"@en.
sdm:powerFactor rdf:type rdf:Property;
rdfs:range sdm:PowerFactor.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:totalDisplacementPowerFactor rdfs:range xsd:integer.
rdfs:range sdm:PowerFactor;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'-1 to +1'. Power factor for each phase. The actual values will be conveyed by one subproperty per alternating current phase: L1, L2 and L3"@en.
sdm:totalDisplacementPowerFactor rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/Number'. Units:'-1 to +1'. Displacement power factor including all phases. The quantity is based on the fundamental frequency of the system"@en.
sdm:displacementPowerFactor rdf:type rdf:Property;
rdfs:range sdm:DisplacementPowerFactor.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:DisplacementPowerFactor;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'-1 to +1'. Displacement power factor for each phase. The quantity is based on the fundamental frequency of the system. The actual values will be conveyed by one subproperty per alternating current phase: L1, L2 and L3"@en.
sdm:current rdf:type rdf:Property;
rdfs:range sdm:Current.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
sdm:N rdfs:range xsd:integer.
rdfs:range sdm:Current;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'Ampers (A)'. Electrical current. The actual values will be conveyed by one subproperty per alternating current phase and the neutral wire: L1, L2, L3 and N."@en.
sdm:N rdfs:range xsd:integer;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'Ampers (A)'. Electrical current. The actual values will be conveyed by one subproperty per alternating current phase and the neutral wire: L1, L2, L3 and N."@en.
sdm:phaseVoltage rdf:type rdf:Property;
rdfs:range sdm:PhaseVoltage.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:PhaseVoltage;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'Volts (V)'. The voltage between each phase and neutral conductor. The actual values will be conveyed by one subproperty per alternating current phase: L1, L2 and L3"@en.
sdm:phaseToPhaseVoltage rdf:type rdf:Property;
rdfs:range sdm:PhaseToPhaseVoltage.
sdm:L12 rdfs:range xsd:integer.
sdm:L23 rdfs:range xsd:integer.
sdm:L31 rdfs:range xsd:integer.
rdfs:range sdm:PhaseToPhaseVoltage;
rdfs:label "Property. Model:'(http://schema.org/StructuredValue'. Units:'Volts (V)'. Voltage between phases. A value for each phase pair: phases 1 and 2 (L12), phases 2 and 3 (L32), phases 3 and 1 (L31)."@en.
sdm:L12 rdfs:range xsd:integer;
rdfs:label "Property. Model:'(http://schema.org/StructuredValue'. Units:'Volts (V)'. Voltage between phases. A value for each phase pair: phases 1 and 2 (L12), phases 2 and 3 (L32), phases 3 and 1 (L31)."@en.
sdm:L23 rdfs:range xsd:integer;
rdfs:label "Property. Model:'(http://schema.org/StructuredValue'. Units:'Volts (V)'. Voltage between phases. A value for each phase pair: phases 1 and 2 (L12), phases 2 and 3 (L32), phases 3 and 1 (L31)."@en.
sdm:L31 rdfs:range xsd:integer;
rdfs:label "Property. Model:'(http://schema.org/StructuredValue'. Units:'Volts (V)'. Voltage between phases. A value for each phase pair: phases 1 and 2 (L12), phases 2 and 3 (L32), phases 3 and 1 (L31)."@en.
sdm:thdVoltage rdf:type rdf:Property;
rdfs:range sdm:ThdVoltage.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ThdVoltage;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'0 to 1'. Total harmonic distortion of voltage for each phase. The actual values will be conveyed by one subproperty per alternating current phase: L1, L2 and L3"@en.
sdm:thdCurrent rdf:type rdf:Property;
rdfs:range sdm:ThdCurrent.
sdm:L1 rdfs:range xsd:integer.
sdm:L2 rdfs:range xsd:integer.
sdm:L3 rdfs:range xsd:integer.
rdfs:range sdm:ThdCurrent;
rdfs:label "Property. Model:'http://schema.org/StructuredValue'. Units:'0 to 1'. Total harmonic distortion of electrical current. The actual values will be conveyed by one subproperty per alternating current phase: L1, L2 and L3"@en.
......@@ -113,11 +113,12 @@ var JsonProcessor = /** @class */ (function () {
var propType;
var subProperties;
var propDescription;
var directEnum;
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;
directEnum = path[2].properties[prop]["enum"];
//let subSubProperties = path[2].properties[prop].properties;
//let subSubItems = path[2].properties[prop].items;
}
......@@ -130,7 +131,7 @@ var JsonProcessor = /** @class */ (function () {
console.log("proptype", propType);
subProperties = tmpPath.properties;
propDescription = tmpPath.description;
//let directEnum = path.properties[prop].enum;
directEnum = tmpPath.properties[prop]["enum"];
//let subSubProperties = path.properties[prop].properties;
//let subItems = path.properties[prop].items;
}
......@@ -140,22 +141,50 @@ var JsonProcessor = /** @class */ (function () {
}
if (propType == 'number') {
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:' + prop);
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'xsd:integer'));
if (propDescription != undefined) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_literal('sdm:' + prop, 'rdfs:label', propDescription.toString()));
}
}
return;
}
if (propType == 'boolean') {
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:' + prop);
this.writer.addQuad(rdfTools_1.RDFTools.node_node_node('sdm:' + prop, 'rdfs:range', 'xsd:boolean'));
if (propDescription != undefined) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_literal('sdm:' + prop, 'rdfs:label', propDescription.toString()));
}
}
return;
}
// Recursive step
if (propType == 'object' || propType == 'array') {
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:' + prop);
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 (propDescription != undefined) {
this.writer.addQuad(rdfTools_1.RDFTools.node_node_literal('sdm:' + prop, 'rdfs:label', propDescription.toString()));
}
if (directEnum != undefined) {
var oneOfValues = [];
for (var _i = 0, directEnum_1 = directEnum; _i < directEnum_1.length; _i++) {
var value = directEnum_1[_i];
//We get the values from the mapping, else we create new terms
if (this.termMap.get(value) != undefined) {
oneOfValues.push(namedNode(this.termMap.get(value)));
}
else {
oneOfValues.push(namedNode(value));
}
}
console.log("this is the list of values", oneOfValues);
var subPropQuad = rdfTools_1.RDFTools.node_node_list('sdm:' + newClassName, 'owl:oneOf', this.writer.list(oneOfValues));
this.writer.addQuad(subPropQuad);
}
}
depth += 1;
mainJsonObject = JsonProcessor.getJsonObject('sdm:' + rdfTools_1.RDFTools.capitalizeFirstLetter(prop));
......
import { RDFTools } from "./rdfTools";
import { NamedNode } from "n3/lib/N3DataFactory";
const N3 = require('n3');
const { DataFactory } = N3;
......@@ -39,91 +41,8 @@ export class JsonProcessor {
this.properties = this.path[2].properties; // Path to the properties of the main object
}
static callParseJsonRecursive(){
let hiddenClasses:any[] = [];
let depth = 0;
this.parseJsonRecursive(this.writer, depth, this.path, this.mainJsonObject, this.properties);
//path ?
return // these will be modified
}
static parseJsonRecursive (writer, depth, path, mainJsonObject, properties){
console.log("in method");
if (depth > 2){ // base case
console.log("depth > 1");
return;
}
else{
for (const prop in properties){
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);
propType = tmpPath.type;
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 (this.termMap.has(prop)){
console.log("prop in map", prop);
// DO nothin;
}
else{
console.log("not in map prop:", prop);
// Base cases
// if(pattern4):
// this.writer.addQuad(RDFTools.node_node_node('sdm:'+term, 'rdf:type', 'rdf:Property')); // Add the property and its label
// return;
// Recursive calls
console.log(propType);
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 = ?;
mainJsonObject = JsonProcessor.getJsonObject('sdm:'+ RDFTools.capitalizeFirstLetter(prop));
// Recursive call if we are dealing with an object or an array, which have nested properties
return;
// return here?
}
}
console.log("exit if");
}
}
return;
}
static callJsonTraverseRecursive(){
let depth = 0;
for (let prop in this.properties){
this.mainJsonObject = JsonProcessor.getJsonObject('sdm:'+ RDFTools.capitalizeFirstLetter(prop));
......@@ -132,7 +51,6 @@ export class JsonProcessor {
return;
}
static jsonTraverseRecursive (writer, depth, path, mainJsonObject, prop){
// We only deal to depths <= 1; the following setups take care of that.
......@@ -140,11 +58,12 @@ export class JsonProcessor {
let propType;
let subProperties;
let propDescription;
let directEnum;
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;
directEnum = path[2].properties[prop].enum;
//let subSubProperties = path[2].properties[prop].properties;
//let subSubItems = path[2].properties[prop].items;
}
......@@ -158,7 +77,7 @@ export class JsonProcessor {
console.log("proptype", propType);
subProperties = tmpPath.properties;
propDescription = tmpPath.description;
//let directEnum = path.properties[prop].enum;
directEnum = tmpPath.properties[prop].enum;
//let subSubProperties = path.properties[prop].properties;
//let subItems = path.properties[prop].items;
}
......@@ -171,13 +90,21 @@ export class JsonProcessor {
if (propType == 'number'){
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:'+prop);
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'xsd:integer'));
if(propDescription != undefined ){
this.writer.addQuad(RDFTools.node_node_literal('sdm:'+prop, 'rdfs:label', propDescription.toString()));
}
}
return;
}
if (propType == 'boolean'){
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:'+prop);
this.writer.addQuad(RDFTools.node_node_node('sdm:'+prop, 'rdfs:range', 'xsd:boolean'));
if(propDescription != undefined ){
this.writer.addQuad(RDFTools.node_node_literal('sdm:'+prop, 'rdfs:label', propDescription.toString()));
}
}
return;
}
......@@ -185,9 +112,30 @@ export class JsonProcessor {
// Recursive step
if(propType == 'object' || propType =='array'){
if (this.termMap.has(prop) == false) {
this.termMap.set(prop, 'sdm:'+prop);
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));
if(propDescription != undefined ){
this.writer.addQuad(RDFTools.node_node_literal('sdm:'+prop, 'rdfs:label', propDescription.toString()));
}
if (directEnum != undefined){
let oneOfValues:NamedNode[] = [];
for (const value of directEnum){
//We get the values from the mapping, else we create new terms
if (this.termMap.get(value)!= undefined) {
oneOfValues.push(namedNode(this.termMap.get(value)));
}
else{
oneOfValues.push(namedNode(value));
}
}
console.log("this is the list of values", oneOfValues);
let subPropQuad = RDFTools.node_node_list('sdm:'+newClassName, 'owl:oneOf', this.writer.list(oneOfValues));
this.writer.addQuad(subPropQuad);
}
}
depth += 1;
mainJsonObject = JsonProcessor.getJsonObject('sdm:'+ RDFTools.capitalizeFirstLetter(prop));
......
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