@canonical/design-system 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.gemini/settings.json +14 -0
  2. package/.github/ISSUE_TEMPLATE/propose-changes-to-existing-ui-block.md +14 -0
  3. package/.github/ISSUE_TEMPLATE/propose-new-ui-block.md +26 -0
  4. package/.github/workflows/sync-coda-manual.yml +12 -0
  5. package/.github/workflows/sync-coda-scheduled.yml +13 -0
  6. package/.github/workflows/sync-coda.yml +38 -0
  7. package/.mcp.json +8 -2
  8. package/GEMINI.md +2 -0
  9. package/README.md +71 -51
  10. package/data/apps/component/file_tree.ttl +6 -7
  11. package/data/apps/component/key_value_pair.ttl +6 -7
  12. package/data/apps/component/navigation.ttl +6 -7
  13. package/data/apps/component/notification.ttl +7 -0
  14. package/data/apps/component/skeleton_loading.ttl +6 -7
  15. package/data/apps/component/status_bar.ttl +6 -7
  16. package/data/apps/component/toolbar.ttl +6 -7
  17. package/data/apps/group/notifications.ttl +7 -0
  18. package/data/apps/layout/application_layout.ttl +8 -7
  19. package/data/apps/layout/content_layout.ttl +9 -0
  20. package/data/apps/layout/empty_layout.ttl +6 -7
  21. package/data/apps/layout/list_page_layout.ttl +6 -7
  22. package/data/apps/layout/settings_page_layout.ttl +6 -7
  23. package/data/apps/layout/view_layout.ttl +9 -0
  24. package/data/apps/pattern/code_diff.ttl +6 -7
  25. package/data/apps/pattern/data_table.ttl +6 -7
  26. package/data/apps/pattern/destructive_modal.ttl +6 -7
  27. package/data/apps/pattern/key_value_summary.ttl +6 -7
  28. package/data/apps/pattern/keyboard_shortcuts.ttl +6 -7
  29. package/data/apps/pattern/notification_center.ttl +6 -7
  30. package/data/apps/pattern/side_panel.ttl +6 -7
  31. package/data/apps/pattern/sidepanel_stacked.ttl +6 -7
  32. package/data/apps/subcomponent/file_tree-node.ttl +7 -0
  33. package/data/apps.ttl +3 -4
  34. package/data/apps_anbox/component/copy_to_clipboard.ttl +7 -0
  35. package/data/apps_anbox/pattern/side_menu.ttl +13 -0
  36. package/data/apps_anbox.ttl +4 -0
  37. package/data/apps_juju/pattern/single_select_multi_layered.ttl +7 -0
  38. package/data/apps_juju.ttl +4 -0
  39. package/data/apps_landscape/component/password_constraints.ttl +32 -0
  40. package/data/apps_landscape.ttl +4 -0
  41. package/data/apps_launchpad/component/badge.ttl +22 -0
  42. package/data/apps_launchpad/component/breadcrumbs.ttl +14 -0
  43. package/data/apps_launchpad/component/button.ttl +34 -0
  44. package/data/apps_launchpad/component/checkbox.ttl +28 -0
  45. package/data/apps_launchpad/component/chip.ttl +42 -0
  46. package/data/apps_launchpad/component/combobox.ttl +51 -0
  47. package/data/apps_launchpad/component/description_list.ttl +13 -0
  48. package/data/apps_launchpad/component/radio.ttl +34 -0
  49. package/data/apps_launchpad/component/select.ttl +34 -0
  50. package/data/apps_launchpad/component/switch.ttl +21 -0
  51. package/data/apps_launchpad/component/text_input.ttl +35 -0
  52. package/data/apps_launchpad/component/textarea.ttl +35 -0
  53. package/data/apps_launchpad/component/tooltip.ttl +27 -0
  54. package/data/apps_launchpad/component/user_avatar.ttl +25 -0
  55. package/data/apps_launchpad/subcomponent/combobox-checkbox_option.ttl +29 -0
  56. package/data/apps_launchpad/subcomponent/combobox-footer.ttl +13 -0
  57. package/data/apps_launchpad/subcomponent/combobox-group.ttl +20 -0
  58. package/data/apps_launchpad/subcomponent/combobox-helper.ttl +19 -0
  59. package/data/apps_launchpad/subcomponent/combobox-loading.ttl +13 -0
  60. package/data/apps_launchpad/subcomponent/combobox-no_results.ttl +13 -0
  61. package/data/apps_launchpad/subcomponent/combobox-radio_option.ttl +29 -0
  62. package/data/apps_launchpad/subcomponent/combobox-search.ttl +22 -0
  63. package/data/apps_launchpad/subcomponent/description_list-item.ttl +19 -0
  64. package/data/apps_launchpad.ttl +4 -0
  65. package/data/apps_lxd/component/confirmation_checkbox.ttl +7 -0
  66. package/data/apps_lxd/component/copy_to_clipboard.ttl +7 -0
  67. package/data/apps_lxd/view/network_topology.ttl +7 -0
  68. package/data/apps_lxd.ttl +4 -0
  69. package/data/apps_portal/component/badge.ttl +7 -0
  70. package/data/apps_portal.ttl +4 -0
  71. package/data/apps_workplace/component/label-highlight.ttl +7 -0
  72. package/data/apps_workplace.ttl +4 -0
  73. package/data/apps_wpe.ttl +3 -4
  74. package/data/documentation/layout/documentation_layout.ttl +6 -7
  75. package/data/documentation/pattern/library_side_navigation.ttl +7 -0
  76. package/data/documentation.ttl +3 -4
  77. package/data/global/component/accordion.ttl +11 -12
  78. package/data/global/component/announcement.ttl +6 -7
  79. package/data/global/component/badge.ttl +7 -8
  80. package/data/global/component/breadcrumbs.ttl +13 -0
  81. package/data/global/component/button.ttl +27 -17
  82. package/data/global/component/button_link.ttl +7 -0
  83. package/data/global/component/card.ttl +6 -7
  84. package/data/global/component/chip.ttl +6 -7
  85. package/data/global/component/code.ttl +7 -0
  86. package/data/global/component/code_snippet-content.ttl +7 -0
  87. package/data/global/component/code_snippet-header.ttl +7 -0
  88. package/data/global/component/code_snippet.ttl +6 -7
  89. package/data/global/component/contextual_menu.ttl +6 -7
  90. package/data/global/component/heading.ttl +11 -12
  91. package/data/global/component/icon.ttl +12 -12
  92. package/data/global/component/icon_in_container.ttl +6 -7
  93. package/data/global/component/keyboard_key.ttl +6 -7
  94. package/data/global/component/label.ttl +12 -13
  95. package/data/global/component/notification_inline.ttl +6 -7
  96. package/data/global/component/notification_toast.ttl +6 -7
  97. package/data/global/component/pagination.ttl +6 -7
  98. package/data/global/component/popover.ttl +6 -7
  99. package/data/global/component/rich_text_editor.ttl +6 -7
  100. package/data/global/component/search_bar.ttl +6 -7
  101. package/data/global/component/table.ttl +6 -7
  102. package/data/global/component/tabs.ttl +6 -7
  103. package/data/global/component/theme_switcher.ttl +6 -7
  104. package/data/global/component/tile.ttl +11 -12
  105. package/data/global/component/tooltip.ttl +182 -7
  106. package/data/global/group/buttons.ttl +6 -7
  107. package/data/global/group/cards.ttl +6 -7
  108. package/data/global/group/code_snippets.ttl +7 -0
  109. package/data/global/group/keyboard_keys.ttl +7 -0
  110. package/data/global/group/tiles.ttl +6 -7
  111. package/data/global/layout/error_layout.ttl +6 -7
  112. package/data/global/layout/form_layout.ttl +6 -7
  113. package/data/global/layout/identity_page_form.ttl +6 -7
  114. package/data/global/modifier/alpha.ttl +5 -5
  115. package/data/global/modifier/beta.ttl +5 -5
  116. package/data/global/modifier/caution.ttl +5 -5
  117. package/data/global/modifier/comfortable.ttl +5 -5
  118. package/data/global/modifier/completed.ttl +5 -5
  119. package/data/global/modifier/constructive.ttl +5 -5
  120. package/data/global/modifier/dark.ttl +5 -5
  121. package/data/global/modifier/dense.ttl +5 -5
  122. package/data/global/modifier/destructive.ttl +5 -5
  123. package/data/global/modifier/editable.ttl +5 -5
  124. package/data/global/modifier/elevated.ttl +5 -5
  125. package/data/global/modifier/error.ttl +5 -5
  126. package/data/global/modifier/experimental.ttl +5 -5
  127. package/data/global/modifier/failed.ttl +5 -5
  128. package/data/global/modifier/focused.ttl +5 -5
  129. package/data/global/modifier/highlighted.ttl +5 -5
  130. package/data/global/modifier/in_progress.ttl +5 -5
  131. package/data/global/modifier/information.ttl +5 -5
  132. package/data/global/modifier/light.ttl +5 -5
  133. package/data/global/modifier/loading.ttl +5 -5
  134. package/data/global/modifier/muted.ttl +5 -5
  135. package/data/global/modifier/paper.ttl +5 -5
  136. package/data/global/modifier/planned.ttl +5 -5
  137. package/data/global/modifier/primary.ttl +5 -5
  138. package/data/global/modifier/secondary.ttl +5 -5
  139. package/data/global/modifier/stable.ttl +5 -5
  140. package/data/global/modifier/success.ttl +5 -5
  141. package/data/global/modifier/tertiary.ttl +5 -5
  142. package/data/global/modifier/warning.ttl +5 -5
  143. package/data/global/modifier/wireframe.ttl +5 -5
  144. package/data/global/modifier_family/_color_luminosity.ttl +5 -6
  145. package/data/global/modifier_family/_emphasis.ttl +5 -6
  146. package/data/global/modifier_family/_other.ttl +5 -6
  147. package/data/global/modifier_family/anticipation.ttl +5 -6
  148. package/data/global/modifier_family/criticality.ttl +5 -6
  149. package/data/global/modifier_family/density.ttl +5 -6
  150. package/data/global/modifier_family/importance.ttl +5 -6
  151. package/data/global/modifier_family/lifecycle.ttl +5 -6
  152. package/data/global/modifier_family/release.ttl +5 -6
  153. package/data/global/pattern/dropdown_button.ttl +7 -0
  154. package/data/global/pattern/info_table.ttl +6 -7
  155. package/data/global/pattern/modal.ttl +6 -7
  156. package/data/global/pattern/navigation.ttl +6 -7
  157. package/data/global/pattern/stepper.ttl +6 -7
  158. package/data/global/pattern/table_of_contents.ttl +6 -7
  159. package/data/global/pattern/timeline.ttl +60 -12
  160. package/data/global/subcomponent/accordion-item.ttl +15 -16
  161. package/data/global/subcomponent/breadcrumbs-item.ttl +15 -16
  162. package/data/global/subcomponent/card-content.ttl +11 -12
  163. package/data/global/subcomponent/card-header.ttl +11 -12
  164. package/data/global/subcomponent/card-image.ttl +16 -17
  165. package/data/global/subcomponent/card-thumbnail.ttl +7 -0
  166. package/data/global/subcomponent/divider.ttl +6 -7
  167. package/data/global/subcomponent/modal-content.ttl +6 -7
  168. package/data/global/subcomponent/modal-footer.ttl +6 -7
  169. package/data/global/subcomponent/modal-header.ttl +6 -7
  170. package/data/global/subcomponent/spinner.ttl +6 -7
  171. package/data/global/subcomponent/table-cell.ttl +6 -7
  172. package/data/global/subcomponent/table-row.ttl +6 -7
  173. package/data/global/subcomponent/tile-content.ttl +11 -12
  174. package/data/global/subcomponent/tile-header.ttl +11 -12
  175. package/data/global/subcomponent/timeline-content.ttl +11 -12
  176. package/data/global/subcomponent/timeline-event.ttl +42 -27
  177. package/data/global/subcomponent/timeline-expansion_indicator.ttl +7 -0
  178. package/data/global/subcomponent/timeline-header.ttl +6 -7
  179. package/data/global/view/settings_view.ttl +7 -0
  180. package/data/global.ttl +3 -4
  181. package/data/global_form/component/checkbox_input.ttl +6 -7
  182. package/data/global_form/component/choices_input.ttl +6 -7
  183. package/data/global_form/component/combobox_input.ttl +6 -7
  184. package/data/global_form/component/custom_choices_input.ttl +6 -7
  185. package/data/global_form/component/datepicker_input.ttl +6 -7
  186. package/data/global_form/component/rating_input.ttl +6 -7
  187. package/data/global_form/component/rich_text_input.ttl +7 -0
  188. package/data/global_form/component/segmented_control_input.ttl +6 -7
  189. package/data/global_form/component/slider_input.ttl +6 -7
  190. package/data/global_form/component/switch_input.ttl +6 -7
  191. package/data/global_form/component/text_input.ttl +6 -7
  192. package/data/global_form/component/textarea_input.ttl +6 -7
  193. package/data/global_form/component/wysiwginput.ttl +6 -7
  194. package/data/global_form/pattern/field.ttl +6 -7
  195. package/data/global_form/pattern/form.ttl +6 -7
  196. package/data/global_form/subcomponent/field-description.ttl +6 -7
  197. package/data/global_form/subcomponent/field-label.ttl +6 -7
  198. package/data/global_form.ttl +3 -4
  199. package/data/site/component/blog_card.ttl +7 -0
  200. package/data/site/component/quote.ttl +6 -7
  201. package/data/site/component/rule.ttl +6 -7
  202. package/data/site/component/section.ttl +6 -7
  203. package/data/site/group/blog_cards.ttl +7 -0
  204. package/data/site/layout/blog_page_layout.ttl +7 -0
  205. package/data/site/layout/case_study_layout.ttl +7 -0
  206. package/data/site/layout/site_layout.ttl +6 -7
  207. package/data/site/pattern/hero-github.ttl +6 -7
  208. package/data/site/pattern/hero.ttl +6 -7
  209. package/data/site/pattern/info_table.ttl +6 -7
  210. package/data/site/pattern/pricing_section.ttl +7 -0
  211. package/data/site/pattern/pricing_table.ttl +7 -0
  212. package/data/site/pattern/read_more_section.ttl +7 -0
  213. package/data/site/pattern/skip_link.ttl +6 -7
  214. package/data/site.ttl +3 -4
  215. package/data/sites_webcomponentsprototype/component/blog_cards.ttl +7 -0
  216. package/data/sites_webcomponentsprototype/component/ctablock.ttl +7 -0
  217. package/data/sites_webcomponentsprototype/component/list.ttl +7 -0
  218. package/data/sites_webcomponentsprototype/component/tabs.ttl +7 -0
  219. package/data/sites_webcomponentsprototype/layout/site_layout.ttl +8 -0
  220. package/data/sites_webcomponentsprototype/pattern/basic_section.ttl +7 -0
  221. package/data/sites_webcomponentsprototype/pattern/blog_section.ttl +7 -0
  222. package/data/sites_webcomponentsprototype/pattern/ctasection.ttl +7 -0
  223. package/data/sites_webcomponentsprototype/pattern/equal_heights.ttl +7 -0
  224. package/data/sites_webcomponentsprototype/pattern/hero.ttl +7 -0
  225. package/data/sites_webcomponentsprototype/pattern/logo_section.ttl +7 -0
  226. package/data/sites_webcomponentsprototype/pattern/quote_wrapper.ttl +7 -0
  227. package/data/sites_webcomponentsprototype/pattern/tiered_list.ttl +7 -0
  228. package/data/sites_webcomponentsprototype.ttl +4 -0
  229. package/data/stores.ttl +3 -4
  230. package/definitions/ontology.ttl +39 -25
  231. package/package.json +8 -8
  232. package/skills/anatomy-author/SKILL.md +9 -9
  233. package/skills/component-specifier/SKILL.md +81 -85
  234. package/skills/design-auditor/SKILL.md +45 -45
  235. package/source.json +35 -33
  236. package/src/collect/generateTurtle.tests.ts +21 -38
  237. package/src/commands/transform.ts +27 -3
  238. package/src/config/source.schema.json +9 -0
  239. package/src/config/types.ts +7 -0
  240. package/src/constants.ts +6 -7
  241. package/src/graph/GraphStore.tests.ts +23 -23
  242. package/src/graph/GraphStore.ts +2 -2
  243. package/src/graph/PrefixMap.tests.ts +16 -16
  244. package/src/graph/PrefixMap.ts +1 -1
  245. package/src/graph/buildUri.tests.ts +26 -13
  246. package/src/graph/buildUri.ts +17 -5
  247. package/src/serializers/JSONSerializer.tests.ts +2 -5
  248. package/src/serializers/TTLSerializer.tests.ts +2 -4
  249. package/src/serializers/TTLSerializer.ts +2 -2
  250. package/src/transform/resolveReferences.tests.ts +2 -2
  251. package/src/transform/transform.tests.ts +5 -7
  252. package/src/transform/transform.ts +3 -1
  253. package/src/transform/transformRow.tests.ts +149 -50
  254. package/src/transform/transformRow.ts +27 -3
  255. package/data/global/component/link.ttl +0 -8
  256. package/data/global/pattern/breadcrumbs.ttl +0 -14
  257. package/data/global/pattern/select_button.ttl +0 -8
  258. package/data/global/subcomponent/timeline-footer.ttl +0 -8
  259. package/session/A.DSL.md +0 -429
  260. package/session/B.NOTES.md +0 -84
  261. package/session/global.component.accordion.yaml +0 -13
  262. package/session/global.component.button.yaml +0 -26
  263. package/session/global.component.card.yaml +0 -24
  264. package/session/global.component.icon.yaml +0 -7
  265. package/session/global.component.label.yaml +0 -7
  266. package/session/global.component.tile.yaml +0 -21
  267. package/session/global.component.timeline.yaml +0 -20
  268. package/session/global.pattern.breadcrumbs.yaml +0 -13
  269. package/session/global.subcomponent.accordion-item.yaml +0 -37
  270. package/session/global.subcomponent.breadcrumbs-item.yaml +0 -21
  271. package/session/global.subcomponent.card-content.yaml +0 -7
  272. package/session/global.subcomponent.card-header.yaml +0 -22
  273. package/session/global.subcomponent.card-image.yaml +0 -7
  274. package/session/global.subcomponent.tile-content.yaml +0 -7
  275. package/session/global.subcomponent.tile-header.yaml +0 -8
  276. package/session/global.subcomponent.timeline-content.yaml +0 -13
  277. package/session/global.subcomponent.timeline-event.yaml +0 -20
  278. package/session/global.subcomponent.timeline-footer.yaml +0 -9
  279. package/session/global.subcomponent.timeline-header.yaml +0 -18
