dasch-swiss / knora-ui

Reusable GUI elements for Knora
https://dasch-swiss.github.io/knora-ui
7 stars 1 forks source link

We have to create a generic ReadResource object #247

Closed kilchenmann closed 4 years ago

kilchenmann commented 5 years ago

At the moment we get a resource object back from resource service together with the convert-jsonld and the ontology-cache-service:

Screenshot 2019-06-11 at 11 09 09

The array of resources — because it’s always a sequence — contains a property called "stillImageRepresentationsToDisplay". Not generic enough for me. There are missing properties along the incomingRegions, incomingStillImageRepresentation and stillImageRepresentationToDisplay, like incomingSequences, incomingMovingImageRepresentation, incomingAudioRepresentation, incomingTextRepresentation or incomingDocumentRepresentation but also movingImageRepresentationToDisplay, audioRepresentationToDisplay, documentRepresentationToDisplay, textRepresentationToDisplay etc. This will "explode" the resource object and at the end it’s hard to filter or to use in an html template. We have to find a solution to create a more generic, but compact resource object

export class ReadResource {
    constructor (
        public readonly id: string,
        public readonly type: string,
        public readonly label: string,
        public incomingAnnotations: Array<Resource>,
        public incomingFileRepresentations: Array<Resource>,
        public incomingLinks: Array<ReadResource>,
        public fileRepresentationsToDisplay: Array<FileRepresentation>,
        public readonly properties?: ReadProperties) {
    }
}
flavens commented 5 years ago

@knora/viewer: resource viewer

kilchenmann commented 5 years ago

The ReadStillImageFileValue is defined in the read-property-item. Not sure if it's the right place.

A resource that has a file value (property) must belong to one of the subclass of kb:Representation

(s. https://docs.knora.org/paradox/02-knora-ontologies/knora-base.html#representations)

So, it's a representation with the following subclasses?

tobiasschweizer commented 5 years ago

I would like to discuss this in the context of the library that communicates with the Knora API that @andreas-aeschlimann is currently working on. In some cases, it it is necessary to do more than one call to the API in order to obtain all the information, e.g., when dealing with a compound resource that has parts pointing to it or a still image resource with regions.

A working prototype of this functionality is currently implemented in https://github.com/dhlab-basel/beol/blob/develop/src/app/resource/beol-resource.ts

ReadResource is populated in steps: after a full resource request more and more information is queried and attached to the resource like stillImageRepresentationsToDisplay. This happens asynchronously, so Angular components have to deal with partial information.

Also we have to think about a class model so that we can support creation of resources and adding and modifying properties.

tobiasschweizer commented 5 years ago

@kilchenmann @flavens Please see https://github.com/dhlab-basel/knora-api-js-lib/issues/5