Class LabbcatEdit
- java.lang.Object
-
- nzilbb.labbcat.LabbcatView
-
- nzilbb.labbcat.LabbcatEdit
-
- All Implemented Interfaces:
nzilbb.ag.GraphStore,nzilbb.ag.GraphStoreQuery
- Direct Known Subclasses:
LabbcatAdmin
public class LabbcatEdit extends LabbcatView implements nzilbb.ag.GraphStore
Client-side implementation of nzilbb.ag.GraphStore.This class inherits the read-only operations of
LabbcatViewand adds some write operations for updating data, i.e. those that can be performed by users withedit
permission.e.g.
// create annotation store client LabbcatEdit store = new
LabbcatEdit("https://labbcat.canterbury.ac.nz", "demo", "demo"); // get a corpus ID String[] corpora = labbcat.getCorpusIds(); String corpus = ids[0]; // get a transcript type Layer typeLayer = labbcat.getLayer("transcript_type"); String transcriptType = typeLayer.getValidLabels().keySet().iterator().next(); // upload a transcript File transcript = new File("/some/transcript.txt"); String taskId = labbcat.newTranscript(transcript, null, null, transcriptType, corpus, "test"); // wait until all automatic annotations have been generated TaskStatus layerGenerationTask = labbcat.waitForTask(taskId, 30); // get all the POS annotations Annotation[] pos = labbcat.getAnnotations(transcript.getName(), "pos"); // search for tokens of "and" Matches[] matches = labbcat.getMatches( labbcat.search( newPatternBuilder().addMatchLayer("orthography", "and").build(), participantIds, null, true, false, null, null), 1); // delete the transcript store.deleteGraph(transcript.getName());- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description LabbcatEdit()Default constructor.LabbcatEdit(String labbcatUrl)Constructor from string URL.LabbcatEdit(String labbcatUrl, String username, String password)Constructor with String attributes.LabbcatEdit(URL labbcatUrl)Constructor from URL.LabbcatEdit(URL labbcatUrl, String username, String password)Constructor with attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDictionaryEntry(String managerId, String dictionaryId, String key, String entry)Adds an entry to a dictionary.voidaddLayerDictionaryEntry(String layerId, String key, String entry)Adds an entry to a layer dictionary.StringannotatorExt(String annotatorId, String resource)Retrieve an annotator's given "ext" resource.StringannotatorExt(String annotatorId, String resource, String[] parameters)Retrieve an annotator's given "ext" resource.StringcreateAnnotation(String id, String fromId, String toId, String layerId, String label, Integer confidence, String parentId)Creates an annotation starting at from and ending at to.intdeleteMatchingAnnotations(String expression)Deletes all annotations that match a particular patternvoiddeleteMedia(String id, String fileName)Delete a given media or episode document file.voiddeleteParticipant(String id)Deletes the given participant, and all associated meta-data.voiddeleteTranscript(String id)Deletes the given transcript, and all associated files.voiddestroyAnnotation(String id, String annotationId)Destroys the annotation with the given ID.URLeditUrl(String resource)Constructs a URL for the given resource.StringnewTranscript(File transcript, File[] media, String trackSuffix, String transcriptType, String corpus, String episode)Upload a new transcript.voidremoveDictionaryEntry(String managerId, String dictionaryId, String key, String entry)Removes an entry from a dictionary.voidremoveLayerDictionaryEntry(String layerId, String key, String entry)Removes an entry from a layer dictionary.nzilbb.ag.MediaFilesaveEpisodeDocument(String id, String url)Saves the given document for the episode of the given transcript.nzilbb.ag.MediaFilesaveMedia(String id, String mediaUrl, String trackSuffix)Saves the given media for the given transcript.booleansaveParticipant(nzilbb.ag.Annotation participant)Saves a participant, and all its tags, to the database.voidsaveSource(String id, String url)NOT YET IMPLEMENTED - Saves the given source file for the given transcript.booleansaveTranscript(nzilbb.ag.Graph transcript)Saves the given transcript.inttagMatchingAnnotations(String expression, String layerId, String label, Integer confidence)Identifies a list of annotations that match a particular pattern, and tags them on the given layer with the given label.UploadtranscriptUpload(File transcript, boolean merge)Upload a transcript file as the first stage in adding or modifying a transcript to LaBB-CAT.UploadtranscriptUpload(File transcript, File[] media, boolean merge)Upload a transcript file and associated media files, as the first stage in adding or modifying a transcript to LaBB-CAT.UploadtranscriptUpload(File transcript, Map<String,File[]> media, boolean merge)Upload a transcript file and associated media files, as the first stage in adding or modifying a transcript to LaBB-CAT.voidtranscriptUploadDelete(String id)Delete an upload made bytranscriptUpload(File,Map,boolean).voidtranscriptUploadDelete(Upload upload)Delete an upload made bytranscriptUpload(File,Map,boolean).UploadtranscriptUploadParameters(Upload upload)The second part of a transcript upload process started by a call totranscriptUpload(File,Map,boolean), which specifies values for the parameters required to save the uploaded transcript to LaBB-CAT's database.StringupdateTranscript(File transcript)Uploads a new version of an existing transcript.StringupdateTranscript(File transcript, boolean generate)Uploads a new version of an existing transcript.-
Methods inherited from class nzilbb.labbcat.LabbcatView
aggregateMatchingAnnotations, cancel, cancelTask, changePassword, countAnnotations, countMatchingAnnotations, countMatchingParticipantIds, countMatchingTranscriptIds, delete, deserializerForFilesSuffix, deserializerForMimeType, FileNameFromContentDisposition, get, getAnchors, getAnnotations, getAnnotatorDescriptor, getAvailableMedia, getBatchMode, getCorpusIds, getCorpusInfo, getDashboardItem, getDashboardItems, getDeserializerDescriptors, getDictionaries, getDictionaryEntries, getEpisodeDocuments, getFragment, getFragment, getFragment, getFragments, getFragments, getFragmentSeries, getId, getInfo, getLabbcatUrl, getLanguage, getLayer, getLayerIds, getLayers, getMatchAnnotations, getMatchAnnotations, getMatchAnnotations, getMatches, getMatches, getMatches, getMatches, getMatchingAnnotations, getMatchingParticipantIds, getMatchingTranscriptIds, getMedia, getMedia, getMediaFile, getMediaTracks, getMinLabbcatVersion, getParticipant, getParticipantAttributes, getParticipantIds, getPassword, getRequiredHttpAuthorization, getResponse, getSchema, getSerializerDescriptors, getSoundFragments, getSoundFragments, getSystemAttribute, getTasks, getTranscriberDescriptors, getTranscript, getTranscript, getTranscriptAttributes, getTranscriptIds, getTranscriptIdsInCorpus, getTranscriptIdsWithParticipant, getUserInfo, getUsername, getVerbose, intervalAnnotations, intervalAnnotations, isCancelling, makeUrl, post, postMultipart, processWithPraat, processWithPraat, put, readAgreement, readCategories, readCategories, releaseTask, search, serializerForFilesSuffix, serializerForMimeType, setBatchMode, setLabbcatUrl, setLanguage, setPassword, setResponse, setUsername, setVerbose, taskStatus, taskStatus, url, versionInfo, waitForTask
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface nzilbb.ag.GraphStoreQuery
aggregateMatchingAnnotations, countAnnotations, countAnnotations, countMatchingAnnotations, countMatchingGraphIds, countMatchingParticipantIds, countMatchingTranscriptIds, deserializerForFilesSuffix, deserializerForMimeType, getAnchors, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getAvailableMedia, getCorpusIds, getDeserializerDescriptors, getEpisodeDocuments, getFragment, getFragment, getFragment, getFragmentSeries, getGraph, getGraph, getGraphIds, getGraphIdsInCorpus, getGraphIdsWithParticipant, getId, getLayer, getLayerIds, getLayers, getMatchAnnotations, getMatchingAnnotations, getMatchingAnnotations, getMatchingGraphIds, getMatchingGraphIds, getMatchingGraphIds, getMatchingParticipantIds, getMatchingParticipantIds, getMatchingTranscriptIds, getMatchingTranscriptIds, getMatchingTranscriptIds, getMedia, getMedia, getMediaTracks, getParticipant, getParticipant, getParticipantIds, getSchema, getSerializerDescriptors, getTranscriberDescriptors, getTranscript, getTranscript, getTranscriptIds, getTranscriptIdsInCorpus, getTranscriptIdsWithParticipant, serializerForFilesSuffix, serializerForMimeType
-
-
-
-
Constructor Detail
-
LabbcatEdit
public LabbcatEdit()
Default constructor.
-
LabbcatEdit
public LabbcatEdit(String labbcatUrl) throws MalformedURLException
Constructor from string URL.- Parameters:
labbcatUrl- The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/- Throws:
MalformedURLException- If the URL is invalid.
-
LabbcatEdit
public LabbcatEdit(String labbcatUrl, String username, String password) throws MalformedURLException
Constructor with String attributes.- Parameters:
labbcatUrl- The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/username- LaBB-CAT username.password- LaBB-CAT password.- Throws:
MalformedURLException- If the URL is invalid.
-
LabbcatEdit
public LabbcatEdit(URL labbcatUrl)
Constructor from URL.- Parameters:
labbcatUrl- The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/
-
-
Method Detail
-
editUrl
public URL editUrl(String resource) throws nzilbb.ag.StoreException
Constructs a URL for the given resource.- Parameters:
resource- The relative name of the resource.- Returns:
- A URL for the given resource.
- Throws:
nzilbb.ag.StoreException- If the URL is malformed.
-
saveTranscript
public boolean saveTranscript(nzilbb.ag.Graph transcript) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundExceptionSaves the given transcript. The transcript can be partial e.g. include only some of the layers that the stored version of the transcript contains.- Specified by:
saveTranscriptin interfacenzilbb.ag.GraphStore- Parameters:
transcript- The transcript to save.- Returns:
- true if changes were saved, false if there were no changes to save.
- Throws:
nzilbb.ag.StoreException- If an error prevents the transcript from being saved.nzilbb.ag.PermissionException- If saving the transcript is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
createAnnotation
public String createAnnotation(String id, String fromId, String toId, String layerId, String label, Integer confidence, String parentId) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Creates an annotation starting at from and ending at to.- Specified by:
createAnnotationin interfacenzilbb.ag.GraphStore- Parameters:
id- The ID of the transcript.fromId- The start anchor's ID. TODO: an expression identifying the start anchor's ID. e.g. "'n_123'" or "start.id" or maybe something like "first('segments').start.id)"toId- The end anchor's ID. TODO: an expression identifying the end anchor's ID. e.g. "'n_123'" or "end.id" or maybe something like "last('segments').end.id)"layerId- The layer ID of the resulting annotation.label- The label of the resulting annotation. TODO an expression identifying the label. e.g. "'@gz#mpP'" or "my('orthography').label" or maybe something like "SUM(list('segments').duration)"confidence- The confidence rating.parentId- The new annotation's parent's ID. TODO: an expression identifying the parent. e.g. "'em_0_123'" or "layer.id = 'orthography' AND label = 'example'"- Returns:
- The ID of the new annotation.
- Throws:
nzilbb.ag.StoreExceptionnzilbb.ag.PermissionExceptionnzilbb.ag.GraphNotFoundException
-
tagMatchingAnnotations
public int tagMatchingAnnotations(String expression, String layerId, String label, Integer confidence) throws nzilbb.ag.StoreException, nzilbb.ag.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.- Specified by:
tagMatchingAnnotationsin interfacenzilbb.ag.GraphStore- 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 == 'the'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.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
destroyAnnotation
public void destroyAnnotation(String id, String annotationId) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Destroys the annotation with the given ID.- Specified by:
destroyAnnotationin interfacenzilbb.ag.GraphStore- Parameters:
id- The ID of the transcript.annotationId- The annotation's ID.- Throws:
nzilbb.ag.StoreExceptionnzilbb.ag.PermissionExceptionnzilbb.ag.GraphNotFoundException
-
saveParticipant
public boolean saveParticipant(nzilbb.ag.Annotation participant) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionSaves a participant, and all its tags, to the database. The participant is represented by an Annotation that isn't assumed to be part of a transcript.- Specified by:
saveParticipantin interfacenzilbb.ag.GraphStore- Parameters:
participant- An annotation representing the participant, withAnnotation.addAnnotation(Annotation)called for each participant attribute value to set.The pass phrase for participant access can also be set by specifying a an annotation on the "_password" pseudo layer, with the .
- Returns:
- true if changes were saved, false if there were no changes to save.
- Throws:
nzilbb.ag.StoreException- If an error prevents the participant from being saved.nzilbb.ag.PermissionException- If saving the participant is not permitted.
-
saveMedia
public nzilbb.ag.MediaFile saveMedia(String id, String mediaUrl, String trackSuffix) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Saves the given media for the given transcript.- Specified by:
saveMediain interfacenzilbb.ag.GraphStore- Parameters:
id- The transcript ID.mediaUrl- A URL to the media content.trackSuffix- The track suffix of the media - see MediaTrackDefinition.suffix}.- Throws:
nzilbb.ag.StoreException- If an error prevents the media from being saved.nzilbb.ag.PermissionException- If saving the media is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
saveSource
public void saveSource(String id, String url) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
NOT YET IMPLEMENTED - Saves the given source file for the given transcript.- Specified by:
saveSourcein interfacenzilbb.ag.GraphStore- Parameters:
id- The transcript IDurl- A URL to the transcript.- Throws:
nzilbb.ag.StoreException- If an error prevents the media from being saved.nzilbb.ag.PermissionException- If saving the media is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
saveEpisodeDocument
public nzilbb.ag.MediaFile saveEpisodeDocument(String id, String url) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Saves the given document for the episode of the given transcript.- Specified by:
saveEpisodeDocumentin interfacenzilbb.ag.GraphStore- Parameters:
id- The transcript IDurl- A URL to the document.- Throws:
nzilbb.ag.StoreException- If an error prevents the media from being saved.nzilbb.ag.PermissionException- If saving the media is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
deleteMedia
public void deleteMedia(String id, String fileName) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Delete a given media or episode document file.- Specified by:
deleteMediain interfacenzilbb.ag.GraphStore- Parameters:
id- The associated transcript ID.fileName- The media/document file name, e.g.MediaFile.name.- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
deleteTranscript
public void deleteTranscript(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Deletes the given transcript, and all associated files.- Specified by:
deleteTranscriptin interfacenzilbb.ag.GraphStore- Parameters:
id- The ID transcript to save.- Throws:
nzilbb.ag.StoreException- If an error prevents the transcript from being deleted.nzilbb.ag.PermissionException- If deleting the transcript is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
deleteParticipant
public void deleteParticipant(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Deletes the given participant, and all associated meta-data.- Specified by:
deleteParticipantin interfacenzilbb.ag.GraphStore- Parameters:
id- The ID participant to delete.- Throws:
nzilbb.ag.StoreException- If an error prevents the transcript from being saved.nzilbb.ag.PermissionException- If saving the transcript is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript doesn't exist.
-
transcriptUpload
public Upload transcriptUpload(File transcript, boolean merge) throws IOException, nzilbb.ag.StoreException
Upload a transcript file as the first stage in adding or modifying a transcript to LaBB-CAT. The second stage istranscriptUploadParameters(Upload)- Parameters:
transcript- The transcript to upload.merge- Whether the upload corresponds to updates to an existing transcript (true) or a new transcript (false).- Returns:
- The ID and parameters required to complete the upload by calling
transcriptUploadParameters(Upload)These may include both information required by the format deserializer (e.g. mappings from tiers to LaBB-CAT layers) and also general information required by LaBB-CAT, such as:
- labbcat_corpus
- The corpus the new transcript(s) belong(s) to.
- labbcat_episode
- The episode the new transcript(s) belong(s) to.
- labbcat_transcript_type
- The transcript type for the new transcript(s).
- labbcat_generate
- Whether to re-regenerate layers of automated annotations or not.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
transcriptUpload
public Upload transcriptUpload(File transcript, File[] media, boolean merge) throws IOException, nzilbb.ag.StoreException
Upload a transcript file and associated media files, as the first stage in adding or modifying a transcript to LaBB-CAT. The second stage istranscriptUploadParameters(Upload)- Parameters:
transcript- The transcript to upload.media- The media to upload, if any. These will be uploaded with the default track suffix: "".merge- Whether the upload corresponds to updates to an existing transcript (true) or a new transcript (false).- Returns:
- The ID and parameters required to complete the upload by calling
transcriptUploadParameters(Upload)These may include both information required by the format deserializer (e.g. mappings from tiers to LaBB-CAT layers) and also general information required by LaBB-CAT, such as:
- labbcat_corpus
- The corpus the new transcript(s) belong(s) to.
- labbcat_episode
- The episode the new transcript(s) belong(s) to.
- labbcat_transcript_type
- The transcript type for the new transcript(s).
- labbcat_generate
- Whether to re-regenerate layers of automated annotations or not.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
transcriptUpload
public Upload transcriptUpload(File transcript, Map<String,File[]> media, boolean merge) throws IOException, nzilbb.ag.StoreException
Upload a transcript file and associated media files, as the first stage in adding or modifying a transcript to LaBB-CAT. The second stage istranscriptUploadParameters(Upload)- Parameters:
transcript- The transcript to upload.media- The media to upload, if any; a map of track suffixes (MediaTrack.suffix) to media files to upload for that track.merge- Whether the upload corresponds to updates to an existing transcript (true) or a new transcript (false).- Returns:
- The ID and
Upload.parametersrequired to complete thetranscriptUploadParameters(Upload).These may include both information required by the format deserializer (e.g. mappings from tiers to LaBB-CAT layers) and also general information required by LaBB-CAT, such as:
- labbcat_corpus
- The corpus the new transcript(s) belong(s) to.
- labbcat_episode
- The episode the new transcript(s) belong(s) to.
- labbcat_transcript_type
- The transcript type for the new transcript(s).
- labbcat_generate
- Whether to re-regenerate layers of automated annotations or not.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
transcriptUploadParameters
public Upload transcriptUploadParameters(Upload upload) throws IOException, nzilbb.ag.StoreException
The second part of a transcript upload process started by a call totranscriptUpload(File,Map,boolean), which specifies values for the parameters required to save the uploaded transcript to LaBB-CAT's database.If the response includes more parameters, then this method should be called again to supply their values.
- Parameters:
upload- Response fromtranscriptUpload(File,Map,boolean)with parameter values filled in as required.- Returns:
- The ID and a transcript-ID to thread-ID map (
Upload.transcripts) for transcripts that are being finalized (and any further parameters required to complete the upload). - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
transcriptUploadDelete
public void transcriptUploadDelete(Upload upload) throws IOException, nzilbb.ag.StoreException
Delete an upload made bytranscriptUpload(File,Map,boolean).- Parameters:
upload- Response fromtranscriptUpload(File,Map,boolean).- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
transcriptUploadDelete
public void transcriptUploadDelete(String id) throws IOException, nzilbb.ag.StoreException
Delete an upload made bytranscriptUpload(File,Map,boolean).- Parameters:
id- The ID of the upload as returned bytranscriptUpload(File,Map,boolean).- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
newTranscript
public String newTranscript(File transcript, File[] media, String trackSuffix, String transcriptType, String corpus, String episode) throws IOException, nzilbb.ag.StoreException
Upload a new transcript.- Parameters:
transcript- The transcript to upload.media- The media to upload, if any.trackSuffix- The track suffix for the media, which can be null.transcriptType- The transcript type.corpus- The corpus for the transcript.episode- The episode the transcript belongs to.- Returns:
- The taskId of the server task processing the upload.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
updateTranscript
public String updateTranscript(File transcript) throws IOException, nzilbb.ag.StoreException
Uploads a new version of an existing transcript.- Parameters:
transcript- The transcript file to upload.- Returns:
- The taskId of the server task processing the upload.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
updateTranscript
public String updateTranscript(File transcript, boolean generate) throws IOException, nzilbb.ag.StoreException
Uploads a new version of an existing transcript.- Parameters:
transcript- The transcript to upload.generate- Whether to regenerate automatic annotation layers or not.- Returns:
- The taskId of the server task processing the upload.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
deleteMatchingAnnotations
public int deleteMatchingAnnotations(String expression) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Deletes all annotations that match a particular pattern- Specified by:
deleteMatchingAnnotationsin interfacenzilbb.ag.GraphStore- 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.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
addLayerDictionaryEntry
public void addLayerDictionaryEntry(String layerId, String key, String entry) throws nzilbb.ag.StoreException
Adds an entry to a layer dictionary.This function adds a new entry to the dictionary that manages a given layer, and updates all affected tokens in the corpus. Words can have multiple entries.
- Parameters:
layerId- The ID of the layer with a dictionary configured to manage it.key- The key (word) in the dictionary to add an entry for.entry- The value (definition) for the given key.- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
removeLayerDictionaryEntry
public void removeLayerDictionaryEntry(String layerId, String key, String entry) throws nzilbb.ag.StoreException
Removes an entry from a layer dictionary.This function removes an existing entry from the dictionary that manages a given layer, and updates all affected tokens in the corpus. Words can have multiple entries.
- Parameters:
layerId- The ID of the layer with a dictionary configured to manage it.key- The key (word) in the dictionary to remove an entry for.entry- The value (definition) to remove, or null to remove all the entries for key.- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
addDictionaryEntry
public void addDictionaryEntry(String managerId, String dictionaryId, String key, String entry) throws nzilbb.ag.StoreException
Adds an entry to a dictionary.This function adds a new entry to the given dictionary. Words can have multiple entries.
- Parameters:
managerId- The layer manager ID of the dictionary, as returned byLabbcatView.getDictionaries()dictionaryId- The ID of the dictionary, as returned byLabbcatView.getDictionaries()key- The key (word) in the dictionary to add an entry for.entry- The value (definition) for the given key.- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
removeDictionaryEntry
public void removeDictionaryEntry(String managerId, String dictionaryId, String key, String entry) throws nzilbb.ag.StoreException
Removes an entry from a dictionary.This function removes an existing entry from the given dictionary. Words can have multiple entries.
- Parameters:
managerId- The layer manager ID of the dictionary, as returned byLabbcatView.getDictionaries()dictionaryId- The ID of the dictionary, as returned byLabbcatView.getDictionaries()key- The key (word) in the dictionary to remove an entry for.entry- The value (definition) to remove, or None to remove all the entries for key.- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
annotatorExt
public String annotatorExt(String annotatorId, String resource) throws nzilbb.ag.StoreException
Retrieve an annotator's given "ext" resource.Retrieve a given resource from an annotator's "ext" web app. Annotators are modules that perform different annotation tasks, and can optionally implement functionality for providing extra data or extending functionality in an annotator-specific way. If the annotator implements an "ext" web app, it can provide resources and implement a mechanism for iterrogating the annotator. This function provides a mechanism for accessing these resources via python.
Details about the resources available for a given annotator are available by calling
LabbcatView.getAnnotatorDescriptor(String)and checking "hasExtWebapp" attribute to ensure an 'ext' webapp is implemented, and checking details the "extApiInfo" attribute.- Parameters:
annotatorId- ID of the annotator to interrogate.resource- The name of the file to retrieve or instance method (function) to invoke. Possible values for this depend on the specific annotator being interrogated.- Returns:
- The resource requested.
- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
annotatorExt
public String annotatorExt(String annotatorId, String resource, String[] parameters) throws nzilbb.ag.StoreException
Retrieve an annotator's given "ext" resource.Retrieve a given resource from an annotator's "ext" web app. Annotators are modules that perform different annotation tasks, and can optionally implement functionality for providing extra data or extending functionality in an annotator-specific way. If the annotator implements an "ext" web app, it can provide resources and implement a mechanism for iterrogating the annotator. This function provides a mechanism for accessing these resources via python.
Details about the resources available for a given annotator are available by calling
LabbcatView.getAnnotatorDescriptor(String)and checking "hasExtWebapp" attribute to ensure an 'ext' webapp is implemented, and checking details the "extApiInfo" attribute.- Parameters:
annotatorId- ID of the annotator to interrogate.resource- The name of the file to retrieve or instance method (function) to invoke. Possible values for this depend on the specific annotator being interrogated.parameters- Optional list of ordered parameters for the instance method (function).- Returns:
- The resource requested.
- Throws:
nzilbb.ag.StoreException- If the server returns an error.
-
-