Class LabbcatView
- java.lang.Object
-
- nzilbb.labbcat.LabbcatView
-
- All Implemented Interfaces:
nzilbb.ag.GraphStoreQuery
- Direct Known Subclasses:
LabbcatEdit
public class LabbcatView extends Object implements nzilbb.ag.GraphStoreQuery
Client-side implementation of nzilbb.ag.GraphStoreQuery.This class provides only read-only operations, i.e. those that can be performed by users with
view
permission.e.g.
// create LaBB-CAT client LabbcatView labbcat = new
LabbcatView("https://labbcat.canterbury.ac.nz", "demo", "demo"); // get some basic information String id = lbbcat.getId(); String[] layers = labbcat.getLayerIds(); String[] corpora = labbcat.getCorpusIds(); String[] documents = labbcat.getTranscriptIdsInCorpus(corpora[0]); // search for tokens of "and" Matches[] matches = labbcat.getMatches( labbcat.search( newPatternBuilder().addMatchLayer("orthography", "and").build(), participantIds, null, true, false, null, 5), 1);- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description LabbcatView()Default constructor.LabbcatView(String labbcatUrl)Constructor from string URL.LabbcatView(String labbcatUrl, String username, String password)Constructor with String attributes.LabbcatView(URL labbcatUrl)Constructor from URL.LabbcatView(URL labbcatUrl, String username, String password)Constructor with attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]aggregateMatchingAnnotations(String operation, String expression)Identifies a list of annotations that match a particular pattern, and aggregates their labels.voidcancel()Cancel the current request, if possible.voidcancelTask(String threadId)Cancels a running task.voidchangePassword(String currentPassword, String newPassword)Change the password of the currently-logged-in user.longcountAnnotations(String id, String layerId, Integer maxOrdinal)Gets the number of annotations on the given layer of the given transcript, but only those with an ordinal less than or equal to the given maximum.intcountMatchingAnnotations(String expression)Counts the number of annotations that match a particular pattern.intcountMatchingParticipantIds(String expression)Counts the number of participants that match a particular pattern.intcountMatchingTranscriptIds(String expression)Counts the number of transcripts that match a particular pattern.HttpRequestPostdelete(String resource)Constructs a DELETE request for the given resource.nzilbb.ag.serialize.GraphDeserializerdeserializerForFilesSuffix(String suffix)NOT YET IMPLEMENTED - Gets the deserializer for the given file suffix (extension).nzilbb.ag.serialize.GraphDeserializerdeserializerForMimeType(String mimeType)NOT YET IMPLEMENTED - Gets the deserializer for the given MIME type.static StringFileNameFromContentDisposition(String contentDisposition)Infers the filename from a given Content-Disposition header.HttpRequestGetget(String resource)Constructs a GET request for the given resource.nzilbb.ag.Anchor[]getAnchors(String id, String[] anchorIds)Gets the given anchors in the given transcript.nzilbb.ag.Annotation[]getAnnotations(String id, String layerId, Integer maxOrdinal, Integer pageLength, Integer pageNumber)Gets the annotations on the given layer of the given transcript, but only those with an ordinal less than or equal to the given maximum.nzilbb.ag.automation.util.AnnotatorDescriptorgetAnnotatorDescriptor(String annotatorId)Gets a descriptor of the annotator with the given ID.nzilbb.ag.MediaFile[]getAvailableMedia(String id)List the media available for the given transcript.booleangetBatchMode()Getter forbatchMode: Whether to run in batch mode or not.String[]getCorpusIds()Gets a list of corpus IDs.Map<String,String>getCorpusInfo(String corpusId)Gets statistics about a given corpus.StringgetDashboardItem(int itemId)Gets the value of one dashboard item.DashboardItem[]getDashboardItems(String dashboard)Lists configured items for the given dashboard.nzilbb.ag.serialize.SerializationDescriptor[]getDeserializerDescriptors()Lists the descriptors of all registered deserializers.Map<String,List<String>>getDictionaries()List dictionaries available.FilegetDictionaryEntries(String managerId, String dictionaryId, String[] keys)Lookup entries in a dictionary.nzilbb.ag.MediaFile[]getEpisodeDocuments(String id)Get a list of documents associated with the episode of the given transcript.nzilbb.ag.GraphgetFragment(String transcriptId, double start, double end, String[] layerIds)Gets a fragment of a transcript, given its ID and the start/end offsets that define the desired fragment, and containing only the given layers.nzilbb.ag.GraphgetFragment(String transcriptId, String annotationId)Gets a fragment of a transcript, given its ID and the ID of an annotation in it that defines the desired fragment.nzilbb.ag.GraphgetFragment(String transcriptId, String annotationId, String[] layerIds)Gets a fragment of a graph, given its ID and the ID of an annotation in it that defines the desired fragment, and containing only the given layers.File[]getFragments(String[] transcriptIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds, String mimeType, File dir)Get transcript fragments in a specified format.File[]getFragments(Match[] matches, String[] layerIds, String mimeType, File dir)Get transcript fragments in a specified format.nzilbb.util.MonitorableSeries<nzilbb.ag.Graph>getFragmentSeries(String seriesId, String[] layerIds)NOT YET IMPLEMENTED - Gets a series of fragments, given the series' ID, and only the given layers.StringgetId()Gets the store's ID.StringgetInfo()Gets the store's information document.URLgetLabbcatUrl()Getter forlabbcatUrl: The base URL of the LaBB-CAT server - e.g.StringgetLanguage()Getter forlanguage: The language code for server message localization, e.g.nzilbb.ag.LayergetLayer(String id)Gets a layer definition.String[]getLayerIds()Gets a list of layer IDs (annotation 'types').nzilbb.ag.Layer[]getLayers()Gets a list of layer definitions.nzilbb.ag.Annotation[][]getMatchAnnotations(String[] matchIds, String[] layerIds, int targetOffset, int annotationsPerLayer)Gets annotations on selected layers related to search results returned by a previous call togetMatches(String,int),taskStatus(String).voidgetMatchAnnotations(Iterator<String> matchIds, String[] layerIds, int targetOffset, int annotationsPerLayer, Consumer<nzilbb.ag.Annotation[]> consumer)NOT YET IMPLEMENTED - Gets the annotations on given layers for a set of match IDs.nzilbb.ag.Annotation[][]getMatchAnnotations(Match[] matches, String[] layerIds, int targetOffset, int annotationsPerLayer)Gets annotations on selected layers related to search results returned by a previous call togetMatches(String,int).Match[]getMatches(String threadId, int wordsContext)Gets a list of tokens that were matched bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).Match[]getMatches(String threadId, int wordsContext, Integer pageLength, Integer pageNumber)Gets a list of tokens that were matched bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).Match[]getMatches(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipant, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold, int wordsContext)Searches for tokens that match the givem pattern and returns a list of matches.Match[]getMatches(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipant, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold, int wordsContext, Integer maxMatches)Searches for tokens that match the given pattern and returns the first maxMatches matches.nzilbb.ag.Annotation[]getMatchingAnnotations(String expression, Integer pageLength, Integer pageNumber)Gets a list of annotations that match a particular pattern.String[]getMatchingParticipantIds(String expression, Integer pageLength, Integer pageNumber)Gets a list of IDs of participants that match a particular pattern.String[]getMatchingTranscriptIds(String expression, Integer pageLength, Integer pageNumber, String order)Gets a list of IDs of transcripts that match a particular pattern.StringgetMedia(String id, String trackSuffix, String mimeType)Gets a given media track for a given transcript.StringgetMedia(String id, String trackSuffix, String mimeType, Double startOffset, Double endOffset)Gets a given media track for a given transcript.FilegetMediaFile(String id, String trackSuffix, String mimeType, File dir)Gets a given media track for a given transcript.nzilbb.ag.MediaTrackDefinition[]getMediaTracks()List the predefined media tracks available for transcripts.StringgetMinLabbcatVersion()Getter forminLabbcatVersion: Minimum server version required for this API to work properly.nzilbb.ag.AnnotationgetParticipant(String id, String[] layerIds)Gets the participant record specified by the given identifier.FilegetParticipantAttributes(String[] participantIds, String[] layerIds)Gets participant attribute values for given participant IDs.String[]getParticipantIds()Gets a list of participant IDs.StringgetPassword()Getter forpassword: LaBB-CAT password.StringgetRequiredHttpAuthorization()Determines whether an authorization string is required for HTTP requests (i.e.ResponsegetResponse()Getter forresponse: The last response received from the server.nzilbb.ag.SchemagetSchema()NOT YET IMPLEMENTED - Gets the layer schema.nzilbb.ag.serialize.SerializationDescriptor[]getSerializerDescriptors()Lists the descriptors of all registered serializers.File[]getSoundFragments(String[] transcriptIds, Double[] startOffsets, Double[] endOffsets, Integer sampleRate, File dir)Downloads WAV sound fragments.File[]getSoundFragments(Match[] matches, Integer sampleRate, File dir)Downloads WAV sound fragments.StringgetSystemAttribute(String attribute)Gets the value of the given system attribute.String[]getTasks()Gets a list of all tasks on the server.nzilbb.ag.automation.util.AnnotatorDescriptor[]getTranscriberDescriptors()Lists descriptors of all transcribers that are installed.nzilbb.ag.GraphgetTranscript(String id)Gets a transcript given its ID.nzilbb.ag.GraphgetTranscript(String id, String[] layerIds)Gets a transcript given its ID, containing only the given layers.FilegetTranscriptAttributes(String[] transcriptIds, String[] layerIds)Gets transcript attribute values for given transcript IDs.String[]getTranscriptIds()Gets a list of transcript IDs.String[]getTranscriptIdsInCorpus(String id)Gets a list of transcript IDs in the given corpus.String[]getTranscriptIdsWithParticipant(String id)Gets a list of IDs of transcripts that include the given participant.UsergetUserInfo()Gets information about the current user, including the roles or groups they are in.StringgetUsername()Getter forusername: LaBB-CAT username.booleangetVerbose()Getter forverbose: Whether to print verbose output or not.StringintervalAnnotations(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds)Concatenates annotation labels for given labels contained in given time intervals, using a space delimiter for labels, and requiring complete (rather than partial) containment.StringintervalAnnotations(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds, String labelDelimiter, boolean partialContainment)Concatenates annotation labels for given labels contained in given time intervals.booleanisCancelling()Determines whether or not the request is being cancelled.URLmakeUrl(String resource)Constructs a URL for the given resource.HttpRequestPostpost(String resource)Constructs a POST request for the given resource.HttpRequestPostMultipartpostMultipart(String resource)Constructs a multipart POST request for the given resource.StringprocessWithPraat(String[] matchIds, Double[] startOffsets, Double[] endOffsets, String praatScript, Double windowOffset, String[] attributes)Executes Praat on the server in order to perform acoustic analysis on a given collection of sound fragments.StringprocessWithPraat(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String script, Double windowOffset, String[] attributes)Executes Praat on the server in order to perform acoustic analysis on a given collection of sound fragments.HttpRequestPostput(String resource)Constructs a PUT request for the given resource.StringreadAgreement()Reads the current data access license agreement (HTML) document.Category[]readCategories(String classId)Reads a list of category records.Category[]readCategories(String classId, Integer pageNumber, Integer pageLength)Reads a list of category records.voidreleaseTask(String threadId)Release a finished task, to free up server resources.Stringsearch(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipantOnly, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold)Searches for tokens that match the given pattern.nzilbb.ag.serialize.GraphSerializerserializerForFilesSuffix(String suffix)NOT YET IMPLEMENTED - Gets the serializer for the given file suffix (extension).nzilbb.ag.serialize.GraphSerializerserializerForMimeType(String mimeType)NOT YET IMPLEMENTED - Gets the serializer for the given MIME type.LabbcatViewsetBatchMode(boolean newBatchMode)Setter forbatchMode: Whether to run in batch mode or not.LabbcatViewsetLabbcatUrl(URL newLabbcatUrl)Setter forlabbcatUrl: The base URL of the LaBB-CAT server - e.g.LabbcatViewsetLanguage(String newLanguage)Setter forlanguage: The language code for server message localization, e.g.LabbcatViewsetPassword(String newPassword)Setter forpassword: LaBB-CAT password.LabbcatViewsetResponse(Response newResponse)Setter forresponse: The last response received from the server.LabbcatViewsetUsername(String newUsername)Setter forusername: LaBB-CAT username.LabbcatViewsetVerbose(boolean newVerbose)Setter forverbose: Whether to print verbose output or not.TaskStatustaskStatus(String threadId)Gets the current state of the given task.TaskStatustaskStatus(String threadId, boolean log, boolean keepalive)Gets the current state of the given task.URLurl(String resource)Constructs a URL for the given resource.Map<String,Map<String,String>>versionInfo()Gets version information of all components of LaBB-CAT.TaskStatuswaitForTask(String threadId, int maxSeconds)Wait for the given task to finish.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface nzilbb.ag.GraphStoreQuery
countAnnotations, countMatchingGraphIds, getAnnotations, getAnnotations, getAnnotations, getGraph, getGraph, getGraphIds, getGraphIdsInCorpus, getGraphIdsWithParticipant, getMatchingAnnotations, getMatchingGraphIds, getMatchingGraphIds, getMatchingGraphIds, getMatchingParticipantIds, getMatchingTranscriptIds, getMatchingTranscriptIds, getParticipant
-
-
-
-
Constructor Detail
-
LabbcatView
public LabbcatView()
Default constructor.
-
LabbcatView
public LabbcatView(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.
-
LabbcatView
public LabbcatView(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.
-
LabbcatView
public LabbcatView(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
-
getLabbcatUrl
public URL getLabbcatUrl()
Getter forlabbcatUrl: The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/- Returns:
- The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/
-
setLabbcatUrl
public LabbcatView setLabbcatUrl(URL newLabbcatUrl)
Setter forlabbcatUrl: The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/- Parameters:
newLabbcatUrl- The base URL of the LaBB-CAT server - e.g. https://labbcat.canterbury.ac.nz/demo/- Returns:
- A reference to this object, so that setters can be chained.
-
getUsername
public String getUsername()
Getter forusername: LaBB-CAT username.- Returns:
- LaBB-CAT username.
-
setUsername
public LabbcatView setUsername(String newUsername)
Setter forusername: LaBB-CAT username.- Parameters:
newUsername- LaBB-CAT username.- Returns:
- A reference to this object, so that setters can be chained.
-
getPassword
public String getPassword()
Getter forpassword: LaBB-CAT password.- Returns:
- LaBB-CAT password.
-
setPassword
public LabbcatView setPassword(String newPassword)
Setter forpassword: LaBB-CAT password.- Parameters:
newPassword- LaBB-CAT password.- Returns:
- A reference to this object, so that setters can be chained.
-
getBatchMode
public boolean getBatchMode()
Getter forbatchMode: Whether to run in batch mode or not. If false, the user may be asked to enter username/password if required. Default is false.- Returns:
- Whether to run in batch mode or not. If false, the user may be asked to enter username/password if required.
-
setBatchMode
public LabbcatView setBatchMode(boolean newBatchMode)
Setter forbatchMode: Whether to run in batch mode or not. If false, the user may be asked to enter username/password if required.- Parameters:
newBatchMode- Whether to run in batch mode or not. If false, the user may be asked to enter username/password if required.- Returns:
- A reference to this object, so that setters can be chained.
-
getVerbose
public boolean getVerbose()
Getter forverbose: Whether to print verbose output or not.- Returns:
- Whether to print verbose output or not.
-
setVerbose
public LabbcatView setVerbose(boolean newVerbose)
Setter forverbose: Whether to print verbose output or not.- Parameters:
newVerbose- Whether to print verbose output or not.- Returns:
- A reference to this object, so that setters can be chained.
-
getMinLabbcatVersion
public String getMinLabbcatVersion()
Getter forminLabbcatVersion: Minimum server version required for this API to work properly.- Returns:
- Minimum server version required for this API to work properly.
-
getResponse
public Response getResponse()
Getter forresponse: The last response received from the server.- Returns:
- The last response received from the server.
-
setResponse
public LabbcatView setResponse(Response newResponse)
Setter forresponse: The last response received from the server.- Parameters:
newResponse- The last response received from the server.- Returns:
- A reference to this object, so that setters can be chained.
-
getLanguage
public String getLanguage()
Getter forlanguage: The language code for server message localization, e.g. "es-AR" for Argentine Spanish.- Returns:
- The language code for server message localization, e.g. "es-AR" for Argentine Spanish.
-
setLanguage
public LabbcatView setLanguage(String newLanguage)
Setter forlanguage: The language code for server message localization, e.g. "es-AR" for Argentine Spanish.- Parameters:
newLanguage- The language code for server message localization, e.g. "es-AR" for Argentine Spanish.- Returns:
- A reference to this object, so that setters can be chained.
-
getRequiredHttpAuthorization
public String getRequiredHttpAuthorization() throws IOException, nzilbb.ag.StoreException
Determines whether an authorization string is required for HTTP requests (i.e. whether a username/password is required)- Returns:
- The authorization string that's required, if any
- Throws:
IOException- If an IO error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
url
public URL url(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.
-
makeUrl
public URL makeUrl(String resource) throws nzilbb.ag.StoreException
Constructs a URL for the given resource.- Parameters:
resource- The resource, which must be URLEncoded if necessary. This can be a full URL (e.g. as returned bygetMedia(String,String,String,Double,Double)) as long as from the same LaBB-CAT instance.- Returns:
- A URL for the given resource.
- Throws:
nzilbb.ag.StoreException- If the URL is malformed.
-
get
public HttpRequestGet get(String resource) throws IOException, nzilbb.ag.StoreException
Constructs a GET request for the given resource. The resulting request will be authorized if required, but otherwise has no headers or parameters set.- Parameters:
resource- The path to the resource.- Returns:
- The request.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
post
public HttpRequestPost post(String resource) throws IOException, nzilbb.ag.StoreException
Constructs a POST request for the given resource. The resulting request will be authorized if required, but otherwise has no headers or parameters set.- Parameters:
resource- The path to the resource.- Returns:
- The request.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
put
public HttpRequestPost put(String resource) throws IOException, nzilbb.ag.StoreException
Constructs a PUT request for the given resource. The resulting request will be authorized if required, but otherwise has no headers or parameters set.- Parameters:
resource- The path to the resource.- Returns:
- The request.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
delete
public HttpRequestPost delete(String resource) throws IOException, nzilbb.ag.StoreException
Constructs a DELETE request for the given resource. The resulting request will be authorized if required, but otherwise has no headers or parameters set.- Parameters:
resource- The path to the resource.- Returns:
- The request.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
postMultipart
public HttpRequestPostMultipart postMultipart(String resource) throws IOException, nzilbb.ag.StoreException
Constructs a multipart POST request for the given resource. The resulting request will be authorized if required, but otherwise has no headers or parameters set.The post-request is remembered, so subsequent calls to
cancel()will cancel the request if it's in-course.- Parameters:
resource- The path to the resource.- Returns:
- The request.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getId
public String getId() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets the store's ID.- Specified by:
getIdin interfacenzilbb.ag.GraphStoreQuery- Returns:
- The annotation store's ID.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
versionInfo
public Map<String,Map<String,String>> versionInfo() throws nzilbb.ag.StoreException
Gets version information of all components of LaBB-CAT.- Returns:
- A map of section names to sub-component version info, each section being a map of component names to versions.
- Throws:
nzilbb.ag.StoreException- If an error occurs.
-
getInfo
public String getInfo() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets the store's information document.- Returns:
- An HTML document providing information about the corpus, or null if no document has been created.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
readAgreement
public String readAgreement() throws nzilbb.ag.StoreException
Reads the current data access license agreement (HTML) document.- Returns:
- An HTML document containing the data access license agreement, or null if there is none.
- Throws:
nzilbb.ag.StoreException- If an error occurs.
-
getLayerIds
public String[] getLayerIds() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of layer IDs (annotation 'types').- Specified by:
getLayerIdsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of layer IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getLayers
public nzilbb.ag.Layer[] getLayers() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionGets a list of layer definitions.- Specified by:
getLayersin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of layer definitions.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getSchema
public nzilbb.ag.Schema getSchema() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionNOT YET IMPLEMENTED - Gets the layer schema.- Specified by:
getSchemain interfacenzilbb.ag.GraphStoreQuery- Returns:
- A schema defining the layers and how they relate to each other.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getLayer
public nzilbb.ag.Layer getLayer(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a layer definition.- Specified by:
getLayerin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- ID of the layer to get the definition for.- Returns:
- The definition of the given layer.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getCorpusIds
public String[] getCorpusIds() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of corpus IDs.- Specified by:
getCorpusIdsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of corpus IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getParticipantIds
public String[] getParticipantIds() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of participant IDs.- Specified by:
getParticipantIdsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of participant IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getParticipant
public nzilbb.ag.Annotation getParticipant(String id, String[] layerIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets the participant record specified by the given identifier.- Specified by:
getParticipantin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The ID of the participant, which could be their name or their database annotation ID.layerIds- The IDs of the participant attribute layers to load, or null if only participant data is required.- Returns:
- An annotation representing the participant, or null if the participant was not found.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.
-
countMatchingParticipantIds
public int countMatchingParticipantIds(String expression) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Counts the number of participants that match a particular pattern.- Specified by:
countMatchingParticipantIdsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which participants match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
/Ada.+/.test(id)labels('corpus').includes('CC')labels('participant_languages').includes('en')labels('transcript_language').includes('en')!/Ada.+/.test(id) && first('corpus').label == 'CC'all('transcript_rating').length > 2all('participant_rating').length = 0!annotators('transcript_rating').includes('labbcat')first('participant_gender').label == 'NA'
- Returns:
- The number of matching participants.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getMatchingParticipantIds
public String[] getMatchingParticipantIds(String expression, Integer pageLength, Integer pageNumber) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of IDs of participants that match a particular pattern.- Specified by:
getMatchingParticipantIdsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which participants match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
/Ada.+/.test(id)labels('corpus').includes('CC')labels('participant_languages').includes('en')labels('transcript_language').includes('en')!/Ada.+/.test(id) && first('corpus').label == 'CC'all('transcript_rating').length > 2all('participant_rating').length = 0!annotators('transcript_rating').includes('labbcat')first('participant_gender').label == 'NA'
pageLength- The maximum number of IDs to return, or null to return all.pageNumber- The zero-based page number to return, or null to return the first page.- Returns:
- A list of participant IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getTranscriptIds
public String[] getTranscriptIds() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of transcript IDs.- Specified by:
getTranscriptIdsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of transcript IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getTranscriptIdsInCorpus
public String[] getTranscriptIdsInCorpus(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of transcript IDs in the given corpus.- Specified by:
getTranscriptIdsInCorpusin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- A corpus ID.- Returns:
- A list of transcript IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getTranscriptIdsWithParticipant
public String[] getTranscriptIdsWithParticipant(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of IDs of transcripts that include the given participant.- Specified by:
getTranscriptIdsWithParticipantin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- A participant ID.- Returns:
- A list of transcript IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
countMatchingTranscriptIds
public int countMatchingTranscriptIds(String expression) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Counts the number of transcripts that match a particular pattern.- Specified by:
countMatchingTranscriptIdsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which transcripts match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
/Ada.+/.test(id)labels('participant').includes('Robert')('CC', 'IA', 'MU').includes(first('corpus').label)first('episode').label == 'Ada Aitcheson'first('transcript_scribe').label == 'Robert'first('participant_languages').label == 'en'first('noise').label == 'bell'labels('transcript_languages').includes('en')labels('participant_languages').includes('en')labels('noise').includes('bell')all('transcript_languages').length gt; 1all('participant_languages').length gt; 1all('transcript').length gt; 100annotators('transcript_rating').includes('Robert')!/Ada.+/.test(id) && first('corpus').label == 'CC' && labels('participant').includes('Robert')
- Returns:
- The number of matching transcripts.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getMatchingTranscriptIds
public String[] getMatchingTranscriptIds(String expression, Integer pageLength, Integer pageNumber, String order) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of IDs of transcripts that match a particular pattern.
The results can be exhaustive, by omitting pageLength and pageNumber, or they can be a subset (a 'page') of results, by given pageLength and pageNumber values.
The order of the list can be specified. If ommitted, the transcripts are listed in ID order.
- Specified by:
getMatchingTranscriptIdsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which transcripts match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
/Ada.+/.test(id)labels('participant').includes('Robert')('CC', 'IA', 'MU').includes(first('corpus').label)first('episode').label == 'Ada Aitcheson'first('transcript_scribe').label == 'Robert'first('participant_languages').label == 'en'first('noise').label == 'bell'labels('transcript_languages').includes('en')labels('participant_languages').includes('en')labels('noise').includes('bell')all('transcript_languages').length gt; 1all('participant_languages').length gt; 1all('transcript').length gt; 100annotators('transcript_rating').includes('Robert')!/Ada.+/.test(id) && first('corpus').label == 'CC' && labels('participant').includes('Robert')
pageLength- The maximum number of IDs to return, or null to return all.pageNumber- The zero-based page number to return, or null to return the first page.order- The ordering for the list of IDs, a string containing a comma-separated list of expressions, which may be appended by " ASC" or " DESC", or null for transcript ID order.- Returns:
- A list of transcript IDs.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
countMatchingAnnotations
public int countMatchingAnnotations(String expression) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Counts the number of annotations that match a particular pattern.- Specified by:
countMatchingAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which participants match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
id == 'ew_0_456'!/th[aeiou].//.test(label)first('participant').label == 'Robert' && first('utterances').start.offset == 12.345graph.id == 'AdaAicheson-01.trs' && layer.id == 'orthography' && start.offset > 10.5previous.id == 'ew_0_456'
NB all expressions must match by either id or layer.id.
- Returns:
- The number of matching annotations.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getMatchingAnnotations
public nzilbb.ag.Annotation[] getMatchingAnnotations(String expression, Integer pageLength, Integer pageNumber) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets a list of annotations that match a particular pattern.- Specified by:
getMatchingAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
expression- An expression that determines which transcripts match.The expression language is loosely based on JavaScript; expressions such as the following can be used:
id == 'ew_0_456'!/th[aeiou].//.test(label)first('participant').label == 'Robert' && first('utterances').start.offset == 12.345graph.id == 'AdaAicheson-01.trs' && layer.id == 'orthography' && start.offset > 10.5previous.id == 'ew_0_456'
NB all expressions must match by either id or layer.id.
pageLength- The maximum number of annotations to return, or null to return all.pageNumber- The zero-based page number to return, or null to return the first page.- Returns:
- A list of matching
Annotations. - Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
aggregateMatchingAnnotations
public String[] aggregateMatchingAnnotations(String operation, String expression) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Identifies a list of annotations that match a particular pattern, and aggregates their labels.This allows for counting, listing distinct labels, etc.
- Specified by:
aggregateMatchingAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
operation- The aggregation operation(s) - e.g.- DISTINCT
- List the distinct labels.
- MAX
- Return the highest label.
- MIN
- Return the lowest label.
- COUNT
- Return the number of annotations.
- COUNT DISTINCT
- Return the number of distinct labels.
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'graph.id == 'AdaAicheson-01.trs' && layer.id == 'orthography'
NB all expressions must match by either id or layer.id.
- Returns:
- A list of results. This may have a single element (e.g. when
operation ==
COUNT
), or may be a (long) list of labels (e.g. when operation ==DISTINCT
. If there are multiple operations then the array will contain a multiple of the number of matching annotations. (e.g. if operation ==DISTINCT,COUNT
then the array will have twice the number of elements as there are distinct words, even-indexed elements are the word labels, and odd-indexed elements are the counts.) - Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
countAnnotations
public long countAnnotations(String id, String layerId, Integer maxOrdinal) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets the number of annotations on the given layer of the given transcript, but only those with an ordinal less than or equal to the given maximum.- Specified by:
countAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The ID of the transcript.layerId- The ID of the layer.maxOrdinal- The maximum ordinal for the counted annotations. e.g. a maxOrdinal of 1 will ensure that only the first annotation for each parent is counted. If maxOrdinal is null, then all annotations are counted, regardless of their ordinal.- Returns:
- A (possibly empty) array of annotations.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getAnnotations
public nzilbb.ag.Annotation[] getAnnotations(String id, String layerId, Integer maxOrdinal, Integer pageLength, Integer pageNumber) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets the annotations on the given layer of the given transcript, but only those with an ordinal less than or equal to the given maximum.- Specified by:
getAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The ID of the transcript.layerId- The ID of the layer.maxOrdinal- The maximum ordinal for the returned annotations. e.g. a maxOrdinal of 1 will ensure that only the first annotation for each parent is returned. If maxOrdinal is null, then all annotations are returned, regardless of their ordinal.pageLength- The maximum number of IDs to return, or null to return all.pageNumber- The zero-based page number to return, or null to return the first page.- Returns:
- A (possibly empty) array of annotations.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getMatchAnnotations
public void getMatchAnnotations(Iterator<String> matchIds, String[] layerIds, int targetOffset, int annotationsPerLayer, Consumer<nzilbb.ag.Annotation[]> consumer) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
NOT YET IMPLEMENTED - Gets the annotations on given layers for a set of match IDs.- Specified by:
getMatchAnnotationsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
matchIds- An iterator that supplies match IDs - these may be the contents of the MatchId column in exported search results, token URLs, or annotation IDs.layerIds- The layer IDs of the layers to get.targetOffset- Which token to get the annotations of; 0 means the match target itself, 1 means the token after the target, -1 means the token before the target, etc.annotationsPerLayer- The number of annotations per layer to get; if there's a smaller number of annotations available, the unfilled array elements will be null.consumer- A consumer for handling the resulting annotations. Consumer.accept() will be invoked once for each element returned by the matchIds iterator, with an array ofAnnotationobjects. The size of this array will be layerIds.length * annotationsPerLayer, and will be filled in with the available annotations for each layer; when annotations are not available, null is supplied.- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getAnchors
public nzilbb.ag.Anchor[] getAnchors(String id, String[] anchorIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets the given anchors in the given transcript.- Specified by:
getAnchorsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The ID of the transcript.anchorIds- A list of anchor IDs.- Returns:
- A (possibly empty) array of anchors.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getTranscript
public nzilbb.ag.Graph getTranscript(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a transcript given its ID.- Specified by:
getTranscriptin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The given transcript ID.- Returns:
- The identified transcript.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getTranscript
public nzilbb.ag.Graph getTranscript(String id, String[] layerIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a transcript given its ID, containing only the given layers.- Specified by:
getTranscriptin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The given transcript ID.layerIds- The IDs of the layers to load, or null if only transcript data is required.- Returns:
- The identified transcript.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getFragment
public nzilbb.ag.Graph getFragment(String transcriptId, String annotationId) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a fragment of a transcript, given its ID and the ID of an annotation in it that defines the desired fragment.- Specified by:
getFragmentin interfacenzilbb.ag.GraphStoreQuery- Parameters:
transcriptId- The ID of the transcript.annotationId- The ID of an annotation that defines the bounds of the fragment.- Returns:
- The identified transcript fragment.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getFragment
public nzilbb.ag.Graph getFragment(String transcriptId, String annotationId, String[] layerIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a fragment of a graph, given its ID and the ID of an annotation in it that defines the desired fragment, and containing only the given layers.- Specified by:
getFragmentin interfacenzilbb.ag.GraphStoreQuery- Parameters:
transcriptId- The ID of the transcript.annotationId- The ID of an annotation that defines the bounds of the fragment.layerIds- The IDs of the layers to load, or null if only transcript data is required.- Returns:
- The identified transcript fragment.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getFragment
public nzilbb.ag.Graph getFragment(String transcriptId, double start, double end, String[] layerIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a fragment of a transcript, given its ID and the start/end offsets that define the desired fragment, and containing only the given layers.- Specified by:
getFragmentin interfacenzilbb.ag.GraphStoreQuery- Parameters:
transcriptId- The ID of the transcript.start- The start offset of the fragment.end- The end offset of the fragment.layerIds- The IDs of the layers to load, or null if only transcript data is required.- Returns:
- The identified transcript fragment.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getFragmentSeries
public nzilbb.util.MonitorableSeries<nzilbb.ag.Graph> getFragmentSeries(String seriesId, String[] layerIds) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
NOT YET IMPLEMENTED - Gets a series of fragments, given the series' ID, and only the given layers.- Specified by:
getFragmentSeriesin interfacenzilbb.ag.GraphStoreQuery- Parameters:
seriesId- The ID of the series.layerIds- The IDs of the layers to load, or null if only transcript data is required.- Returns:
- An enumeratable series of fragments.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getMediaTracks
public nzilbb.ag.MediaTrackDefinition[] getMediaTracks() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionList the predefined media tracks available for transcripts.- Specified by:
getMediaTracksin interfacenzilbb.ag.GraphStoreQuery- Returns:
- An ordered list of media track definitions.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getAvailableMedia
public nzilbb.ag.MediaFile[] getAvailableMedia(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
List the media available for the given transcript.- Specified by:
getAvailableMediain interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The transcript ID.- Returns:
- List of media files available for the given transcript.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getMedia
public String getMedia(String id, String trackSuffix, String mimeType) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a given media track for a given transcript.- Specified by:
getMediain interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The transcript ID.trackSuffix- The track suffix of the media - seeMediaTrackDefinition.suffix.mimeType- The MIME type of the media, which may include parameters for type conversion, e.g. "text/wav; samplerate=16000".- Returns:
- A URL to the given media for the given transcript, or null if the given media doesn't exist.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getMediaFile
public File getMediaFile(String id, String trackSuffix, String mimeType, File dir) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a given media track for a given transcript.This method calls
getMedia(String,String,String)and then downloads the media of the given URL to a file.- Parameters:
id- The transcript ID.trackSuffix- The track suffix of the media - seeMediaTrackDefinition.suffix.mimeType- The MIME type of the media, which may include parameters for type conversion, e.g. "text/wav; samplerate=16000".dir- A directory in which the files should be stored, or null for a temporary folder. If specified, and the directory doesn't exist, it will be created.- Returns:
- A file containing the given media, or null if the given media doesn't exist. The caller is responsible for deleting this file once processing is complete.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getMedia
public String getMedia(String id, String trackSuffix, String mimeType, Double startOffset, Double endOffset) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Gets a given media track for a given transcript.- Specified by:
getMediain interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The transcript ID.trackSuffix- The track suffix of the media - seeMediaTrackDefinition.suffix.mimeType- The MIME type of the media, which may include parameters for type conversion, e.g. "text/wav; samplerate=16000"startOffset- The start offset of the media sample, or null for the start of the whole recording.endOffset- The end offset of the media sample, or null for the end of the whole recording.- Returns:
- A URL to the given media for the given transcript, or null if the given media doesn't exist.
- Throws:
nzilbb.ag.StoreException- If an error occurs.nzilbb.ag.PermissionException- If the operation is not permitted.nzilbb.ag.GraphNotFoundException- If the transcript was not found in the store.
-
getEpisodeDocuments
public nzilbb.ag.MediaFile[] getEpisodeDocuments(String id) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException, nzilbb.ag.GraphNotFoundException
Get a list of documents associated with the episode of the given transcript.- Specified by:
getEpisodeDocumentsin interfacenzilbb.ag.GraphStoreQuery- Parameters:
id- The transcript ID.- Returns:
- List of URLs to documents.
- 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.
-
taskStatus
public TaskStatus taskStatus(String threadId) throws IOException, nzilbb.ag.StoreException
Gets the current state of the given task.- Parameters:
threadId- The ID of the task.- Returns:
- The status of the task
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
taskStatus
public TaskStatus taskStatus(String threadId, boolean log, boolean keepalive) throws IOException, nzilbb.ag.StoreException
Gets the current state of the given task.- Parameters:
threadId- The ID of the task.log- Whether to include the task log with the status.keepalive- Whether querying the status should keep the task alive or not.- Returns:
- The status of the task
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
waitForTask
public TaskStatus waitForTask(String threadId, int maxSeconds) throws IOException, nzilbb.ag.StoreException
Wait for the given task to finish.- Parameters:
threadId- The ID of the task.maxSeconds- The maximum time to wait for the task, or 0 for forever.- Returns:
- The final task status.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
cancelTask
public void cancelTask(String threadId) throws IOException, nzilbb.ag.StoreException
Cancels a running task.- Parameters:
threadId- The ID of the task.- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
releaseTask
public void releaseTask(String threadId) throws IOException, nzilbb.ag.StoreException
Release a finished task, to free up server resources.- Parameters:
threadId- The ID of the task.- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getTasks
public String[] getTasks() throws IOException, nzilbb.ag.StoreException
Gets a list of all tasks on the server.- Returns:
- A list of all task IDs.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
cancel
public void cancel()
Cancel the current request, if possible.
-
isCancelling
public boolean isCancelling()
Determines whether or not the request is being cancelled.- Returns:
- true, if the last request has been asked to cancel, false otherwise
-
search
public String search(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipantOnly, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold) throws IOException, nzilbb.ag.StoreException
Searches for tokens that match the given pattern.The pattern must match the structure of the search matrix in the browser interface of LaBB-CAT. This is a JSON object with one attribute called
columns
, which is an array of JSON objects.Each element in the
columns
array contains a JSON object namedlayers
, whose value is a JSON object for patterns to match on each layer, and optionally an element namedadj
, whose value is a number representing the maximum distance, in tokens, between this column and the next column - ifadj
is not specified, the value defaults to 1, so tokens are contiguous. Each element in thelayers
JSON object is named after the layer it matches, and the value is a named list with the following possible attributes:- pattern
- A regular expression to match against the label
- min
- An inclusive minimum numeric value for the label
- max
- An exclusive maximum numeric value for the label
- not
- TRUE to negate the match
- anchorStart
- TRUE to anchor to the start of the annotation on this layer (i.e. the matching word token will be the first at/after the start of the matching annotation on this layer)
- anchorEnd
- TRUE to anchor to the end of the annotation on this layer (i.e. the matching word token will be the last before/at the end of the matching annotation on this layer)
- target
- TRUE to make this layer the target of the search; the results will contain one row for each match on the target layer
Examples of valid pattern objects include:
// words starting with 'ps...' JsonObject pattern = new JsonObject() .put("columns", new JsonArray() .put(new JsonObject() .put("layers", new JsonObject() .put("orthography", new JsonObject() .put("pattern", "ps.*"))))); // the word 'the' followed immediately or with one intervening word by // a hapax legomenon (word with a frequency of 1) that doesn't start with a vowel JsonObject pattern2 = new JsonObject() .put("columns", new JsonArray() .put(new JsonObject() .put("layers", new JsonObject() .put("orthography", new JsonObject() .put("pattern", "the"))), .put("adj", 2)), .put(new JsonObject() .put("layers", new JsonObject() .put("phonemes", new JsonObject() .put("not", Boolean.TRUE) .put("pattern","[cCEFHiIPqQuUV0123456789~#\\$@].*")), .put("frequency", new JsonObject() .put("max", "2")))));The PatternBuilder class is designed to make constructing valid patterns easier:
// words starting with 'ps...' JsonObject pattern = new PatternBuilder().addMatchLayer("orthography", "ps.*").build(); // the word 'the' followed immediately or with one intervening word by // a hapax legomenon (word with a frequency of 1) that doesn't start with a vowel JsonObject pattern2 = new PatternBuilder() .addColumn() .addMatchLayer("orthography", "the") .addColumn() .addNotMatchLayer("phonemes", "[cCEFHiIPqQuUV0123456789~#\\$@].*") .addMaxLayer("frequency", 2) .build();- Parameters:
pattern- An object representing the pattern to search for, which mirrors the Search Matrix in the browser interface.participantIds- An optional list of participant IDs to search the utterances of. If null, all utterances in the corpus will be searched.transcriptTypes- An optional list of transcript types to limit the results to. If null, all transcript types will be searched.mainParticipantOnly- true to search only main-participant utterances, false to search all utterances.offsetThreshold- Optional minimum alignment confidence for matching word or segment annotations. A value of 50 means that annotations that were at least automatically aligned will be returned. Use 100 for manually-aligned annotations only, and 0 or no value to return all matching annotations regardless of alignment confidence.matchesPerTranscript- Optional maximum number of matches per transcript to return.nullmeans all matches.overlapThreshold- Optional percentage overlap with other utterances before simultaneous speech is excluded.nullmeans include all overlapping utterances.- Returns:
- The threadId of the resulting task, which can be passed in to
getMatches(String,int),taskStatus(String),waitForTask(String,int), etc. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
getMatches(String,int),PatternBuilder
-
getMatches
public Match[] getMatches(String threadId, int wordsContext) throws IOException, nzilbb.ag.StoreException
Gets a list of tokens that were matched bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).If the task is still running, then this function will wait for it to finish.
This means calls can be stacked like this:
Matches[] matches = labbcat.getMatches( labbcat.search( new PatternBuilder().addMatchLayer("orthography", "and").build(), participantIds, true, true, null, null), 1);- Parameters:
threadId- A task ID returned bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).wordsContext- Number of words context to include in theBefore Match
andAfter Match
columns in the results.- Returns:
- A list of IDs that can be used to identify utterances/tokens that were matched by
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer), or null if the task was cancelled. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getMatches
public Match[] getMatches(String threadId, int wordsContext, Integer pageLength, Integer pageNumber) throws IOException, nzilbb.ag.StoreException
Gets a list of tokens that were matched bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).If the task is still running, then this function will wait for it to finish.
This means calls can be stacked like this:
Matches[] matches = labbcat.getMatches( labbcat.search( new PatternBuilder().addMatchLayer("orthography", "and").build(), participantIds, true, false, null, 5), 1);- Parameters:
threadId- A task ID returned bysearch(JsonObject,String[],String[],boolean,Integer,Integer,Integer).wordsContext- Number of words context to include in theBefore Match
andAfter Match
columns in the results.pageLength- The maximum number of matches to return, or null to return all.pageNumber- The zero-based page number to return, or null to return the first page.- Returns:
- A list of IDs that can be used to identify utterances/tokens that were matched by
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer), or null if the task was cancelled. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getMatches
public Match[] getMatches(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipant, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold, int wordsContext) throws IOException, nzilbb.ag.StoreException
Searches for tokens that match the givem pattern and returns a list of matches.This is similar to invoking:
Matches[] matches = labbcat.getMatches( labbcat.search(pattern, participantIds, mainParticipant, aligned, matchesPerTranscript, overlapThreshold), wordsContext);As with
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer)the pattern must match the structure of the search matrix in the browser interface of LaBB-CAT.The PatternBuilder class is designed to make constructing valid patterns easier:
// words starting with 'ps...' JsonObject pattern = new PatternBuilder().addMatchLayer("orthography", "ps.*").build(); // the word 'the' followed immediately or with one intervening word by // a hapax legomenon (word with a frequency of 1) that doesn't start with a vowel JsonObject pattern2 = new PatternBuilder() .addColumn() .addMatchLayer("orthography", "the") .addColumn() .addNotMatchLayer("phonemes", "[cCEFHiIPqQuUV0123456789~#\\$@].*") .addMaxLayer("frequency", 2) .build();- Parameters:
pattern- An object representing the pattern to search for, which mirrors the Search Matrix in the browser interface.participantIds- An optional list of participant IDs to search the utterances of. If not null, all utterances in the corpus will be searched.transcriptTypes- An optional list of transcript types to limit the results to. If null, all transcript types will be searched.mainParticipant- true to search only main-participant utterances, false to search all utterances.offsetThreshold- The minimum confidence for alignments, e.g.- 0 - return all alignments, regardless of confidence;
- 50 - return only alignments that have been at least automatically aligned;
- 100 - return only manually-set alignments.
matchesPerTranscript- Optional maximum number of matches per transcript to return.nullmeans all matches.overlapThreshold- Optional percentage overlap with other utterances before simultaneous speech is excluded.nullmeans include all overlapping utterances.wordsContext- Number of words context to include in theBefore Match
andAfter Match
columns in the results.- Returns:
- A list of IDs that can be used to identify utterances/tokens that were matched by
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer), or null if the task was cancelled. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getMatches
public Match[] getMatches(javax.json.JsonObject pattern, String[] participantIds, String[] transcriptTypes, boolean mainParticipant, Integer offsetThreshold, Integer matchesPerTranscript, Integer overlapThreshold, int wordsContext, Integer maxMatches) throws IOException, nzilbb.ag.StoreException
Searches for tokens that match the given pattern and returns the first maxMatches matches.This is similar to invoking:
Matches[] matches = labbcat.getMatches( labbcat.search(pattern, participantIds, mainParticipant, aligned, matchesPerTranscript, overlapThreshold), wordsContext);As with
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer)the pattern must match the structure of the search matrix in the browser interface of LaBB-CAT.The PatternBuilder class is designed to make constructing valid patterns easier:
// words starting with 'ps...' JsonObject pattern = new PatternBuilder().addMatchLayer("orthography", "ps.*").build(); // the word 'the' followed immediately or with one intervening word by // a hapax legomenon (word with a frequency of 1) that doesn't start with a vowel JsonObject pattern2 = new PatternBuilder() .addColumn() .addMatchLayer("orthography", "the") .addColumn() .addNotMatchLayer("phonemes", "[cCEFHiIPqQuUV0123456789~#\\$@].*") .addMaxLayer("frequency", 2) .build();- Parameters:
pattern- An object representing the pattern to search for, which mirrors the Search Matrix in the browser interface.participantIds- An optional list of participant IDs to search the utterances of. If not null, all utterances in the corpus will be searched.transcriptTypes- An optional list of transcript types to limit the results to. If null, all transcript types will be searched.mainParticipant- true to search only main-participant utterances, false to search all utterances.offsetThreshold- The minimum confidence for alignments, e.g.- 0 - return all alignments, regardless of confidence;
- 50 - return only alignments that have been at least automatically aligned;
- 100 - return only manually-set alignments.
matchesPerTranscript- Optional maximum number of matches per transcript to return.nullmeans all matches.overlapThreshold- Optional percentage overlap with other utterances before simultaneous speech is excluded.nullmeans include all overlapping utterances.wordsContext- Number of words context to include in theBefore Match
andAfter Match
columns in the results.maxMatches- The maximum number of matches to return, or null to return all.- Returns:
- A list of IDs that can be used to identify utterances/tokens that were matched by
search(JsonObject,String[],String[],boolean,Integer,Integer,Integer), or null if the task was cancelled. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getMatchAnnotations
public nzilbb.ag.Annotation[][] getMatchAnnotations(Match[] matches, String[] layerIds, int targetOffset, int annotationsPerLayer) throws IOException, nzilbb.ag.StoreException
Gets annotations on selected layers related to search results returned by a previous call togetMatches(String,int).- Parameters:
matches- A list ofMatches.layerIds- A vector of layer IDs.targetOffset- The distance from the original target of the match, e.g.- 0 - find annotations of the match target itself
- 1 - find annotations of the token immediately after match target
- -1 - find annotations of the token immediately before match target
annotationsPerLayer- The number of annotations on the given layer to retrieve. In most cases, there's only one annotation available. However, tokens may, for example, be annotated with `all possible phonemic transcriptions', in which case using a value of greater than 1 for this parameter provides other phonemic transcriptions, for tokens that have more than one.- Returns:
- An array of arrays of Annotations, of dimensions matchIds.length × (layerIds.length * annotationsPerLayer). The first index matches the corresponding index in matchIds.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getMatchAnnotations
public nzilbb.ag.Annotation[][] getMatchAnnotations(String[] matchIds, String[] layerIds, int targetOffset, int annotationsPerLayer) throws IOException, nzilbb.ag.StoreException
Gets annotations on selected layers related to search results returned by a previous call togetMatches(String,int),taskStatus(String).- Parameters:
matchIds- A list ofMatch.getMatchId()s.layerIds- A vector of layer IDs.targetOffset- The distance from the original target of the match, e.g.- 0 - find annotations of the match target itself
- 1 - find annotations of the token immediately after match target
- -1 - find annotations of the token immediately before match target
annotationsPerLayer- The number of annotations on the given layer to retrieve. In most cases, there's only one annotation available. However, tokens may, for example, be annotated with `all possible phonemic transcriptions', in which case using a value of greater than 1 for this parameter provides other phonemic transcriptions, for tokens that have more than one.- Returns:
- An array of arrays of Annotations, of dimensions matchIds.length × (layerIds.length * annotationsPerLayer). The first index matches the corresponding index in matchIds.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.- See Also:
}
-
getSoundFragments
public File[] getSoundFragments(Match[] matches, Integer sampleRate, File dir) throws IOException, nzilbb.ag.StoreException
Downloads WAV sound fragments.This utility method translates a
Matcharray of the kind returned bygetMatches(String,int)to the parallel arrays required bygetSoundFragments(String[],Double[],Double[],Integer,File), usingMatchId.- Parameters:
matches- A list ofMatches, perhaps returned bygetMatches(String,int).sampleRate- The desired sample rate, or null for no preference.dir- A directory in which the files should be stored, or null for a temporary folder. If specified, and the directory doesn't exist, it will be created.- Returns:
- A list of WAV files. If dir is null, these files will be stored under the system's temporary directory, so once processing is finished, they should be deleted by the caller, or moved to a more permanent location.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getSoundFragments
public File[] getSoundFragments(String[] transcriptIds, Double[] startOffsets, Double[] endOffsets, Integer sampleRate, File dir) throws IOException, nzilbb.ag.StoreException
Downloads WAV sound fragments.- Parameters:
transcriptIds- A list of transcript IDs (transcript names).startOffsets- A list of start offsets, with one element for each element in transcriptIds.endOffsets- A list of end offsets, with one element for each element in transcriptIds.sampleRate- The desired sample rate, or null for no preference.dir- A directory in which the files should be stored, or null for a temporary folder. If specified, and the directory doesn't exist, it will be created.- Returns:
- A list of WAV files. If dir is null, these files will be stored under the system's temporary directory, so once processing is finished, they should be deleted by the caller, or moved to a more permanent location.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getFragments
public File[] getFragments(Match[] matches, String[] layerIds, String mimeType, File dir) throws IOException, nzilbb.ag.StoreException
Get transcript fragments in a specified format.This utility method translates a
Matcharray of the kind returned bygetMatches(String,int)to the parallel arrays required bygetFragments(String[],Double[],Double[],String[],String,File), usingMatchId.- Parameters:
matches- A list ofMatches, perhaps returned bygetMatches(String,int).layerIds- A list of IDs of annotation layers to include in the fragment.mimeType- The desired format, for example "text/praat-textgrid" for Praat TextGrids, "text/plain" for plain text, etc.dir- A directory in which the files should be stored, or null for a temporary folder. If specified, and the directory doesn't exist, it will be created.- Returns:
- A list of files. If dir is null, these files will be stored under the system's temporary directory, so once processing is finished, they should be deleted by the caller, or moved to a more permanent location.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getFragments
public File[] getFragments(String[] transcriptIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds, String mimeType, File dir) throws IOException, nzilbb.ag.StoreException
Get transcript fragments in a specified format.- Parameters:
transcriptIds- A list of transcript IDs (transcript names).startOffsets- A list of start offsets, with one element for each element in transcriptIds.endOffsets- A list of end offsets, with one element for each element in transcriptIds.layerIds- A list of IDs of annotation layers to include in the fragment.mimeType- The desired format, for example "text/praat-textgrid" for Praat TextGrids, "text/plain" for plain text, etc.dir- A directory in which the files should be stored, or null for a temporary folder. If specified, and the directory doesn't exist, it will be created.- Returns:
- A list of files. If dir is null, these files will be stored under the system's temporary directory, so once processing is finished, they should be deleted by the caller, or moved to a more permanent location.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
processWithPraat
public String processWithPraat(String[] matchIds, Double[] startOffsets, Double[] endOffsets, String praatScript, Double windowOffset, String[] attributes) throws IOException, nzilbb.ag.StoreException
Executes Praat on the server in order to perform acoustic analysis on a given collection of sound fragments.- Parameters:
matchIds- An array of annotation IDs, e.g. the MatchId column, or the URL column, of a results set.startOffsets- An array of start times in seconds, which must have the same number of elements as matchIds.endOffsets- An array of end times in seconds, which must have the same number of elements as matchIds.praatScript- Script to run on each match.windowOffset- In many circumstances, you will want some context before and after the sample start/end time. For this reason, you can specify a "window offset" - this is a number of seconds to subtract from the sample start and add to the sample end time, before extracting that part of the audio for processing. For example, if the sample starts at 2.0s and ends at 3.0s, and you set the window offset to 0.5s, then Praat will extract a sample of audio from 1.5s to 3.5s, and do the selected processing on that sample. The best value for this depends on what the praat.script is doing; if you are getting formants from vowels, including some context ensures that the formants at the edges are more accurate (in LaBB-CAT's web interface, the default value for this 0.025), but if you're getting max pitch or COG during a segment, most likely you want a window.offset of 0 to ensure neighbouring segments doesn't influence the measurement.attributes- Array of participant attributes to make available to the script. For example, if you want to use different acoustic parameters depending on what the gender of the speaker is, including the "participant_gender" attribute will make a variable called participant_gender$ available to the praat script, whose value will be the gender of the speaker for that segment.- Returns:
- The threadId of the resulting task, the result of which will be a CSV file
containing acoustic measurs. The threadId can be passed in to
taskStatus(String),waitForTask(String,int), etc. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
processWithPraat
public String processWithPraat(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String script, Double windowOffset, String[] attributes) throws IOException, nzilbb.ag.StoreException
Executes Praat on the server in order to perform acoustic analysis on a given collection of sound fragments.- Parameters:
transcriptIds- An array of Transcript IDs identifying the recording that the sample comes from.participantIds- An array of Participant IDs, which must have the same number of elements as transcriptIds, identifying the speaker of the speech sample (e.g. so that their gender can be identified, for calibrating script parameters).startOffsets- An array of start times in seconds, which must have the same number of elements as transcriptIds.endOffsets- An array of end times in seconds, which must have the same number of elements as transcriptIds.script- Praat script to run on each match.windowOffset- In many circumstances, you will want some context before and after the sample start/end time. For this reason, you can specify a "window offset" - this is a number of seconds to subtract from the sample start and add to the sample end time, before extracting that part of the audio for processing. For example, if the sample starts at 2.0s and ends at 3.0s, and you set the window offset to 0.5s, then Praat will extract a sample of audio from 1.5s to 3.5s, and do the selected processing on that sample. The best value for this depends on what the praat.script is doing; if you are getting formants from vowels, including some context ensures that the formants at the edges are more accurate (in LaBB-CAT's web interface, the default value for this 0.025), but if you're getting max pitch or COG during a segment, most likely you want a window.offset of 0 to ensure neighbouring segments doesn't influence the measurement.attributes- Array of participant attributes to make available to the script. For example, if you want to use different acoustic parameters depending on what the gender of the speaker is, including the "participant_gender" attribute will make a variable called participant_gender$ available to the praat script, whose value will be the gender of the speaker for that segment.- Returns:
- The threadId of the resulting task, the result of which will be a CSV file
containing acoustic measures.
The threadId can be passed in to
taskStatus(String),waitForTask(String,int), etc. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
intervalAnnotations
public String intervalAnnotations(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds) throws IOException, nzilbb.ag.StoreException
Concatenates annotation labels for given labels contained in given time intervals, using a space delimiter for labels, and requiring complete (rather than partial) containment.- Parameters:
transcriptIds- An array of Transcript IDs identifying the recording that the sample comes from.participantIds- An array of Participant IDs, which must have the same number of elements as transcriptIds, identifying the speaker of the speech sample (e.g. so that their gender can be identified, for calibrating script parameters).startOffsets- An array of start times in seconds, which must have the same number of elements as transcriptIds.endOffsets- An array of end times in seconds, which must have the same number of elements as transcriptIds.layerIds- IDs of layers to extract.- Returns:
- The threadId of the resulting task, the result of which will be a CSV file
with columns containing the annotation labels.
The threadId can be passed in to
taskStatus(String),waitForTask(String,int), etc. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
intervalAnnotations
public String intervalAnnotations(String[] transcriptIds, String[] participantIds, Double[] startOffsets, Double[] endOffsets, String[] layerIds, String labelDelimiter, boolean partialContainment) throws IOException, nzilbb.ag.StoreException
Concatenates annotation labels for given labels contained in given time intervals.- Parameters:
transcriptIds- An array of Transcript IDs identifying the recording that the sample comes from.participantIds- An array of Participant IDs, which must have the same number of elements as transcriptIds, identifying the speaker of the speech sample (e.g. so that their gender can be identified, for calibrating script parameters).startOffsets- An array of start times in seconds, which must have the same number of elements as transcriptIds.endOffsets- An array of end times in seconds, which must have the same number of elements as transcriptIds.layerIds- IDs of layers to extract.labelDelimiter- Delimiter to use between labels. Defaults to a space " ".partialContainment- false if the annotations must be entirely between the start and end times, true if they can extend before the start or after the end.- Returns:
- The threadId of the resulting task, the result of which will be a CSV file
with columns containing the annotation labels.
The threadId can be passed in to
taskStatus(String),waitForTask(String,int), etc. - Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getTranscriptAttributes
public File getTranscriptAttributes(String[] transcriptIds, String[] layerIds) throws IOException, nzilbb.ag.StoreException
Gets transcript attribute values for given transcript IDs.- Parameters:
transcriptIds- A list of transcript IDs (transcript names).layerIds- A list of layer IDs corresponding to transcript attributes. In general, these are layers whose ID is prefixed 'transcript_', however formally it's any layer where layer.getParentId().equals("graph") && layer.getAlignment() == 0, which includes "corpus" as well as transcript attribute layers.- Returns:
- A CSV file with the attribute values, which it is the caller's responsibility to delete once processing is finished.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getParticipantAttributes
public File getParticipantAttributes(String[] participantIds, String[] layerIds) throws IOException, nzilbb.ag.StoreException
Gets participant attribute values for given participant IDs.- Parameters:
participantIds- A list of participant IDs (participant names).layerIds- A list of layer IDs corresponding to participant attributes. In general, these are layers whose ID is prefixed 'participant_', however formally it's any layer where layer.getParentId().equals("parent") && layer.getAlignment() == 0.- Returns:
- A CSV file with the attribute values, which it is the caller's responsibility to delete once processing is finished.
- Throws:
IOException- If a communications error occurs.nzilbb.ag.StoreException- If the server returns an error.
-
getSerializerDescriptors
public nzilbb.ag.serialize.SerializationDescriptor[] getSerializerDescriptors() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionLists the descriptors of all registered serializers.Serializers are modules that export annotation structures as a specific file format, e.g. Praat TextGrid, plain text, etc., so the
SerializationDescriptor.getMimeType()of descriptors reflects what mimeTypes can be specified forgetFragments(String[],Double[],Double[],String[],String,File)andgetFragments(Match[],String[],String,File).- Specified by:
getSerializerDescriptorsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of the descriptors of all registered serializers.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation from completing.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getDeserializerDescriptors
public nzilbb.ag.serialize.SerializationDescriptor[] getDeserializerDescriptors() throws nzilbb.ag.StoreException, nzilbb.ag.PermissionExceptionLists the descriptors of all registered deserializers.Deserializers are modules that import annotation structures from a specific file format, e.g. Praat TextGrid, plain text, etc.
- Specified by:
getDeserializerDescriptorsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of the descriptors of all registered deserializers.
- Throws:
nzilbb.ag.StoreException- If an error prevents the descriptors from being listed.nzilbb.ag.PermissionException- If listing the deserializers is not permitted.
-
serializerForFilesSuffix
public nzilbb.ag.serialize.GraphSerializer serializerForFilesSuffix(String suffix) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
NOT YET IMPLEMENTED - Gets the serializer for the given file suffix (extension).- Specified by:
serializerForFilesSuffixin interfacenzilbb.ag.GraphStoreQuery- Parameters:
suffix- The file extension.- Returns:
- The serializer for the given suffix, or null if none is registered.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.
-
deserializerForMimeType
public nzilbb.ag.serialize.GraphDeserializer deserializerForMimeType(String mimeType) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
NOT YET IMPLEMENTED - Gets the deserializer for the given MIME type.- Specified by:
deserializerForMimeTypein interfacenzilbb.ag.GraphStoreQuery- Parameters:
mimeType- The MIME type.- Returns:
- The deserializer for the given MIME type, or null if none is registered.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.
-
deserializerForFilesSuffix
public nzilbb.ag.serialize.GraphDeserializer deserializerForFilesSuffix(String suffix) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
NOT YET IMPLEMENTED - Gets the deserializer for the given file suffix (extension).- Specified by:
deserializerForFilesSuffixin interfacenzilbb.ag.GraphStoreQuery- Parameters:
suffix- The file extension.- Returns:
- The deserializer for the given suffix, or null if none is registered.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.
-
serializerForMimeType
public nzilbb.ag.serialize.GraphSerializer serializerForMimeType(String mimeType) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
NOT YET IMPLEMENTED - Gets the serializer for the given MIME type.- Specified by:
serializerForMimeTypein interfacenzilbb.ag.GraphStoreQuery- Parameters:
mimeType- The MIME type.- Returns:
- The serializer for the given MIME type, or null if none is registered.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- If the operation is not permitted.
-
getAnnotatorDescriptor
public nzilbb.ag.automation.util.AnnotatorDescriptor getAnnotatorDescriptor(String annotatorId) throws nzilbb.ag.StoreException, ResponseException
Gets a descriptor of the annotator with the given ID.- Parameters:
annotatorId- The ID of the annotator.- Returns:
- A descriptor of the given annotator, or null if there is no registered annotator with the given ID.
- Throws:
nzilbb.ag.StoreException- If the server returns an error.ResponseException- If some other error occurs.
-
getTranscriberDescriptors
public nzilbb.ag.automation.util.AnnotatorDescriptor[] getTranscriberDescriptors()
Lists descriptors of all transcribers that are installed.- Specified by:
getTranscriberDescriptorsin interfacenzilbb.ag.GraphStoreQuery- Returns:
- A list of descriptors of all transcribers that are installed.
-
getSystemAttribute
public String getSystemAttribute(String attribute) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Gets the value of the given system attribute.- Parameters:
attribute- Name of the attribute.- Returns:
- The value of the given attribute.
- Throws:
nzilbb.ag.StoreException- If an error prevents the descriptors from being listed.nzilbb.ag.PermissionException- If listing the deserializers is not permitted.
-
getUserInfo
public User getUserInfo() throws nzilbb.ag.StoreException
Gets information about the current user, including the roles or groups they are in.- Returns:
- The user record.
- Throws:
nzilbb.ag.StoreException- If an error occurs while trying to retrieve the user information.
-
getDictionaries
public Map<String,List<String>> getDictionaries() throws nzilbb.ag.StoreException
List dictionaries available.- Returns:
- A map of layer manager IDs to lists of dictionary IDs.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.
-
getDictionaryEntries
public File getDictionaryEntries(String managerId, String dictionaryId, String[] keys) throws nzilbb.ag.StoreException
Lookup entries in a dictionary.- Parameters:
managerId- The ID of the layer manager.dictionaryId- The ID of the dictionary.keys- The keys to fetch entries for.- Returns:
- A CSV file with the entries, which it is the caller's responsibility to delete once processing is finished.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.
-
changePassword
public void changePassword(String currentPassword, String newPassword) throws nzilbb.ag.StoreException
Change the password of the currently-logged-in user.- Parameters:
currentPassword- The user's current password.newPassword- The new password.- Throws:
nzilbb.ag.StoreException- If an error occurs, e.g. there is no current user, or the currentPassword is incorrect.
-
getDashboardItems
public DashboardItem[] getDashboardItems(String dashboard) throws nzilbb.ag.StoreException
Lists configured items for the given dashboard.- Parameters:
dashboard- Which dashboard to get items for "home", "statistics", or "express"- Returns:
- A list of dashboard items for the given dashboard.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.
-
getDashboardItem
public String getDashboardItem(int itemId) throws nzilbb.ag.StoreException
Gets the value of one dashboard item.- Parameters:
itemId- The ID of the item.- Returns:
- The value of the item.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.
-
getCorpusInfo
public Map<String,String> getCorpusInfo(String corpusId) throws nzilbb.ag.StoreException
Gets statistics about a given corpus.- Parameters:
corpusId- ID of the corpus.- Returns:
- A map of statistic names to their and the values.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.
-
readCategories
public Category[] readCategories(String classId) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Reads a list of category records.- Parameters:
classId- What to read the categories of - "trascript" or "participant".- Returns:
- A list of categories.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- See Also:
readCategories(String,Integer,Integer)
-
readCategories
public Category[] readCategories(String classId, Integer pageNumber, Integer pageLength) throws nzilbb.ag.StoreException, nzilbb.ag.PermissionException
Reads a list of category records.- Parameters:
classId- What to read the categories of - "trascript" or "participant".pageNumber- The zero-based page of records to return (if null, all records will be returned).pageLength- The length of pages (if null, the default page length is 20).- Returns:
- A list of categories.
- Throws:
nzilbb.ag.StoreException- If an error prevents the operation.nzilbb.ag.PermissionException- See Also:
readCategories(String)
-
FileNameFromContentDisposition
public static String FileNameFromContentDisposition(String contentDisposition)
Infers the filename from a given Content-Disposition header.- Parameters:
contentDisposition- The Content-Disposition header, or null.- Returns:
- Suggested file name, or null if none could be determined.
-
-