Details
-
Sub-task
-
Resolution: Fixed
-
None
-
None
-
None
-
Empty show more show less
Description
Information: an openTM2-TM consists 2 files: The TM-file and an index-File
Calls needed for openTM2 REST-Server
- import openTM2-TM (this simply should save the TM-files to a location, where openTM2 can use them; params: filenames and files; error-message, if filename exists)
- delete openTM2-TM (this should simply delete the TM-file; params: filenames)
- create new empty openTM2-TM (params: sourceLang, targetLang, filename (both TM-files should have the same name, but different exensions; error-message, if filename exists)
- import TMX (params: file, openTM2-filename (in which the file should be imported)
- query TM for Matches (for first release uses the default search settings); Params: filename(s) (filenames in the same order, as the returned matches should be ordered, if they have the same Match-Percentage; else order by match-percentage even across different TMs); sourceSeg (with internal tags as <bpt>, <ept> und <ph>-tags, as in xliff 1.2 syntax))
- query TM for concordance search; Params: filename text2searchFor, boolean searchSource (if true, source is searched, else target), numberOfMatchesToReturn, identifierWhereToStartSearch (can be empty)
- save new entry to TM (existing entry with same source gets updated); Params: filename, sourceSeg, targetSeg (with internal tags as <bpt>, <ept> und <ph>-tags, as in xliff 1.2 syntax))
=> use http-error-codes: 500 on general exception - should include meaningfull error-message in response-body, 403 on missing access-rights; 404 if TM is not found; but no 404 if search has no result. In this case empty result set.
Remarks regarding concordance search
- concordance search needs a pager (the information, how many matches to return and where to start the search), because otherwise with large TMs and a query for ordinary words the response would be huge. And in general with large TMs it would have to search the whole TM before it would be able to answer.
- therefore still with a large TM it could take some time until OpenTM2 answers. Therefore OpenTM2 will implement a caching mechanism for concordance search requests to make sure that if the same request will come within a defined time, it will be able to answer it fast. In addition, if the same request comes a second time, while the first (same) request is still running, the second request should wait for the result of the first request and deliver its cache result instead of starting the same calculation again. This gives translate5 (or the user) the possibility to reask for a concordance search request, that timeouted in the browser.
Opening and closing a TM
In first concept it was planned to implement routines to open and close a TM. While conceptioning we found some problems with this approach:
First one is the realization: opening and closing a TM by REST would mean to update the TM Resource and set a state to open or close. This is very awkward.
Since in translate5 multiple tasks can be used to the same time, multiple tasks try to access one TM. Closing TMs is getting complicated to prevent race conditions in TM usage.
OpenTM2 therefore has to automatically load the requested TMs if requested. Also if OpenTM2 needs to open another TM and has no memory available any more (because to many memories are open), it has to close the memory which received for the longest time no request any more. That means that OpenTM2 has to track the timestamps when a TM was last requested.