-
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.
Merge pull request #9 from equinor/story/173985-find-boundary-from-types
find boundary from types
- Loading branch information
Showing
9 changed files
with
110 additions
and
25 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
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,13 @@ | ||
prefix data: <https://assetid.equinor.com/plantx/document/12345#> | ||
|
||
|
||
data:connectedEquipment [?node] :- | ||
rdfs:label [?internal, "P4712"], | ||
imf:connectedTo [?internal, ?node], | ||
dexpi:PipingOrEquipment [?node]. | ||
|
||
data:connectedEquipment [?node] :- | ||
data:connectedEquipment [?node1], | ||
imf:connectedTo [?node1, ?node], | ||
dexpi:PipingOrEquipment [?node], | ||
NOT dexpi:Equipment [?node1]. |
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
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,9 @@ | ||
boundaries.rdfox | ||
|
||
import ../datalog/surrounding.datalog | ||
import +p "../rml/pandid.trig" | ||
|
||
endpoint start | ||
|
||
set output out | ||
select * where {?s a data:connectedEquipment; <http://sandbox.dexpi.org/rdl/TagNameAssignmentClass> ?tag.} |
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