@@ -19,7 +19,7 @@ Start with a broad inventory, then drill into specific concerns:
19
19
  sem_readme(package: "design-system")
20
20
  → Get overview of classes and counts
21
21
 
22
- sem_lookup_batch(types: ["dso:Component", "dso:Pattern", "dso:Layout"])
22
+ sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout"])
23
23
  → Get full inventory across types
24
24
 
25
25
  sem_sparql({quality queries})
@@ -45,12 +45,12 @@ What's connected vs. orphaned?
45
45
  ### Coverage: Components by Tier
46
46
 
47
47
  ```sparql
48
- PREFIX dso: <https://ds.canonical.com/ontology#>
48
+ PREFIX ds: <https://ds.canonical.com/>
49
49
 
50
50
  SELECT ?tierName (COUNT(?c) as ?componentCount) WHERE {
51
- ?c a dso:Component ;
52
- dso:tier ?tier .
53
- ?tier dso:name ?tierName .
51
+ ?c a ds:Component ;
52
+ ds:tier ?tier .
53
+ ?tier ds:name ?tierName .
54
54
  } GROUP BY ?tierName
55
55
  ORDER BY DESC(?componentCount)
56
56
  ```
@@ -60,10 +60,10 @@ ORDER BY DESC(?componentCount)
60
60
  ### Coverage: UIBlock Types Distribution
