-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa66c7a
commit 856f913
Showing
3 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using IriTools; | ||
|
||
namespace Boundaries; | ||
|
||
public static class DexpiApi{ | ||
public static async Task<string> GetCommissioningPackage(string internalComponentLabel, IriReference[] borderComponentIris, string dexpiFilePath) | ||
{ | ||
var datalogCreator = new DatalogCreator(); | ||
var datalog = datalogCreator.CreateBoundaryDatalogRule(internalComponentLabel, borderComponentIris); | ||
var conn = RdfoxApi.GetDefaultConnectionSettings(); | ||
await RdfoxApi.LoadDatalog(conn, datalog); | ||
|
||
var data = File.ReadAllText(dexpiFilePath); | ||
await RdfoxApi.LoadData(conn, data); | ||
|
||
var queryString = datalogCreator.CreateCommissioningSparqlQuery(); | ||
var result = await RdfoxApi.QuerySparql(conn, queryString); | ||
|
||
await RdfoxApi.DeleteData(conn, data); | ||
await RdfoxApi.DeleteDatalog(conn, datalog); | ||
return result; | ||
} | ||
|
||
|
||
public static async Task<string> GetConnectedEquipment(string internalComponentLabel, string dexpiFilePath) | ||
{ | ||
var datalogCreator = new DatalogCreator(); | ||
var datalog = datalogCreator.CreateConnectedDatalogRule(internalComponentLabel); | ||
var conn = RdfoxApi.GetDefaultConnectionSettings(); | ||
await RdfoxApi.LoadDatalog(conn, datalog); | ||
|
||
var data = File.ReadAllText(dexpiFilePath); | ||
await RdfoxApi.LoadData(conn, data); | ||
|
||
var queryString = datalogCreator.CreateConnectedSparqlQuery(); | ||
var result = await RdfoxApi.QuerySparql(conn, queryString); | ||
|
||
await RdfoxApi.DeleteData(conn, data); | ||
await RdfoxApi.DeleteDatalog(conn, datalog); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters