Microsoft.SmartPlaces.Facilities.IngestionManager
0.6.3-preview
Prefix Reserved
dotnet add package Microsoft.SmartPlaces.Facilities.IngestionManager --version 0.6.3-preview
NuGet\Install-Package Microsoft.SmartPlaces.Facilities.IngestionManager -Version 0.6.3-preview
<PackageReference Include="Microsoft.SmartPlaces.Facilities.IngestionManager" Version="0.6.3-preview" />
paket add Microsoft.SmartPlaces.Facilities.IngestionManager --version 0.6.3-preview
#r "nuget: Microsoft.SmartPlaces.Facilities.IngestionManager, 0.6.3-preview"
// Install Microsoft.SmartPlaces.Facilities.IngestionManager as a Cake Addin #addin nuget:?package=Microsoft.SmartPlaces.Facilities.IngestionManager&version=0.6.3-preview&prerelease // Install Microsoft.SmartPlaces.Facilities.IngestionManager as a Cake Tool #tool nuget:?package=Microsoft.SmartPlaces.Facilities.IngestionManager&version=0.6.3-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
(implementingIGraphIngestionProcessor
) - 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 | Versions 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. |
-
net6.0
- Azure.Core (>= 1.42.0)
- Azure.DigitalTwins.Core (>= 1.4.0)
- Azure.Identity (>= 1.12.0)
- DTDLParser (>= 1.0.52)
- Microsoft.ApplicationInsights (>= 2.22.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.8)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 8.0.0)
- Microsoft.Net.Http.Headers (>= 2.2.8)
- Microsoft.SmartPlaces.Facilities.OntologyMapper (>= 0.8.2-preview)
- Polly (>= 8.4.1)
- StackExchange.Redis (>= 2.8.12)
- System.Text.Json (>= 8.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Microsoft.SmartPlaces.Facilities.IngestionManager:
Package | Downloads |
---|---|
Microsoft.SmartPlaces.Facilities.IngestionManager.Mapped
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.3-preview | 58 | 9/5/2024 |
0.6.2-preview | 85 | 9/4/2024 |
0.6.1-preview | 112 | 2/2/2024 |
0.6.0-preview | 632 | 1/31/2024 |
0.5.14-preview | 102 | 7/18/2023 |
0.5.5-preview | 606 | 6/16/2023 |
0.5.3-preview | 127 | 6/14/2023 |
0.4.2-preview | 260 | 5/4/2023 |
0.4.0-preview | 486 | 2/17/2023 |
0.3.12-preview | 538 | 12/12/2022 |
0.3.11-preview | 185 | 12/8/2022 |
0.3.10-preview | 199 | 12/2/2022 |
0.3.9-preview | 151 | 11/30/2022 |
0.3.8-preview | 192 | 11/12/2022 |
0.2.2-preview | 105 | 11/8/2022 |
0.2.1-preview | 237 | 11/4/2022 |
0.2.0-preview | 102 | 11/3/2022 |
0.1.8-preview | 170 | 11/1/2022 |
0.1.7-preview | 111 | 10/31/2022 |
0.1.6-preview | 184 | 10/26/2022 |
0.1.3-preview | 125 | 10/20/2022 |
0.1.2-preview | 223 | 10/19/2022 |
0.1.1-preview | 183 | 10/13/2022 |
0.1.0-preview | 189 | 10/13/2022 |