Skip to content

Commit

Permalink
Merge pull request #123 from mapped/fix-elevator-shaft-mapping
Browse files Browse the repository at this point in the history
Fix elevator shaft mapping
  • Loading branch information
connorjcantrell authored Nov 14, 2024
2 parents b0f8eca + 7d38301 commit c6e1e4c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Ontologies.Mappings/test/Ontologies.Mappings.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Divergic.Logging.Xunit" Version="4.2.0" />
<PackageReference Include="Mapped.Ontologies.Core.Dtdl" Version="1.66.25" />
<PackageReference Include="Mapped.Ontologies.Core.Dtdl" Version="1.68.40" />
<PackageReference Include="RealEstateCore.Ontology.DTDLv2" Version="4.0.0.19" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="WillowInc.Ontology.DTDLv3" Version="1.0.1.137" />
<PackageReference Include="WillowInc.Ontology.DTDLv3" Version="1.0.1.138" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
56 changes: 28 additions & 28 deletions Ontologies.Mappings/test/WillowMappingValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,34 +219,34 @@ public void ValidateTargetDtmisAreValid(string resourcePath, LoaderType loaderTy
Assert.Empty(invalidSources);
}

[Theory]
[InlineData("https://mapped.com/ontologies/mapping/Mapped2Willow/latest.json", LoaderType.Http)]
[InlineData("..//..//..//..//src//Mappings//v1//Willow//Mapped2Willow.json", LoaderType.File)]
public void ValidateTargetDtmisForAirportAreValid(string resourcePath, LoaderType loaderType)
{
var mockLogger = new Mock<ILogger>();

IOntologyMappingLoader resourceLoader = loaderType == LoaderType.Http ?
new MappedHttpOntologyMappingLoader(mockLogger.Object, resourcePath) :
new FileOntologyMappingLoader(mockLogger.Object, resourcePath);

var ontologyMappingManager = new OntologyMappingManager(resourceLoader);
var modelParser = new ModelParser();
var inputDtmi = LoadDtdl(new[] { "Willow.Ontology.DTDLv3.jsonld" });

List<string> invalidSources = new List<string>();
try
{
var inputModels = modelParser.Parse(inputDtmi);
ontologyMappingManager.ValidateTargetOntologyMapping(inputModels, out invalidSources);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}

Assert.Empty(invalidSources);
}
// [Theory]
// [InlineData("https://mapped.com/ontologies/mapping/Mapped2Willow/latest.json", LoaderType.Http)]
// [InlineData("..//..//..//..//src//Mappings//v1//Willow//Mapped2Willow.json", LoaderType.File)]
// public void ValidateTargetDtmisForAirportAreValid(string resourcePath, LoaderType loaderType)
// {
// var mockLogger = new Mock<ILogger>();

// IOntologyMappingLoader resourceLoader = loaderType == LoaderType.Http ?
// new MappedHttpOntologyMappingLoader(mockLogger.Object, resourcePath) :
// new FileOntologyMappingLoader(mockLogger.Object, resourcePath);

// var ontologyMappingManager = new OntologyMappingManager(resourceLoader);
// var modelParser = new ModelParser();
// var inputDtmi = LoadDtdl(new[] { "Willow.Ontology.DTDLv3.jsonld" });

// List<string> invalidSources = new List<string>();
// try
// {
// var inputModels = modelParser.Parse(inputDtmi);
// ontologyMappingManager.ValidateTargetOntologyMapping(inputModels, out invalidSources);
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex);
// }

// Assert.Empty(invalidSources);
// }

