dlcs / elucidate-server

A W3C and OA compliant Web Annotation server
https://dlcs.info/features.html
MIT License
51 stars 15 forks source link

Composite search scenarios #111

Open scossu opened 3 years ago

scossu commented 3 years ago

I am considering using Elucidate to store image analysis annotations (not IIIF related), e.g. from color palette extraction processes.

A couple of limitations I have come across so far are related to how I would search for these annotations once stored (or before they are stored, to know if they exist already).

Given the following sample annotation that defines two palette sets extracted from a single image:

{
        "@context": "http://www.w3.org/ns/anno.jsonld",
        "id": "https://dummy.getty.edu/anno/my-palette-01",
        "type": "Annotation",
        "body": [
             {
                 "type": "TextualBody",
                 "format": "application/json",
                 "value": "<JSON data>",
                 "purpose": "https://data.getty.edu/local/thesaurus/purposes/low_contrast_palette"
            },
            {
                 "type": "TextualBody",
                 "format": "application/json",
                 "value": "<JSON data>",
                 "purpose": "https://data.getty.edu/local/thesaurus/purposes/high_contrast_palette"
            }
        ],
        "target": "https://media.getty.edu/iiif/image/77902e8c-f844-4956-8f56-186aa2f59e05",
        "motivation": "https://data.getty.edu/local/thesaurus/motivations/image_analysis#histogram"
    }

I would like to:

From what I read form the documentation, I can only search by either target or motivation, not by both. For my specific purpose I got around this limitation by crafting the URI myself based on these two parameters and using PUT to create or replace the resource; but that wouldn't work if I wanted to back out from overwriting.

Mathmos seems to be more oriented at IIIF Search API compatibility, which is focused on free-text content search, while Elucidate seems to have more semantic/structural querying capabilities. Is this something that either one can support (from this latest assumption, I would guess Elucidate would be the more appropriate place)?

danielgrant commented 3 years ago

Hi @scossu,

In terms of what you'd like to do, Elucidate already supports searching by the id or source value of a target field, however you are correct that it doesn't support searching against motivation, and doesn't support searching for purpose within the body field.

So this would involve:

Does that sound right? If so, would you like us to put together an estimate for implementing these enhancements?

Cheers, Daniel.

scossu commented 3 years ago

Thanks for the breakdown @danielgrant . I would generalize the fourth point as: "adding support for querying annotations using multiple criteria in any combination". I understand that might be more cumbersome and possibly even require changing the API request structure, but it would be greatly more comprehensive.

danielgrant commented 3 years ago

Hi @scossu, I appreciate what you're saying r.e. the fourth point. My concern here is less about changing the API request structure, but more around the implications for the underlying code and, in particular, the database interaction. This part of Elucidate is unfortunately quite clunky, so enhancing point four further to allow for any arbitrary combination of supported search fields to be applied to a single search would likely require more effort, if not a complete rethink of how we approach this currently.

If desired I can take this away and get a feel for the effort to implement all four points, with separate estimations for effort for a targeted target and motivation search, and searching using multiple criteria in any combination.

Let me know what you think.

scossu commented 3 years ago

That would be terrific, thanks. Unfortunately I have no Java expertise and cannot help with hands-on coding, but any other way I can help, e.g. with DB design I'd be glad to.