Skip to main content

Module revisions

Module revisions 

Source
Expand description

Change tracking for data shared by all documents.

Most derived data belongs to one document and is recomputed when that document’s triples change (Changed<Triples>). Some data is shared: ontologies loaded in the background, the class hierarchy, SHACL shapes, configured sources. It usually arrives after the documents that use it were opened, and a change to it can affect every open document.

Revisions counts changes to each kind of shared data:

  • producers bump a counter when (and only when) their data changed,
  • consumers remember the revision they last processed in a Local<Seen>; when it moved they process every open document, otherwise only documents whose own triples changed.
ⓘ
fn consumer(
    docs: Query<(Ref<Triples>, …), With<Open>>,
    revisions: Res<Revisions>,
    mut seen: Local<Seen>,
) {
    let all = seen.update(revisions.shapes);
    for (triples, …) in &docs {
        if !all && !triples.is_changed() { continue; }
        …
    }
}

Structs§

Revisions
Revision counters of data shared by all documents. See the module docs.
Seen
The revision a consumer last processed. Use as Local<Seen>, one per counter the system depends on.