Introduce data field as the main property on which to get/set other properties #4

Merged
jsheunis merged 2 commits from events into main 2026-02-04 08:50:05 +00:00
jsheunis commented 2025-03-16 11:22:09 +00:00 (Migrated from github.com)

This is in response to the process of trying to turn class instances into reactive objects. Since this library is a core dependency of shacl-vue which uses Vuejs, and since this library is independent of Vuejs, an external package should be able to take shacl-tulip's exports and make them reactive. It has been a challenging process to figure out how to do this generally. Refer to https://github.com/psychoinformatics-de/shacl-vue/issues/84.

So the current best solution that I could find is to introduce a data argument, which defaults to an empty object, to the RdfDataset class and to set this as the value of this.data in the class constructor. This allows external libraries to pass a reactive object (e.g. reactive({}); importantly NOT a ref()) to the constructor, and afterward the reactive object will be accessible on the data property of the class instance. All data-related properties get moved to be properties of the data property and methods remain where they are. Additionally, tests were updated to reflect this change.

This is in response to the process of trying to turn class instances into reactive objects. Since this library is a core dependency of `shacl-vue` which uses Vuejs, and since this library is independent of Vuejs, an external package should be able to take `shacl-tulip`'s exports and make them reactive. It has been a challenging process to figure out how to do this generally. Refer to https://github.com/psychoinformatics-de/shacl-vue/issues/84. So the current best solution that I could find is to introduce a `data` argument, which defaults to an empty object, to the `RdfDataset` class and to set this as the value of `this.data` in the class constructor. This allows external libraries to pass a `reactive` object (e.g. `reactive({})`; importantly NOT a `ref()`) to the constructor, and afterward the reactive object will be accessible on the `data` property of the class instance. All data-related properties get moved to be properties of the `data` property and methods remain where they are. Additionally, tests were updated to reflect this change.
Sign in to join this conversation.
No description provided.