Microsoft.SmartPlaces.Facilities.IngestionManager 0.6.1-preview

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Microsoft.SmartPlaces.Facilities.IngestionManager.
dotnet add package Microsoft.SmartPlaces.Facilities.IngestionManager --version 0.6.1-preview
NuGet\Install-Package Microsoft.SmartPlaces.Facilities.IngestionManager -Version 0.6.1-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" Version="0.6.1-preview" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SmartPlaces.Facilities.IngestionManager --version 0.6.1-preview
#r "nuget: Microsoft.SmartPlaces.Facilities.IngestionManager, 0.6.1-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 as a Cake Addin
#addin nuget:?package=Microsoft.SmartPlaces.Facilities.IngestionManager&version=0.6.1-preview&prerelease

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

IngestionManager

This library, intended to work in conjunction with and depending on the Microsoft.SmartPlaces.Facilities.OntologyMapper library, provides interfaces and a partial implementation for ingesting existing building data graphs into Azure Digital Twins, populating the latter with twins and relationships sourced from the former.

How to use

In order to use this library, you need to create at minimum two classes:

  • A subclass of IngestionProcessorBase (implementing IGraphIngestionProcessor)
  • An implementation of IInputGraphManager

The IngestionProcessorBase subclass must provide an implementation of the abstract method ProcessSites(). That method should initiate ingestion of all sites (e.g., campuses/buildings or other suitable starting nodes) from the input graph, traverse them and their child nodes (buildings, floors, rooms, etc), translating them as necessary, and storing them in the output Azure Digital Twins graph.

In order to aid in this process, the IngestionProcessorBase class references implementations of IInputGraphManager and IOutputGraphManager that you may use to interact with the input and output graphs, respectively. An Azure Digital Twins-specific implementation of the latter is provided for you in AzureDigitalTwinsGraphManager, but you will need to create the former, adapted to whatever data source you are ingesting from.

Additionally, in order to reconcile any ontological differences between source and target graph, the IngestionProcessorBase provides convenience methods for mapping terms from the input to terms in the output (e.g., DTDL Interfaces, Relationships, etc.). These methods require that an implementation of IOntologyMappingManager from the aforementioned OntologyMapper library, loaded with a set of mappings between the used ontologies, be passed into to the IngestionProcessorBase constructor.

Example

For an example of an implementation using this library, including the creation of those above-mentioned required implementations, see the Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped package, which is built specifically to ingest graphs from the Mapped API.

The classes provided by this library are intended to be easily wired up using .Net Dependency Injection, and a ServiceCollection extension method AddIngestionManager() is provided for that express purpose. We recommend that any implementations that you build extend upon this design pattern, and use your own ServiceCollection extension method, which you use to wire up your IInputGraphManager and IGraphIngestionProcessor before then calling out to our extension method that wires up the IOutputGraphManager. This is exactly what the Mapped library does, i.e.:

public static IServiceCollection AddMappedIngestionManager(this IServiceCollection services, Action<MappedIngestionManagerOptions> options)
    {
        services.AddOptions<MappedIngestionManagerOptions>()
                .Configure(options)
                .ValidateDataAnnotations()
                .ValidateOnStart();

        services.AddSingleton<IInputGraphManager, MappedGraphManager>();
        services.AddSingleton<IGraphIngestionProcessor, MappedGraphIngestionProcessor<MappedIngestionManagerOptions>>();

        services.AddIngestionManager(options);

        return services;
    }

Deployment configuration

Once you have implemented IngestionProcessorBase and IInputGraphManager, and a ServiceCollection extension method to wire them up as described above, you are ready to use that extension method and your graph ingestion solution in a real system.

Start by running that extension method to inject all the required interface implementations. Continuing with the Mapped library example, your configuration might look like this:

services.AddLogging();

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

services.AddSingleton<IOntologyMappingManager, OntologyMappingManager>();

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

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

If all is configured correctly, your code referring to IGraphIngestionProcessor should inject your custom IngestionProcessorBase subclass, on which you can call the inherited method IngestFromApiAsync(). That method will initialise the base processor, and then immediately call your customized ProcessSites() method, kicking off the rest of the ingestion process.

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 (1)

Showing the top 1 NuGet packages that depend on Microsoft.SmartPlaces.Facilities.IngestionManager:

Package Downloads
Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Support for converting from a Mapped DTDL-based Ontology to a different DTDL Based Ontology

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.1-preview 65 2/2/2024
0.6.0-preview 273 1/31/2024
0.5.14-preview 90 7/18/2023
0.5.5-preview 593 6/16/2023
0.5.3-preview 118 6/14/2023
0.4.2-preview 252 5/4/2023
0.4.0-preview 477 2/17/2023
0.3.12-preview 528 12/12/2022
0.3.11-preview 173 12/8/2022
0.3.10-preview 186 12/2/2022
0.3.9-preview 139 11/30/2022
0.3.8-preview 181 11/12/2022
0.2.2-preview 93 11/8/2022
0.2.1-preview 223 11/4/2022
0.2.0-preview 90 11/3/2022
0.1.8-preview 152 11/1/2022
0.1.7-preview 98 10/31/2022
0.1.6-preview 167 10/26/2022
0.1.3-preview 111 10/20/2022
0.1.2-preview 205 10/19/2022
0.1.1-preview 167 10/13/2022
0.1.0-preview 171 10/13/2022