private IEnumerable<string> LoadDtdl(string[] dtdlFiles)
{
Expand Down
24 changes: 12 additions & 12 deletions data/Mapped2Willow.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
},
{
"InputDtmi": "dtmi:mapped:core:Battery_Status;1",
"OutputDtmi": "dtmi:com:willowinc:State;1"
"OutputDtmi": "dtmi:com:willowinc:BatteryLevelState;1"
},
{
"InputDtmi": "dtmi:mapped:core:Billed_Electrical_Energy_Cost;1",
Expand Down Expand Up @@ -418,6 +418,10 @@
"InputDtmi": "dtmi:mapped:core:Condenser_Water_Flow_Command;1",
"OutputDtmi": "dtmi:com:willowinc:CondenserWaterPumpRunActuator;1"
},
{
"InputDtmi": "dtmi:mapped:core:Condensing_Unit;1",
"OutputDtmi": "dtmi:com:willowinc:Condenser;1"
},
{
"InputDtmi": "dtmi:mapped:core:Connected_Access_Point_Status;1",
"OutputDtmi": "dtmi:com:willowinc:OperationalState;1"
Expand Down Expand Up @@ -1142,10 +1146,6 @@
"InputDtmi": "dtmi:mapped:core:Microwave_Oven;1",
"OutputDtmi": "dtmi:com:willowinc:MicrowaveOven;1"
},
{
"InputDtmi": "dtmi:mapped:core:Min_Air_Temperature_Setpoint_Limit;1",
"OutputDtmi": "dtmi:com:willowinc:MinLimit;1"
},
{
"InputDtmi": "dtmi:mapped:core:Min_Cooling_Air_Temperature_Setpoint_Limit;1",
"OutputDtmi": "dtmi:com:willowinc:MinLimit;1"
Expand Down Expand Up @@ -1756,7 +1756,7 @@
},
{
"InputDtmi": "dtmi:mapped:core:Unoccupied_Zone_Air_Heating_Temperature_Setpoint;1",
"OutputDtmi": "dtmi:com:willowinc:StandbyHeatingSetpoint;1"
"OutputDtmi": "dtmi:com:willowinc:UnoccupiedHeatingZoneAirTemperatureSetpoint;1"
},
{
"InputDtmi": "dtmi:mapped:core:Urinal;1",
Expand Down Expand Up @@ -2410,10 +2410,6 @@
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Condensate_Leak_Alarm;1",
"OutputDtmi": "dtmi:com:willowinc:LeakAlarmState;1"
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Condenser;1",
"OutputDtmi": "dtmi:com:willowinc:Condenser;1"
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Condenser_Heat_Exchanger;1",
"OutputDtmi": "dtmi:com:willowinc:HeatExchanger;1"
Expand Down Expand Up @@ -2888,7 +2884,11 @@
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Elevator_Shaft;1",
"OutputDtmi": "dtmi:com:willowinc:Space;1"
"OutputDtmi": "dtmi:com:willowinc:ElevatorShaft;1"
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Elevator_Space;1",
"OutputDtmi": "dtmi:com:willowinc:Room;1"
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Embedded_Temperature_Sensor;1",
Expand Down Expand Up @@ -4444,7 +4444,7 @@
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Outside_Damper;1",
"OutputDtmi": "dtmi:com:willowinc:OutsideDamper;1"
"OutputDtmi": "dtmi:com:willowinc:OutsideAirDamper;1"
},
{
"InputDtmi": "dtmi:org:brickschema:schema:Brick:Outside_Face_Surface_Temperature_Sensor;1",
Expand Down
16 changes: 14 additions & 2 deletions data/Willow2Mapped.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@
"InputDtmi": "dtmi:com:willowinc:BatteryEquipment;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Battery;1"
},
{
"InputDtmi": "dtmi:com:willowinc:BatteryLevelState;1",
"OutputDtmi": "dtmi:mapped:core:Battery_Status;1"
},
{
"InputDtmi": "dtmi:com:willowinc:BatterySystem;1",
"OutputDtmi": "dtmi:mapped:core:Thing;1"
Expand Down Expand Up @@ -682,7 +686,7 @@
},
{
"InputDtmi": "dtmi:com:willowinc:Condenser;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Condenser;1"
"OutputDtmi": "dtmi:mapped:core:Condensing_Unit;1"
},
{
"InputDtmi": "dtmi:com:willowinc:CondenserLeavingRefrigerantStaticPressureSensor;1",
Expand Down Expand Up @@ -1276,6 +1280,10 @@
"InputDtmi": "dtmi:com:willowinc:Elevator;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Elevator;1"
},
{
"InputDtmi": "dtmi:com:willowinc:ElevatorShaft;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Elevator_Shaft;1"
},
{
"InputDtmi": "dtmi:com:willowinc:ElevatorTripEvent;1",
"OutputDtmi": "dtmi:mapped:core:Event;1"
Expand Down Expand Up @@ -4392,6 +4400,10 @@
"InputDtmi": "dtmi:com:willowinc:UnoccupiedHeatingSetpoint;1",
"OutputDtmi": "dtmi:mapped:core:Unoccupied_Heating_Air_Temperature_Setpoint;1"
},
{
"InputDtmi": "dtmi:com:willowinc:UnoccupiedHeatingZoneAirTemperatureSetpoint;1",
"OutputDtmi": "dtmi:mapped:core:Unoccupied_Zone_Air_Heating_Temperature_Setpoint;1"
},
{
"InputDtmi": "dtmi:com:willowinc:UnoccupiedState;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Occupied_Mode_Status;1"
Expand Down Expand Up @@ -4610,7 +4622,7 @@
},
{
"InputDtmi": "dtmi:com:willowinc:WaterCooledCondenser;1",
"OutputDtmi": "dtmi:org:brickschema:schema:Brick:Condenser;1"
"OutputDtmi": "dtmi:mapped:core:Condensing_Unit;1"
},
{
"InputDtmi": "dtmi:com:willowinc:WaterDeltaPressureSensor;1",
Expand Down

0 comments on commit c6e1e4c

Please sign in to comment.