Class Store

  • Direct Known Subclasses:
    Store

    public class Store
    extends Store
    Endpoints starting /api/edit/store/… provide an HTTP-based API for access to GraphStore functions. This includes all requests supported by Store.

    The endpoints documented here only work for POST HTTP requests and return a JSON response with the same standard envelope structure:

    title
    (string) The title of the LaBB-CAT instance.
    version
    (string) The version of the LaBB-CAT instance
    code
    (int) 0 if the request was successful, 1 if there was a problem
    messages
    An array of message strings.
    errors
    An array of error message strings.
    model
    The result of the request, which may be a JSON object, JSON array, or a simple type.

    e.g. the response to http://localhost:8080/labbcat/api/edit/store/deleteTranscript might be:

    {
        "title":"Store",
        "version":"20230403.1833",
        "code":0,
        "errors":[],
        "messages":[
            "Transcript deleted: test.trs"
        ],
        "model":null
    }

    If the Accept-Language request header is set, the server will endeavor to localize messages to the specified language.

    User authorization for password-protected instances of LaBB-CAT uses the 'Basic' HTTP authentication scheme. This involves sending an Authorization request header of the form Basic TTTTTTTT, where TTTTTTTT is an authentication token formed by base64-encoding a string of the form username:password

    • /api/edit/store/createAnnotation

      Creates an annotation starting at from and ending at to.
      Parameters:
      id - The ID of the transcript.
      fromId - The start anchor's ID.
      toId - The end anchor's ID.
      layerId - The layer ID of the resulting annotation.
      label - The label of the resulting annotation.
      confidence - The confidence rating.
      parentId - The new annotation's parent's ID.
      Returns:
      The ID of the new annotation.
    • /api/edit/store/destroyAnnotation

      Destroys the annotation with the given ID.
      Parameters:
      id - The ID of the transcript.
      annotationId - The annotation's ID.
    • /api/edit/store/saveParticipant

      Saves a participant, and all its tags, to the database.

      If the participant ID does not already exist in the database, a new participant record is created.

      Parameters:
      id - The ID of the participant.
      label - The new ID of the participant, if it's changing.
      A series of parameters whose names are prefixed "participant_", representing the participant attribute values.
      _password - An optional parameter for specifying a new pass phrase for the participant.
      Returns:
      A JSON representation of the new participant record, structured as an Annotation.
    • /api/edit/store/saveTranscript

      Saved changes to transcript attributes to the database.
      Body:
      JSON-encoded representation of the transcript's annotation graph, including only transcript attribute layers.
    • /api/edit/store/deleteMatchingAnnotations

      void deleteMatchingAnnotations​(String expression)
       throws StoreException,
       PermissionException,
       
      Deletes all annotations that match a particular pattern.
      Parameters:
      expression - An expression that determines which annotations match.

      The expression language is loosely based on JavaScript; expressions such as the following can be used:

      • layer.id == 'pronunciation' && first('orthography').label == 'the'
      • first('language').label == 'en' && layer.id == 'pronunciation' && first('orthography').label == 'the'

      NB all expressions must match by either id or layer.id.

      Returns:
      The number of new annotations deleted.
    • /api/edit/store/tagMatchingAnnotations

      void tagMatchingAnnotations​(String expression, String layerId, String label, Integer confidence)
       throws StoreException,
       PermissionException,
       
      Identifies a list of annotations that match a particular pattern, and tags them on the given layer with the given label. If the specified layer ID does not allow peers, all existing tags will be deleted. Otherwise, tagging does not affect any existing tags on the matching annotations.
      Parameters:
      expression - An expression that determines which annotations match.

      The expression language is loosely based on JavaScript; expressions such as the following can be used:

      • layer.id == 'orthography' && label == 'word'
      • first('language').label == 'en' && layer.id == 'orthography' && label == 'word'

      NB all expressions must match by either id or layer.id.

      layerId - The layer ID of the resulting annotation.
      label - The label of the resulting annotation.
      confidence - The confidence rating.
      Returns:
      The number of new annotations added.
    • /api/edit/store/saveMedia

      Saves the given media for the given transcript.
      Body: multipart POST request, with the following parameters
      id - The ID of the transcript.
      trackSuffix (optional) - The track suffix of the media - see MediaTrackDefinition.suffix.
      media - The sound or video file to save for the transcript.
    • /api/edit/store/saveMedia

      Saves the given document for the episode of the given transcript.
      Body: multipart POST request, with the following parameters
      id - The ID of the transcript.
      document - The document file to save for the transcript.
    • /api/edit/store/deleteMedia

      Delete a given media or episode document file.
      Body: multipart POST request, with the following parameters
      id - The associated transcript ID.
      fileName - The media file name, e.g. MediaFile.name.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Store

        public Store()
        Default constructor.