Skip to content

Commit 2bbf846

Browse files
committed
feat(annotations): Clarified and cleaned up IndexItem and GroupKey annotations
1 parent 1a09921 commit 2bbf846

4 files changed

Lines changed: 392 additions & 52 deletions

File tree

TODO.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@
204204
- [ ] do not check generated *.js files in for example apps, rather make sure we run the build_runner before deployment
205205
- [ ] BUGFIX: generated crdt merge mapping files like packages/locorda/example/minimal/lib/src/generated/mapping_bootstrap.g.dart contain a rule for `mc:predicate <vocab#id> ; ca:mergeWith ca:LWW_Register` - but where does this id thing come from? Why is it not excluded like other excluded fields are? Are we missing some more exclusions here, which are done in the RDF mapper vocabulary generator?
206206
- [ ] GroupIndexData.rootResourceFetchPolicy currently cannot be filled via annotation - in generated code it is always the default. We should be able to control this via @GroupKey
207+
- [x] `@GroupKey` and `@IndexItem` annotations must not be using .define() - semantically we do not define our own types here, it is a view. So they should only use the "external" mechanism
208+
- [ ] Use rdf_terms_generator on generated vocabulary. This way, `@GroupKey` and `@IndexItem` should be easier to use because they could use MyVocab.myProperty. It sort of means to use a vocabularies.json like this
209+
```
210+
{
211+
"vocabularies": {
212+
"chatEssence": {
213+
"type": "package",
214+
"namespace": "https://locorda.dev/chat-essence/vocabulary/chat-essence#",
215+
"source": "package:chat_browser_f/vocab.g.ttl",
216+
"generate": true
217+
}
218+
}
219+
}
220+
```
221+
but the problem is, that vocab.g.ttl is generated - we would need to ensure that the terms generator runs *after* the vocabulary generator, but most importantly that it materializes the vocab.g.ttl file first!
207222
- [ ] URGENT FIXME: `test_cases/dataset/02_foreign_shard_discovery/04_default_installation_sync/Shard` zeigt, dass das recipe in allen 3 shard datasets ist - allerdings mit 3 verschiedenen states !?!? das darf eigentlich nicht sein, wir hätten da auf einen State konvergieren müssen!
208223

209224
## Future Feature Ideas

packages/locorda/example/personal_notes_app/lib/models/note_group_key.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import 'package:locorda/annotations.dart';
22
import 'package:locorda_rdf_terms_schema/schema.dart';
3-
import 'package:personal_notes_app/consts.dart';
43

54
import 'note.dart';
65

76
@GroupKey(
8-
appVocab,
97
Note,
108
groupingProperties: [
119
GroupingProperty(
@@ -18,7 +16,6 @@ import 'note.dart';
1816
],
1917
),
2018
],
21-
subClassOf: SchemaNoteDigitalDocument.classIri,
2219
)
2320
class NoteGroupKey {
2421
@RdfProperty(SchemaNoteDigitalDocument.dateCreated)

packages/locorda/example/personal_notes_app/lib/models/note_index_entry.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
library;
77

88
import 'package:locorda/annotations.dart';
9-
import 'package:personal_notes_app/consts.dart';
9+
import 'package:locorda_rdf_terms_schema/schema.dart';
1010
import 'package:personal_notes_app/models/note.dart';
1111
import 'package:personal_notes_app/models/note_group_key.dart';
12-
import 'package:locorda_rdf_terms_schema/schema.dart';
1312

1413
/// Lightweight index entry for Note resources.
1514
///
@@ -18,8 +17,10 @@ import 'package:locorda_rdf_terms_schema/schema.dart';
1817
/// on-demand sync scenarios.
1918
///
2019
/// No CRDT annotations needed for index entries, would be ignored anyways.
21-
@IndexItem.groupIndex(appVocab, NoteGroupKey, IndexItemIriStrategy(Note),
22-
subClassOf: SchemaNoteDigitalDocument.classIri)
20+
@IndexItem.groupIndex(
21+
NoteGroupKey,
22+
IndexItemIriStrategy(Note),
23+
)
2324
class NoteIndexEntry {
2425
/// Unique identifier for the note
2526
@RdfIriPart()

0 commit comments

Comments
 (0)