Skip to content

Commit

Permalink
Merge pull request #226 from Spyderisk/225-error-when-selecting-an-in…
Browse files Browse the repository at this point in the history
…ferred-asset-in-the-gui

#225: Modify query to make core:PaletteType optional, so that inferre…
  • Loading branch information
kenmeacham authored Dec 17, 2024
2 parents 95b8e02 + 835db9b commit 96b8aaf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1207,16 +1207,17 @@ public List<Map<String, String>> getPaletteAssets(String domainURI) {
" ?c rdfs:subClassOf+ core:Asset .\n" +
" ?asset rdfs:subClassOf* ?c .\n" +
" ?asset rdfs:label ?al .\n" +
" ?asset rdfs:subClassOf* ?category .\n" +
" ?category rdfs:subClassOf core:PaletteType .\n" +
" ?category rdfs:label ?cl .\n" +
" OPTIONAL {\n" +
" ?asset rdfs:subClassOf* ?category .\n" +
" ?category rdfs:subClassOf core:PaletteType .\n" +
" ?category rdfs:label ?cl .\n" +
" }\n" +
" OPTIONAL { ?asset rdfs:comment ?description }\n" +
" OPTIONAL { ?asset core:isAssertable ?assertable }\n" +
" OPTIONAL { ?asset core:minCardinality ?minCardinality }\n" +
" OPTIONAL { ?asset core:maxCardinality ?maxCardinality }\n" +
" BIND(IF(BOUND(?assertable),STR(?assertable),\"false\") AS ?a)\n" +
" FILTER(!isBlank(?asset))\n" +
" FILTER(!isBlank(?category))\n" +
"} GROUP BY ?asset ?al ?category ?cl ?description ?a ?minCardinality ?maxCardinality ORDER BY ?type ?asset";

AStoreWrapper store = storeManager.getStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ private void getAssets() {

assets.forEach((asset) -> {
if (asset != null){
String cl = asset.get("cl"); //category label
String category = cl != null ? cl : "";

palettebuilder.startObject();
palettebuilder.key("id").value(asset.get("asset"));
palettebuilder.key("label").value(asset.get("al"));
palettebuilder.key("category").value(asset.get("cl")); //category label
palettebuilder.key("category").value(category);
palettebuilder.key("assertable").value(Boolean.valueOf(asset.get("a")));

String type = asset.get("type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ public void testGenerateReport() {
" \"system#8667a66c\": {\n" +
" \"label\": \"D\",\n" +
" \"type\": \"domain#D\",\n" +
" \"typeLabel\": \"D\",\n" +
" \"controls\": [\n" +
" \"system#CS-Patching-29a92ee6\"\n" +
" ],\n" +
Expand All @@ -764,6 +765,7 @@ public void testGenerateReport() {
" \"system#65518fe1\": {\n" +
" \"label\": \"B\",\n" +
" \"type\": \"domain#B\",\n" +
" \"typeLabel\": \"B\",\n" +
" \"controls\": [\n" +
" \"system#CS-Patching-22e54aba\"\n" +
" ],\n" +
Expand All @@ -780,6 +782,7 @@ public void testGenerateReport() {
" \"system#E_29a92ee6\": {\n" +
" \"label\": \"E-D\",\n" +
" \"type\": \"domain#E\",\n" +
" \"typeLabel\": \"E\",\n" +
" \"controls\": [],\n" +
" \"misbehaviours\": [\n" +
" \"system#MS-Broken-553889e2\",\n" +
Expand Down

0 comments on commit 96b8aaf

Please sign in to comment.