Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped 0.7.0-preview

Prefix Reserved
This is a prerelease version of Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped.
dotnet add package Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped --version 0.7.0-preview                
NuGet\Install-Package Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped -Version 0.7.0-preview                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped" Version="0.7.0-preview" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped --version 0.7.0-preview                
#r "nuget: Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped, 0.7.0-preview"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped as a Cake Addin
#addin nuget:?package=Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped&version=0.7.0-preview&prerelease

// Install Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped as a Cake Tool
#tool nuget:?package=Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped&version=0.7.0-preview&prerelease                

IngestionManager.Mapped

This library works in conjunction with and depends on the Microsoft.SmartPlaces.Facilities.IngestionManager library, that defines interfaces and a generic implementation for ingesting building data graphs into Azure Digital Twins.

Setup

This library provides IInputGraphManager and IGraphIngestionProcessor implementations and a subclass of IngestionManagerOptions that together allow solutions to ingest graphs from the Mapped API.

Those implementations are wired up using the .Net dependency injection framework, as per the common design pattern:

services.AddMappedIngestionManager(options =>
    {
        // Mapped Specific
        options.MappedToken = hostContext.Configuration["MappedToken"];
        options.MappedRootUrl = hostContext.Configuration["MappedRootUrl"];

        // Ingestion Manager
        options.AzureDigitalTwinsEndpoint = hostContext.Configuration["AzureDigitalTwinsEndpoint"];
    });

The above sets up singleton implementations such that any code depending on IInputGraphManager will call MappedGraphManager, and code depending on IGraphIngestionProcessor will call MappedGraphIngestionProcessor.

Note that for ontology mappings to be resolved correctly, you may also want to wire up an ontology mapper instance:

services.AddLogging();

services.AddSingleton<IOntologyMappingLoader>(sp =>
{
    var logger = sp.GetRequiredService<ILogger<MappedOntologyMappingLoader>>();
    return new MappedOntologyMappingLoader(logger, hostContext.Configuration["ontologyMappingFilename"]);
});

services.AddSingleton<IOntologyMappingManager, OntologyMappingManager>();

Usage

The entry point to using these libraries is the base class IngestionProcessorBase.IngestFromApiAsync() method; that method in turn calls the MappedGraphIngestionProcessor.ProcessSites() method, which initiates ingestion of all sites (e.g., campuses/buildings or other suitable starting nodes) from the input graph.

ProcessSites() calls out to an input graph manager to actually query the source graph for those starting nodes, and iterates over child nodes returned by said graph manager. As wired up above, that input graph manager will be our own MappedGraphManager, which knows how to talk to the Mapped API.

The MappedGraphManager is configured (e.g., for access credentials) using the options passed in to the services.AddMappedIngestionManager() call shown under Setup above.

So, assuming the Dependency Injection setup as given above, ingestion from Mapped to Azure Digital Twins is achieved in a class where the MappedGraphIngestionProcessor has been injected, as follows:

logger.LogInformation("Starting to ingest topology");
await mappedProcessor.IngestFromApiAsync(cancellationToken);
logger.LogInformation("Topology ingestion completed");
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.0-preview 237 2/2/2024
0.6.14-preview 105 6/26/2023
0.6.13-preview 94 6/16/2023
0.6.12-preview 88 6/15/2023
0.6.3-preview 211 5/4/2023
0.5.0-preview 428 2/17/2023
0.4.15-preview 175 1/5/2023
0.4.14-preview 96 12/8/2022
0.4.13-preview 172 12/2/2022
0.4.12-preview 97 11/30/2022
0.4.11-preview 103 11/29/2022
0.4.2-preview 102 11/8/2022
0.4.1-preview 195 11/4/2022
0.4.0-preview 130 11/3/2022
0.3.8-preview 127 11/1/2022
0.3.7-preview 105 10/31/2022
0.3.6-preview 155 10/27/2022
0.3.5-preview 97 10/26/2022
0.3.1-preview 115 10/20/2022
0.3.0-preview 147 10/17/2022
0.2.0-preview 149 10/15/2022
0.1.1-preview 170 10/13/2022
0.1.0-preview 142 10/13/2022