61
61
 
62
62
  ```sparql
63
- PREFIX dso: <https://ds.canonical.com/ontology#>
63
+ PREFIX ds: <https://ds.canonical.com/>
64
64
 
65
65
  SELECT ?type (COUNT(?block) as ?count) WHERE {
66
- VALUES ?type { dso:Component dso:Pattern dso:Layout dso:Subcomponent }
66
+ VALUES ?type { ds:Component ds:Pattern ds:Layout ds:Subcomponent }
67
67
  ?block a ?type .
68
68
  } GROUP BY ?type
69
69
  ```
@@ -73,13 +73,13 @@ SELECT ?type (COUNT(?block) as ?count) WHERE {
73
73
  ### Quality: Components Missing Descriptions
74
74
 
75
75
  ```sparql
76
- PREFIX dso: <https://ds.canonical.com/ontology#>
76
+ PREFIX ds: <https://ds.canonical.com/>
77
77
 
78
78
  SELECT ?component ?name WHERE {
79
- ?component a dso:Component ;
80
- dso:name ?name .
79
+ ?component a ds:Component ;
80
+ ds:name ?name .
81
81
  FILTER(!bound(?desc) || ?desc = "")
82
- OPTIONAL { ?component dso:description ?desc }
82
+ OPTIONAL { ?component ds:summary ?desc }
83
83
  }
84
84
  ```
85
85
 
@@ -88,12 +88,12 @@ SELECT ?component ?name WHERE {
88
88
  ### Quality: Components Missing Usage Guidance
89
89
 
90
90
  ```sparql
91
- PREFIX dso: <https://ds.canonical.com/ontology#>
91
+ PREFIX ds: <https://ds.canonical.com/>
92
92
 
93
93
  SELECT ?component ?name WHERE {
94
- ?component a dso:Component ;
95
- dso:name ?name .
96
- FILTER NOT EXISTS { ?component dso:whenToUse ?when }
94
+ ?component a ds:Component ;
95
+ ds:name ?name .
96
+ FILTER NOT EXISTS { ?component ds:whenToUse ?when }
97
97
  }
98
98
  ```
99
99
 
@@ -102,26 +102,26 @@ SELECT ?component ?name WHERE {
102
102
  ### Quality: Components Missing Guidelines
103
103
 
104
104
  ```sparql
105
- PREFIX dso: <https://ds.canonical.com/ontology#>
105
+ PREFIX ds: <https://ds.canonical.com/>
106
106
 
107
107
  SELECT ?component ?name WHERE {
108
- ?component a dso:Component ;
109
- dso:name ?name .
110
- FILTER NOT EXISTS { ?component dso:guidelines ?g }
108
+ ?component a ds:Component ;
109
+ ds:name ?name .
110
+ FILTER NOT EXISTS { ?component ds:guidelines ?g }
111
111
  }
112
112
  ```
113
113
 
114
114
  ### Consistency: Modifier Family Usage
115
115
 
116
116
  ```sparql
117
- PREFIX dso: <https://ds.canonical.com/ontology#>
117
+ PREFIX ds: <https://ds.canonical.com/>
118
118
 
119
119
  SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
120
- ?family a dso:ModifierFamily ;
121
- dso:name ?familyName .
120
+ ?family a ds:ModifierFamily ;
121
+ ds:name ?familyName .
122
122
  OPTIONAL {
123
- ?component a dso:Component ;
124
- dso:hasModifierFamily ?family .
123
+ ?component a ds:Component ;
124
+ ds:hasModifierFamily ?family .
125
125
  }
126
126
  } GROUP BY ?family ?familyName
127
127
  ORDER BY DESC(?usage)
@@ -132,12 +132,12 @@ ORDER BY DESC(?usage)
132
132
  ### Consistency: Components Without Modifier Families
133
133
 
134
134
  ```sparql
135
- PREFIX dso: <https://ds.canonical.com/ontology#>
135
+ PREFIX ds: <https://ds.canonical.com/>
136
136
 
137
137
  SELECT ?component ?name WHERE {
138
- ?component a dso:Component ;
139
- dso:name ?name .
140
- FILTER NOT EXISTS { ?component dso:hasModifierFamily ?mf }
138
+ ?component a ds:Component ;
139
+ ds:name ?name .
140
+ FILTER NOT EXISTS { ?component ds:hasModifierFamily ?mf }
141
141
  }
142
142
  ```
143
143
 
@@ -146,12 +146,12 @@ SELECT ?component ?name WHERE {
146
146
  ### Usage: Orphaned Subcomponents
147
147
 
148
148
  ```sparql
149
- PREFIX dso: <https://ds.canonical.com/ontology#>
149
+ PREFIX ds: <https://ds.canonical.com/>
150
150
 
151
151
  SELECT ?sub ?name WHERE {
152
- ?sub a dso:Subcomponent ;
153
- dso:name ?name .
154
- FILTER NOT EXISTS { ?sub dso:parentComponent ?parent }
152
+ ?sub a ds:Subcomponent ;
153
+ ds:name ?name .
154
+ FILTER NOT EXISTS { ?sub ds:parentComponent ?parent }
155
155
  }
156
156
  ```
157
157
 
@@ -160,12 +160,12 @@ SELECT ?sub ?name WHERE {
160
160
  ### Usage: Components With Subcomponents
161
161
 
162
162
  ```sparql
163
- PREFIX dso: <https://ds.canonical.com/ontology#>
163
+ PREFIX ds: <https://ds.canonical.com/>
164
164
 
165
165
  SELECT ?component ?componentName (COUNT(?sub) as ?subCount) WHERE {
166
- ?component a dso:Component ;
167
- dso:name ?componentName .
168
- ?sub dso:parentComponent ?component .
166
+ ?component a ds:Component ;
167
+ ds:name ?componentName .
168
+ ?sub ds:parentComponent ?component .
169
169
  } GROUP BY ?component ?componentName
170
170
  ORDER BY DESC(?subCount)
171
171
  ```
@@ -175,21 +175,21 @@ ORDER BY DESC(?subCount)
175
175
  ### Cross-Tier: Potential Promotion Candidates
176
176
 
177
177
  ```sparql
178
- PREFIX dso: <https://ds.canonical.com/ontology#>
178
+ PREFIX ds: <https://ds.canonical.com/>
179
179
 
180
180
  SELECT ?component ?name ?tierName WHERE {
181
- ?component a dso:Component ;
182
- dso:name ?name ;
183
- dso:tier ?tier .
184
- ?tier dso:name ?tierName .
181
+ ?component a ds:Component ;
182
+ ds:name ?name ;
183
+ ds:tier ?tier .
184
+ ?tier ds:name ?tierName .
185
185
 
186
186
  # Find non-global components that might be universal
187
187
  FILTER(?tier != <https://ds.canonical.com/data/global>)
188
188
 
189
189
  # Heuristic: has modifier families (suggests maturity)
190
- FILTER EXISTS { ?component dso:hasModifierFamily ?mf }
191
- FILTER EXISTS { ?component dso:description ?d }
192
- FILTER EXISTS { ?component dso:whenToUse ?w }
190
+ FILTER EXISTS { ?component ds:hasModifierFamily ?mf }
191
+ FILTER EXISTS { ?component ds:summary ?d }
192
+ FILTER EXISTS { ?component ds:whenToUse ?w }
193
193
  }
194
194
  ```
195
195
 
@@ -346,7 +346,7 @@ For comprehensive review:
346
346
 
347
347
  ```
348
348
  1. Inventory
349
- sem_lookup_batch(types: ["dso:Component", "dso:Pattern", "dso:Layout", "dso:Subcomponent"])
349
+ sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout", "ds:Subcomponent"])
350
350
 
351
351
  2. Coverage queries (all)
352
352
 
package/source.json CHANGED
@@ -21,67 +21,69 @@
21
21
  "tables": {
22
22
  "uiBlocks": {
23
23
  "@context": {
24
- "dso": "https://ds.canonical.com/ontology#",
25
- "ds": "https://ds.canonical.com/data/",
26
- "name": "dso:name",
27
- "description": "dso:description",
28
- "anatomy_dsl": "dso:anatomyDsl",
29
- "Anatomy (classic)": "dso:anatomyClassic",
30
- "tier": { "@id": "dso:tier", "@type": "@id" },
24
+ "ds": "https://ds.canonical.com/",
25
+ "name": "ds:name",
26
+ "summary": "ds:summary",
27
+ "anatomy_dsl": "ds:anatomyDsl",
28
+ "Anatomy (classic)": "ds:anatomyClassic",
29
+ "tier": { "@id": "ds:tier", "@type": "@id" },
31
30
  "properties": {
32
- "@id": "dso:hasProperty",
31
+ "@id": "ds:hasProperty",
33
32
  "@inline": {
34
33
  "table": "properties",
35
- "class": "dso:Property",
34
+ "class": "ds:Property",
36
35
  "properties": {
37
- "property name": "dso:name",
38
- "type": "dso:propertyType",
39
- "description": "dso:description",
40
- "optional": "dso:optional",
41
- "default": "dso:defaultValue"
36
+ "property name": "ds:name",
37
+ "type": "ds:propertyType",
38
+ "summary": "ds:summary",
39
+ "optional": "ds:optional",
40
+ "default": "ds:defaultValue"
42
41
  }
43
42
  }
44
43
  },
45
- "modifier_families": { "@id": "dso:hasModifierFamily", "@type": "@id", "@container": "@set" }
44
+ "modifier_families": { "@id": "ds:hasModifierFamily", "@type": "@id", "@container": "@set" }
46
45
  },
47
46
  "class": "{type}",
48
- "uriTemplate": "{uri}"
47
+ "uriTemplate": "{uri}",
48
+ "classProperties": {
49
+ "ds:Layout": {
50
+ "layout_grid_template": "ds:grid",
51
+ "layout_information_domain": "ds:domain"
52
+ }
53
+ }
49
54
  },
50
55
  "tiers": {
51
56
  "@context": {
52
- "dso": "https://ds.canonical.com/ontology#",
53
- "ds": "https://ds.canonical.com/data/",
54
- "name": "dso:name"
57
+ "ds": "https://ds.canonical.com/",
58
+ "name": "ds:name"
55
59
  },
56
- "class": "dso:Tier",
60
+ "class": "ds:Tier",
57
61
  "uriTemplate": "{uri}"
58
62
  },
59
63
  "modifierFamilies": {
60
64
  "@context": {
61
- "dso": "https://ds.canonical.com/ontology#",
62
- "ds": "https://ds.canonical.com/data/",
63
- "name": "dso:name",
64
- "description": "dso:description",
65
- "tier": { "@id": "dso:tier", "@type": "@id" }
65
+ "ds": "https://ds.canonical.com/",
66
+ "name": "ds:name",
67
+ "summary": "ds:summary",
68
+ "tier": { "@id": "ds:tier", "@type": "@id" }
66
69
  },
67
- "class": "dso:ModifierFamily",
70
+ "class": "ds:ModifierFamily",
68
71
  "uriTemplate": "{uri}"
69
72
  },
70
73
  "modifiers": {
71
74
  "@context": {
72
- "dso": "https://ds.canonical.com/ontology#",
73
- "ds": "https://ds.canonical.com/data/",
74
- "name": "dso:name",
75
- "description": "dso:description",
76
- "family": { "@id": "dso:modifierFamily", "@type": "@id" }
75
+ "ds": "https://ds.canonical.com/",
76
+ "name": "ds:name",
77
+ "summary": "ds:summary",
78
+ "family": { "@id": "ds:modifierFamily", "@type": "@id" }
77
79
  },
78
- "class": "dso:Modifier",
80
+ "class": "ds:Modifier",
79
81
  "uriTemplate": "{uri}"
80
82
  }
81
83
  },
82
84
  "references": {
83
85
  "uiBlockTypes": {
84
- "uriTemplate": "dso:{name}",
86
+ "uriTemplate": "ds:{name}",
85
87
  "keyColumn": "name"
86
88
  },
87
89
  "tiers": {
@@ -9,7 +9,7 @@ describe("generateLibraryTurtle", () => {
9
9
  link: "https://github.com/example/test",
10
10
  prefix: {
11
11
  short: "ds",
12
- namespace: "https://ds.canonical.com/data/",
12
+ namespace: "https://ds.canonical.com/",
13
13
  },
14
14
  pattern: "src/**/*.tsx",
15
15
  };
@@ -17,13 +17,12 @@ describe("generateLibraryTurtle", () => {
17
17
  it("should generate valid Turtle for minimal config", async () => {
18
18
  const ttl = await generateLibraryTurtle(minimalConfig);
19
19
 
20
- expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
21
- expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/data/>");
20
+ expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/>");
22
21
  expect(ttl).toContain("ds:implementation.library.test-library");
23
- expect(ttl).toContain("a dso:ImplementationLibrary");
24
- expect(ttl).toContain('dso:libraryName "Test Library"');
25
- expect(ttl).toContain('dso:platform "react"');
26
- expect(ttl).toContain('dso:link "https://github.com/example/test"');
22
+ expect(ttl).toContain("a ds:ImplementationLibrary");
23
+ expect(ttl).toContain('ds:libraryName "Test Library"');
24
+ expect(ttl).toContain('ds:platform "react"');
25
+ expect(ttl).toContain('ds:link "https://github.com/example/test"');
27
26
  });
28
27
 
29
28
  it("should include optional properties when provided", async () => {
@@ -36,9 +35,9 @@ describe("generateLibraryTurtle", () => {
36
35
 
37
36
  const ttl = await generateLibraryTurtle(fullConfig);
38
37
 
39
- expect(ttl).toContain('dso:libraryDescription "A test library"');
40
- expect(ttl).toContain('dso:documentation "https://docs.example.com"');
41
- expect(ttl).toContain("dso:libraryTier ds:global");
38
+ expect(ttl).toContain('ds:libraryDescription "A test library"');
39
+ expect(ttl).toContain('ds:documentation "https://docs.example.com"');
40
+ expect(ttl).toContain("ds:libraryTier ds:global");
42
41
  });
43
42
 
44
43
  it("should slugify library name for URI", async () => {
@@ -52,18 +51,6 @@ describe("generateLibraryTurtle", () => {
52
51
  expect(ttl).toContain("ds:implementation.library.pragma-react-components");
53
52
  });
54
53
 
55
- it("should throw error when using reserved prefix 'dso'", () => {
56
- const config: CollectConfig = {
57
- ...minimalConfig,
58
- prefix: {
59
- short: "dso",
60
- namespace: "https://example.com/data/",
61
- },
62
- };
63
-
64
- expect(() => generateLibraryTurtle(config)).toThrow('Prefix "dso" is reserved');
65
- });
66
-
67
54
  it("should throw error when using reserved prefix 'rdf'", () => {
68
55
  const config: CollectConfig = {
69
56
  ...minimalConfig,
@@ -87,7 +74,6 @@ describe("generateLibraryTurtle", () => {
87
74
 
88
75
  const ttl = await generateLibraryTurtle(config);
89
76
  expect(ttl).toContain("@prefix myprefix: <https://example.com/data/>");
90
- expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
91
77
  });
92
78
  });
93
79
 
@@ -98,7 +84,7 @@ describe("generateObjectsTurtle", () => {
98
84
  link: "https://github.com/example/test",
99
85
  prefix: {
100
86
  short: "ds",
101
- namespace: "https://ds.canonical.com/data/",
87
+ namespace: "https://ds.canonical.com/",
102
88
  },
103
89
  pattern: "src/**/*.tsx",
104
90
  };
@@ -118,13 +104,10 @@ describe("generateObjectsTurtle", () => {
118
104
 
119
105
  const ttl = await generateObjectsTurtle(config, annotations, "/base");
120
106
 
121
- expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
122
- // URI is derived from file path, not block URI
123
- expect(ttl).toContain("ds:implementation.object.test-library.button");
124
- expect(ttl).toContain("a dso:ImplementationObject");
125
- expect(ttl).toContain("dso:library ds:implementation.library.test-library");
126
- expect(ttl).toContain("dso:implementsBlock ds:global.component.button");
127
- expect(ttl).toContain('dso:headLink "src/components/Button.tsx"');
107
+ expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/>");
108
+ expect(ttl).toContain("a ds:ImplementationObject");
109
+ expect(ttl).toContain("ds:implementsBlock ds:global.component.button");
110
+ expect(ttl).toContain('ds:headLink "src/components/Button.tsx"');
128
111
  });
129
112
 
130
113
  it("should include version when provided", async () => {
@@ -138,7 +121,7 @@ describe("generateObjectsTurtle", () => {
138
121
 
139
122
  const ttl = await generateObjectsTurtle(config, annotations, "/base");
140
123
 
141
- expect(ttl).toContain('dso:implementationVersion "1.2.3"');
124
+ expect(ttl).toContain('ds:implementationVersion "1.2.3"');
142
125
  });
143
126
 
144
127
  it("should include isDraft when true", async () => {
@@ -152,7 +135,7 @@ describe("generateObjectsTurtle", () => {
152
135
 
153
136
  const ttl = await generateObjectsTurtle(config, annotations, "/base");
154
137
 
155
- expect(ttl).toContain('dso:isDraft "true"');
138
+ expect(ttl).toContain('ds:isDraft "true"');
156
139
  });
157
140
 
158
141
  it("should generate multiple implementation objects", async () => {
@@ -175,10 +158,10 @@ describe("generateObjectsTurtle", () => {
175
158
 
176
159
  const ttl = await generateObjectsTurtle(config, annotations, "/base");
177
160
 
178
- // URIs are derived from file paths, not block URIs
179
- expect(ttl).toContain("ds:implementation.object.test-library.button");
180
- expect(ttl).toContain("ds:implementation.object.test-library.card");
181
- expect(ttl).toContain("ds:implementation.object.test-library.modal");
161
+ // Check that all annotations are included
162
+ expect(ttl).toContain("ds:global.component.button");
163
+ expect(ttl).toContain("ds:global.component.card");
164
+ expect(ttl).toContain("ds:global.pattern.modal");
182
165
  });
183
166
 
184
167
  it("should use relative paths for headLink", async () => {
@@ -195,6 +178,6 @@ describe("generateObjectsTurtle", () => {
195
178
  "/project/packages/react",
196
179
  );
197
180
 
198
- expect(ttl).toContain('dso:headLink "src/deep/nested/Component.tsx"');
181
+ expect(ttl).toContain('ds:headLink "src/deep/nested/Component.tsx"');
199
182
  });
200
183
  });
@@ -1,4 +1,4 @@
1
- import { readFile, writeFile, mkdir } from "node:fs/promises";
1
+ import { readFile, writeFile, mkdir, rm, readdir } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import type { Config } from "../config/types.js";
4
4
  import transformData from "../transform/transform.js";
@@ -25,12 +25,12 @@ async function loadExtractedData(inputPath: string): Promise<ExtractedData> {
25
25
  * Parse URI into path components for file organization
26
26
  *
27
27
  * Splits dot-separated URI path into folder structure:
28
- * "https://ds.canonical.com/data/global.component.button" -> ["global", "component", "button"]
28
+ * "https://ds.canonical.com/global.component.button" -> ["global", "component", "button"]
29
29
  *
30
30
  * Returns array of path parts, or null if URI doesn't match expected format
31
31
  */
32
32
  function parseUri(uri: string): string[] | null {
33
- const dsNamespace = "https://ds.canonical.com/data/";
33
+ const dsNamespace = "https://ds.canonical.com/";
34
34
 
35
35
  if (!uri.startsWith(dsNamespace)) {
36
36
  return null;
@@ -39,9 +39,32 @@ function parseUri(uri: string): string[] | null {
39
39
  const path = uri.slice(dsNamespace.length);
40
40
  const parts = path.split(".");
41
41
 
42
+ // Reject URIs with empty segments (e.g. double dots from unresolved templates)
43
+ if (parts.some((p) => p === "")) {
44
+ return null;
45
+ }
46
+
42
47
  return parts.length > 0 ? parts : null;
43
48
  }
44
49
 
50
+ /**
51
+ * Remove all generated RDF files from the output directory tree.
52
+ * Called before writing new output to avoid stale files accumulating.
53
+ */
54
+ async function cleanOutputDir(outputDir: string, ext: string): Promise<void> {
55
+ let entries: Awaited<ReturnType<typeof readdir>>;
56
+ try {
57
+ entries = await readdir(outputDir, { withFileTypes: true, recursive: true });
58
+ } catch {
59
+ return; // Directory doesn't exist yet
60
+ }
61
+ await Promise.all(
62
+ entries
63
+ .filter((e) => e.isFile() && e.name.endsWith(`.${ext}`))
64
+ .map((e) => rm(join(e.parentPath ?? e.path, e.name), { force: true })),
65
+ );
66
+ }
67
+
45
68
  /**
46
69
  * Transforms extracted data into RDF and serializes to files
47
70
  */
@@ -62,6 +85,7 @@ export default async function transform(config: Config): Promise<void> {
62
85
  const ext = isTurtle ? "ttl" : "jsonld";
63
86
 
64
87
  await mkdir(config.transform.outputDir, { recursive: true });
88
+ await cleanOutputDir(config.transform.outputDir, ext);
65
89
 
66
90
  if (config.transform.atomicity === "class") {
67
91
  // One file per table - serialize all subjects together
@@ -89,6 +89,15 @@
89
89
  "uriTemplate": {
90
90
  "type": "string",
91
91
  "description": "URI template with {ColumnName} placeholders"
92
+ },
93
+ "classProperties": {
94
+ "type": "object",
95
+ "additionalProperties": {
96
+ "type": "object",
97
+ "additionalProperties": { "type": "string" },
98
+ "description": "Column→predicate literal mappings for this class"
99
+ },
100
+ "description": "Additional literal column→predicate mappings applied only when the resolved class matches the key (prefixed form, e.g. 'ds:Layout')"
92
101
  }
93
102
  }
94
103
  },
@@ -56,6 +56,13 @@ export interface TableTransform {
56
56
  "@context": JsonLdContext;
57
57
  class: string;
58
58
  uriTemplate: string;
59
+ /**
60
+ * Additional literal column→predicate mappings applied only when the
61
+ * resolved RDF class matches the key (prefixed form, e.g. "ds:Layout").
62
+ * Values in the inner map are `{ columnName: predicate }` pairs and are
63
+ * treated as plain string literals (same semantics as a bare string in @context).
64
+ */
65
+ classProperties?: Record<string, Record<string, string>>;
59
66
  }
60
67
 
61
68
  /**
package/src/constants.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  * RDF namespace URIs used throughout the application
3
3
  */
4
4
  export const NAMESPACES = {
5
- ds: "https://ds.canonical.com/data/",
6
- dso: "https://ds.canonical.com/ontology#",
5
+ ds: "https://ds.canonical.com/",
7
6
  rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
8
7
  } as const;
9
8
 
@@ -12,9 +11,9 @@ export const NAMESPACES = {
12
11
  */
13
12
  export const PREDICATES = {
14
13
  type: `${NAMESPACES.rdf}type`,
15
- name: `${NAMESPACES.dso}name`,
16
- description: `${NAMESPACES.dso}description`,
17
- tier: `${NAMESPACES.dso}tier`,
18
- properties: `${NAMESPACES.dso}properties`,
19
- hasModifierFamily: `${NAMESPACES.dso}hasModifierFamily`,
14
+ name: `${NAMESPACES.ds}name`,
15
+ summary: `${NAMESPACES.ds}summary`,
16
+ tier: `${NAMESPACES.ds}tier`,
17
+ properties: `${NAMESPACES.ds}properties`,
18
+ hasModifierFamily: `${NAMESPACES.ds}hasModifierFamily`,
20
19
  } as const;