annotation / stam

Stand-off Text Annotation Model (STAM) is a data model for stand-off-text annotation where any information on a text is represented as an annotation. This repository contains the model's full specification, extensions, schemas, examples and documentation.
https://annotation.github.io/stam/
Creative Commons Attribution Share Alike 4.0 International
17 stars 2 forks source link

Allow annotation stores to include/depend on other annotation stores (stand-off STAM JSON files) #29

Closed proycon closed 2 months ago

proycon commented 3 months ago

Currently an annotation store in STAM JSON can reference annotation datasets and resources in separate stand-off files. What is not yet possible, however, is to reference annotations defined in other STAM JSON annotation stores.

This use-case was raised in #21 by @tenzin3, see the lead up discussion there.

In such a case, an annotation in store_a.store.stam.json makes reference (via an annotation selector) to an annotation defined in store_b.store.stam.json. That is currently not possible. I do think it is a fair use case and more flexibility in using stand-off files fits nicely with STAM's stand-off philosophy.

This issue proposes to expand the STAM model to allow this:

Possible syntax for this:

{
    "@type":"AnnotationStore",
    "@include": [ "store_b.stam.store.json", "store_c.stam.store.json" ],
    ...
}
proycon commented 2 months ago

@tenzin3 @ngawangtrinley This has now been implemented (in stam-rust 0.15.0, stam-tools 0.8.0, stam-python 0.9.0). The @include mechanism is extended to allow including other annotation stores as dependencies. The STAM JSON specification here explains how this works.

The implementation should still be considered a bit experimental though, as it hasn't yet been thoroughly tested in real use cases like yours, so it's possible that some bugs may still surface or that some more API methods are desired.

When creating multiple annotation stores that have dependencies, it is recommended to first create the dependencies independently, and then later include them from the 'superstore' using this new method: https://stam-python.readthedocs.io/en/latest/autoapi/stam/index.html#stam.AnnotationStore.add_substore .

tenzin3 commented 1 month ago

@proycon. Thank you for implementing this feature so quickly. We will test this out and get back to you if we are facing any issues .