Skip to content

Commit

Permalink
#225: Modify query to make core:PaletteType optional, so that inferre…
Browse files Browse the repository at this point in the history
…d assets can also be included in the palette. Remove filtering out of blank category. Fix getAssets to check for null values.
  • Loading branch information
kenmeacham committed Dec 13, 2024
1 parent c534b41 commit f34d6e8
Show file tree
Hide file tree
Showing 2 changed files with 9 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

0 comments on commit f34d6e8

Please sign in to comment.