Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Openning and closing TM

In first concept it was planned to implement routines to open and close a TM. While concepting we found some problemes 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.
  • Since OpenTM2 loads the whole TM in memory, OpenTM2 must control itself which TMs are loaded or not.

This leads to the following conclusion in implementation of opening and closing of TMs:

OpenTM2 has to automatically load the requested TMs if requested. Also OpenTM2 has to close the TMs after a TM was not used for some time. That means that OpenTM2 has to track the timestamps when a TM was last requested.


Concept endpoints, not implemented

http://opentm2/translationmemory/[TM_Name]/openHandle

GET – Opens a memory for queries by OpenTM2

Note: This method is not required as memories are automatically opened when they are accessed for the first time.

http://opentm2/translationmemory/[TM_Name]/openHandle

DELETE – Closes a memory for queries by OpenTM2

Note: This method is not required as memories are automatically opened when they are accessed for the first time.


For now we open  TM in case of call to work with it. TM stays opened till the shutdown we wouldn't try to open more TM's, exceeding the RAM limit setupped in config file. 
In that case we would close TM in order of longest not used, till we would fit in limit including TM that we try to open.
 TM size is calcucated basicaly as sum .TMD and .TMI files
Ram limit doesn't include service RAM and temporary files






TAG REPLACEMENT

Pseudocode for tag replacement in import call:

Code Block
languagejs
titleResponse
collapsetrue
TAG_REPLACEMENT PSEUDOCODE 
	
struct TagInfo
 {
    bool fPairTagClosed = true;           // false for bpt tag - waiting for matching ept tag. If we'll find matching tag -> we'll set this to true 
    bool fTagAlreadyUsedInTarget = false; // would be set to true if we would already use this tag as matching for target

	// this we generate to save in TM. this would be saved as <{generated_tagType} [x={generated_x}] [i={generated_i}]/>. 
	// we would skip x attribute for generated_tagType=EPT_ELEMENT and i for generated_tagType=PH_ELEMENT
    int generated_i = -1;                 // for pair tags - generated identifier to find matching tag. the same as in original_i if it's not binded to other tag in segment
    int generated_x = -1;                 // id of tag. should match original_x, if it's not occupied by other tags
    TagType generated_tagType = UNKNOWN_ELEMENT; // replaced tagType, could be only PH_ELEMENT, BPT_ELEMENT, EPT_ELEMENT  

	// this cant be generated, only saved from provided data 
    int original_i = -1;        // original paired tags i
    int original_x = -1;        // original id of tag
    TagType original_tagType = UNKNOWN_ELEMENT;  // original tagType, could be any tag
  };
}

we use 3 lists of tags 
SOURCE_TAGS
TARGET_TAGS
REQUEST_TAGS
as id we understand one of following attributes(which is present in original tag) : 'x', 'id' 
as i  we understand one of following attributes(which is present in original tag) : 'i', 'rid' 
all single tags we understand as ph_tag
all opening pair tags we understand as bpt_tag
all closing pair tags we understand as ept_tag
-1 means that value is not found/not used/not provided etc.
for ept tags in generated_id  we would use generated_id from matching bpt tag 
	if matching bpt tag is not found -> ???

TagType could be set to one of following values


TAG REPLACEMENT USE CASES {
	IMPORT{ 
		SOURCE_SEGMENT{			
			<single tags> -> would be saved as <ph>{ // for ph and all single tags 
				if(type == "lb"){
					replace with newline
				}else{
					generate next generated_id incrementally
					ignore content and attributes(except id) if provided	
					set  generated_tagType to PH_ELEMENT					
			
					save original_tagType for matching		
					if id provided -> save as original_id for matching
					
					save tag to SOURCE_TAGS
				}
			}
			
			<opening pair tags> -> would be saved as <bpt>{
				original type is <bpt>{
					generate generated_i  incrementally in source segment
					generate generated_id incrementally
					
					set  generated_tagType to BPT_ELEMENT
					save original_i (should that always be provided??)
					save original_id if provided (should that always be provided??)
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					set  original_type as BPT_ELEMENT
					
					save tag to SOURCE_TAGS
				}
				
				original type is <bx>{
					generate generated_i  incrementally in source segment
					generate generated_id incrementally					
					set  generated_tagType to BPT_ELEMENT
					
					save original_i (should that always be provided??)
					save original_id if provided (should that always be provided??)
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					set  original_type as BX_ELEMENT
					
					save tag to SOURCE_TAGS				
				}      
				
				original type is other openning pair tags(like <g>){					
					generate generated_i  incrementally in source segment
					generate generated_id incrementally					
					set  generated_tagType to BPT_ELEMENT
					
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					save tag type as original_tagType;
					
					save tag to SOURCE_TAGS							
				}
				
			}
			
			<closing pair tags> -> would be saved as <ept>{
				original type is <ept>{
					search for matching bpt_tag in saved tags 
					
						//should we look in reverse order?
						looking in SOURCE_TAGS for matchingTag which have  [ 
														  matchingTag.fPairTagClosed    == false
                                                      AND matchingTag.generated_tagType == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
													  AND matchingTag.original_tagType  == BPT_ELEMENT
													  AND matchingTag.original_i        == our_ept_tag.original_i
													]
					if found
						set matchingTag.fPairTagClosed to true to eliminate matching one opening tag for different closing tags 
						set our_ept_tag.i  to matchingTag.i 
						set our_ept_tag.id to matchingTag.id
					else 
						generate next our_ept_tag.generated_i  incrementally in source segment // in every segment(target, source, request) i starts from 1
						generate next our_ept_tag.generated_id incrementally                   // should be unique across target, source and request segments
						
					save tag in SOURCE_TAGS				
				}
				
				original type is <ex>{					
					search for matching bpt_tag in saved tags 
					
						//should we look in reverse order?
						looking in SOURCE_TAGS for matchingTag which have  [ 
														  matchingTag.fPairTagClosed    == false
                                                      AND matchingTag.generated_tagType == BPT_ELEMENT         //all OPENING PAIR TAGs has BPT_ELEMENT here
													  AND matchingTag.original_tagType  == BX_ELEMENT
													  AND matchingTag.original_i        == our_ept_tag.original_i
													]
					if found
						set matchingTag.fPairTagClosed to true to eliminate matching one opening tag for different closing tags 
						set our_ept_tag.i  to matchingTag.i 
						set our_ept_tag.id to matchingTag.id
					else 
						generate next our_ept_tag.generated_i  incrementally in source segment  // in every segment(target, source, request) i starts from 1
						generate next our_ept_tag.generated_id incrementally					// should be unique across target, source and request segments
						
					save tag in SOURCE_TAGS				
				}
				
				original type is others closing pair tags(like </g>){
					search for matching bpt_tag in saved tags: 
						looking in SOURCE_TAGS in REVERSE for matchingTag which have  
																	[ 	  matchingTag.fPairTagClosed    == false
																	  AND matchingTag.generated_tagType == BPT_ELEMENT         //OPENING_PAIR_TAG
																	  AND matchingTag.original_tagType  == our_tag.original_tagType
																	]
					if found
						set matchingTag.fPairTagClosed to true to eliminate matching one opening tag for different closing tags 
						set our_tag.generated_i  to matchingTag.i 
						set our_tag.generated_id to matchingTag.id
					else 
						generate next our_tag.generated_i  incrementally in source segment // in every segment(target, source, request) i starts from 1
						generate next our_tag.generated_id incrementally				   // should be unique across target, source and request segments
						
					save tag in SOURCE_TAGS				
				}
			
			}			
		}
		
		
		
		
		TARGET_SEGMENT{
			<single tags> -> would be saved as <ph>{ // for ph and all single tags 
				if(type == "lb"){
					replace with newline
				}else{					
					ignore content and attributes(except id) if provided					
					save original_tagType for matching 
					
					if id provided -> save as original_id for matching
					
					search for matching ph_tag in saved tags
						looking in SOURCE_TAGS for matchingTag which have  [ 
													      matchingTag.fTagAlreadyUsedInTarget == false
                                                      AND matchingTag.generated_tagType == PH_ELEMENT         //SINGLE TAG
													  AND matchingTag.original_tagType  == our_ph_tag.original_tagType
													  AND matchingTag.original_id       == our_ph_tag.original_id
													]
					if found 
						set matchingTag.fTagAlreadyUsedInTarget = true
						set our_ph_tag.generated_id = matchingTag.generated_id // use id generated for source segment 
					else
						generate new our_ph_tag.generated_id incrementally(should be unique for SOURCE and TARGET)	
					
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
			}
			
			<opening tags> -> would be saved as <bpt>{
				original type is <bpt>{
					set  generated_tagType to BPT_ELEMENT
					save original_i (should that always be provided??)
					save original_id if provided (should that always be provided??)
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					set  original_type as BPT_ELEMENT
					
					try to found matching source tag to get generated id:
						looking in SOURCE_TAGS for matchingTag which have  [ 
																				  matchingTag.fTagAlreadyUsedInTarget    == false
																			  AND matchingTag.generated_tagType 		 == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
																			  AND matchingTag.original_tagType  		 == BPT_ELEMENT
																			  AND matchingTag.original_id                == our_bpt_tag.original_id
																			]	
				    if found:
						set  matchingTag.fTagAlreadyUsedInTarget to true
						generate our_bpt_tag.generated_i  incrementally in target segment
						set      our_bpt_tag.generated_id to matchingTag.generated_id
					else:
						generate our_bpt_tag.generated_i  incrementally // unique between all segments
						generate our_bpt_tag.generated_id incrementally // unique between all segments				
					
					save tag in TARGET_TAGS
				}
				
				original type is <bx>{ 
					set  generated_tagType to BPT_ELEMENT
					save original_i (should that always be provided??)
					save original_id if provided (should that always be provided??)
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					set  original_type as BX_ELEMENT
					
					try to found matching source tag to get generated id:
						looking in SOURCE_TAGS for matchingTag which have  [ 
																				  matchingTag.fTagAlreadyUsedInTarget    == false
																			  AND matchingTag.generated_tagType 		 == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
																			  AND matchingTag.original_tagType  		 == BX_ELEMENT
																			  AND matchingTag.original_id                == our_bpt_tag.original_id
																			]	
				    if found:
						set  matchingTag.fTagAlreadyUsedInTarget to true
						generate our_bpt_tag.generated_i  incrementally in target segment
						set      our_bpt_tag.generated_id to matchingTag.generated_id
					else:
						generate our_bpt_tag.generated_i  incrementally // unique between all segments
						generate our_bpt_tag.generated_id incrementally // unique between all segments						
				
					save tag in TARGET_TAGS
				}
				
				original type is other openning pair tags(like <g>){
					set  generated_tagType to BPT_ELEMENT
					we never have here original i attribute
					save original_id if provided (should that always be provided??)
					set  fPairTagClosed to false; // it would be set to true if we would use this tag as matching
					save  original_type
					
					try to found matching source tag to get generated id:
						looking in SOURCE_TAGS for matchingTag which have  [ 
																				  matchingTag.fTagAlreadyUsedInTarget    == false
																			  AND matchingTag.generated_tagType 		 == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
																			  AND matchingTag.original_tagType  		 == our_tag.original_tagType
																			  AND matchingTag.original_id                == our_tag.original_id
																			]	
				    if found:
						set  matchingTag.fTagAlreadyUsedInTarget to true
						generate our_tag.generated_i  incrementally in target segment
						set      our_tag.generated_id to matchingTag.generated_id
					else:
						generate our_tag.generated_i  incrementally // unique between all segments
						generate our_tag.generated_id incrementally // unique between all segments						
				
					save tag in TARGET_TAGS
				}
				
			}
			
			<closing tags> -> would be saved as <ept>{
				original type is <ept>{
					try to found matching bpt tag in TARGET_TAGS
						looking in TARGET_TAGS for matchingTag which have  [ 
																				  matchingTag.fPairTagClosed             == false
																			  AND matchingTag.generated_tagType 		 == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
																			  AND matchingTag.original_tagType  		 == BPT_ELEMENT
																			  AND matchingTag.original_i                 == our_tag.original_i
																			]	
					if found:
						set  	matchingTag.fPairTagClosed to true
						set      our_tag.generated_id to matchingTag.generated_id
						set      our_tag.generated_i  to matchingTag.generated_i					
					else:
						generate our_tag.generated_i  incrementally // unique between all segments
						generate our_tag.generated_id incrementally // unique between all segments	
						
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
				
				original type is <ex>{
					try to found matching bpt tag in TARGET_TAGS
						looking in TARGET_TAGS for matchingTag which have  [ 
																				  matchingTag.fPairTagClosed             == false
																			  AND matchingTag.generated_tagType 		 == BPT_ELEMENT         //all OPENING PAIR TAGs always has BPT_ELEMENT here
																			  AND matchingTag.original_tagType  		 == BX_ELEMENT
																			  AND matchingTag.original_i                 == our_tag.original_i
																			]	
					if found:
						set  	matchingTag.fPairTagClosed to true
						set      our_tag.generated_id to matchingTag.generated_id
						set      our_tag.generated_i  to matchingTag.generated_i					
					else:
						generate our_tag.generated_i  incrementally // unique between all segments
						generate our_tag.generated_id incrementally // unique between all segments
					
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
				
				original type is others closing pair tags(like </g>){
					
					search for matching bpt_tag in saved tags: 
						looking in TARGET_TAGS in REVERSE for matchingTag which have  
																	[ 	  matchingTag.fPairTagClosed    == false
																	  AND matchingTag.generated_tagType == BPT_ELEMENT         //OPENING_PAIR_TAG
																	  AND matchingTag.original_tagType  == our_tag.original_tagType
																	]
					if found:
						set matchingTag.fPairTagClosed to true to eliminate matching one opening tag for different closing tags 
						set our_tag.generated_i  to matchingTag.i 
						set our_tag.generated_id to matchingTag.id
					else :
						generate next our_tag.generated_i  incrementally in target segment // in every segment(target, source, request) i starts from 1
						generate next our_tag.generated_id incrementally				   // should be unique across target, source and request segments		
						
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
			}			
		}
	}

}                 



Tag replacement for fuzzy request pseudocode:

Code Block
languagejs
titleResponse
collapsetrue
TAG_REPLACEMENT PSEUDOCODE 
	
struct TagInfo
 {
    bool fPairTagClosed = true;           // false for bpt tag - waiting for matching ept tag. If we'll find matching tag -> we'll set this to true 
    bool fTagAlreadyUsedInTarget = false; // would be set to true if we would already use this tag as matching for target

	// this we generate to save in TM. this would be saved as <{generated_tagType} [x={generated_x}] [i={generated_i}]/>. 
	// we would skip x attribute for generated_tagType=EPT_ELEMENT and i for generated_tagType=PH_ELEMENT
    int generated_i = -1;                 // for pair tags - generated identifier to find matching tag. the same as in original_i if it's not binded to other tag in segment
    int generated_x = -1;                 // id of tag. should match original_x, if it's not occupied by other tags
    TagType generated_tagType = UNKNOWN_ELEMENT; // replaced tagType, could be only PH_ELEMENT, BPT_ELEMENT, EPT_ELEMENT  

	// this cant be generated, only saved from provided data 
    int original_i = -1;        // original paired tags i
    int original_x = -1;        // original id of tag
    TagType original_tagType = UNKNOWN_ELEMENT;  // original tagType, could be any tag
  };
}

we use 3 lists of tags 
SOURCE_TAGS
TARGET_TAGS
REQUEST_TAGS
as id we understand one of following attributes(which is present in original tag) : 'x', 'id' 
as i  we understand one of following attributes(which is present in original tag) : 'i', 'rid' 
all single tags we understand as ph_tag
all opening pair tags we understand as bpt_tag
all closing pair tags we understand as ept_tag
-1 means that value is not found/not used/not provided etc.
for ept tags in generated_id  we would use generated_id from matching bpt tag 
	if matching bpt tag is not found -> ???

TagType could be set to one of following values


TAG REPLACEMENT USE CASES {
	REQUEST{
	 REQUEST_SEGMENT{			
   			<single tags> {  // for ph and all single tags 
											
				save tag in REQUEST_TAGS
			}
			
			<opening tags> {
				original type is <bpt>{
					
					save tag in REQUEST_TAGS
				}
				
				original type is <bx>{ 					
				
					save tag in REQUEST_TAGS
				}
				
				original type is other openning pair tags(like <g>){			
				
					save tag in REQUEST_TAGS
				}
				
			}
			
			<closing tags> {
				original type is <ept>{
						
					save tag in REQUEST_TAGS
				}
				
				original type is <ex>{
					
					save tag in REQUEST_TAGS
				}
				
				original type is others closing pair tags(like </g>){		
		
				     save tag in REQUEST_TAGS
				}
			}  
		}

 
		SOURCE_SEGMENT{			
   			<single tags> {  // for ph and all single tags 
											
				save tag in SOURCE_TAGS
			}
			
			<opening tags> {
				original type is <bpt>{
					
					save tag in SOURCE_TAGS
				}
				
				original type is <bx>{ 					
				
					save tag in SOURCE_TAGS
				}
				
				original type is other openning pair tags(like <g>){			
				
					save tag in SOURCE_TAGS
				}
				
			}
			
			<closing tags> {
				original type is <ept>{
						
					save tag in SOURCE_TAGS
				}
				
				original type is <ex>{
					
					save tag in SOURCE_TAGS
				}
				
				original type is others closing pair tags(like </g>){				
				     save tag in SOURCE_TAGS
				}
			}  
		}
		
		
		
		
		TARGET_SEGMENT{
			<single tags> {  // for ph and all single tags 
									
					
				save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step			
			}
			
			<opening tags> {
				original type is <bpt>{
					
					save tag in TARGET_TAGS
				}
				
				original type is <bx>{ 					
				
					save tag in TARGET_TAGS
				}
				
				original type is other openning pair tags(like <g>){			
				
					save tag in TARGET_TAGS
				}
				
			}
			
			<closing tags> {
				original type is <ept>{
						
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
				
				original type is <ex>{
					
					save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
				
				original type is others closing pair tags(like </g>){				
				     save tag in TARGET_TAGS // we should track only opening pair tags in target, so theoretically can skip this step
				}
			}			
		}
	}

}                 




Previous documentation:

Code Block
languagejs
titleResponse
collapsetrue
http://opentm2/translationmemory/
POST - creating a new or importing an existing filebased binary OpenTM2 TM

The Parameter „name“ contains the TM Name as a string. The string has a maxlength of 256 chars. It can contain any characters except the characters backslash (\), slash(/), colon (:), question mark (?), asterisk (*), vertical line (|), less than sign (<), and greater than sign (>).

Uploading a file is optional, omitting a file means creating a empty TM only.

If an empty TM is created, the POST request contains only the JSON structure with the TM Name.

If an existing binary OpenTM2 file should be additionally imported to the new TM, the POST must be encoded as multipart/form-data.

The JSON structure with the meta data will then be in the first chunk of the multiparted request, the chunk must be named “meta”.

The second chunk contains the plain binary file content and must be named “data”. This binary data contains the TM content

The resulting body contains the name of the TM, as given in the POST request.




To OpenTM2 – without data / creating an empty TM:

{
sourceLang: “en”, // the source language is required for a new TM
name: „TM Name“,
[loggingThreshold:"2"]
}



Raw POST to OpenTM2 – with provided import file:

POST http://opentm2/translationmemory HTTP/1.1
Content-Type: multipart/form-data; boundary="autogenerated"

-- autogenerated
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data; name=meta

{"name":"TM Name", sourceLang:"en"}

--autogenerated
Content-Type: image/jpeg
Content-Disposition: form-data; name=data; filename=Original Filename.jpg
...TM content ...
--autogenerated--





In both cases from OpenTM2 - HTTP 200 OK:

{

name: „TM Name“

}

Errors:
400 Bad Request – if parameters are missing or are not well formed.
409 Conflict – if a memory with the given name already exists.
500 Server Error – for other technical problems.
http://opentm2/translationmemory/[TM_Name]/import
POST import a TMX file into an existing OpenTM2 TM

To OpenTM2:

multipart/form-data like on POST above, expect that no separate JSON section is needed here.

Call answers directly after the upload is done, but before the import starts with HTTP 201 – this means: Import is created and will be started now.

From OpenTM2 - HTTP 201 OK:

{ // empty JSON object, since no data expected as result here!

}

Errors:
400 Bad Request – if parameters are missing or are not well formed.
404 Not Found – if the memory of the given name does not exist
500 Server Error – for other technical problems.
http://opentm2/translationmemory/[TM_Name]/status
GET status of a TM

To OpenTM2:

multipart/form-data like on POST above, expect that no separate JSON section is needed here.

From OpenTM2 - HTTP 200 OK:

{

‘status’:’import’ //allowed status values: import, available, error

}

Errors:
400 Bad Request – if parameters are missing or are not well formed.
404 Not Found – if the memory of the given name does not exist
500 Server Error – for other technical problems.
http://opentm2/translationmemory/
GET – retrieving a list of available TM Files

To OpenTM2: -

From OpenTM2 - HTTP 200 OK:

[{

name: 'my nice TM'

}]

Errors:
500 Server Error – for other technical problems.
http://opentm2/translationmemory/[TM_Name]/
TM_Name is URL-encoded
GET – retrieving a single TM File

To OpenTM2: -

From OpenTM2 - HTTP 200 OK:

Same as POST from OpenTM2 result.

Errors:
404 Not Found – if TM file to given [TMID] in URL was not found
500 Server Error – for other technical problems.
DELETE – deletes an existing TM File

Adressed by the given URL, no body needed.

Errors:
404 Not Found – if TM file to given [TMID] in URL was not found
500 Server Error – for other technical problems.
PUT – updating an existing TM File in one request

Currently not needed, would be only to change the TM name

GET – list of all segments from TM

Currently not needed.




http://opentm2/translationmemory/[TM_Name]/entry/
POST – creates a new entry or updates target entry if match pair already exists

This method updates an existing proposal when a proposal with the same key information (source text, language, segment number, and document name) exists.

Parameters sourceLang and targetLang are containing the languages as RFC5646.

Parameters source and target are containing the entry contents to be stored. Format? plain string?

Attribute Parameters:

documentName: contains the filename where the segment resides in Translate5.
context: evaluates to Translate5 segment mid.
markupTable: OpenTM2 gets a new markup table named „translate5“, so this is the value which is delivered by Translate5.
timestamp: this parameter is not set by translate5, but calculated automatically and delivered from OpenTM2 to translate5.
author: contains the named user which provides the update / new entry
In addition there are the following OpenTM2 Attributes currently not used by translate5:
segmentNumber
additional info
type

To OpenTM2:

{

sourceLang: 'de',

targetLang: 'en',

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

documentName: 'my file.sdlxliff',

segmentNumber: ,

markupTable: 'translate5',

author: „Thomas Lauria“,

type: '',

timeStamp: '',

context: '123',

addInfo: '',

[loggingThreshold:"2"]

}

The result from the server contains the same data as posted to the server. No additonal ID is added, since the entries are identified by the whole source string instead by an ID, only the timestamp is added.

From OpenTM2 – HTTP 200 OK:

{

sourceLang: 'de',

targetLang: 'en',

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

documentName: 'my file.sdlxliff',

segmentNumber: 123,

markupTable: 'translate5',

timestamp: '2015-05-12 13:46:12',

author: „Thomas Lauria“

}

Errors:
404 Not Found – if TM file to given [TM_Name] in URL was not found
500 Server Error – for other technical problems.
400 Bad Request – if JSON parameters are missing or are not well formed.





http://opentm2/translationmemory/[TM_Name]/fuzzysearch/
POST– Serves a memory lookup based on the provided search criteria

To OpenTM2:

{

sourceLang: 'de',

targetLang: 'en-US',

source: „Das ist das Haus des Nikolaus“,

documentName: 'my file.sdlxliff', // can be empty

segmentNumber: 123, // can be empty

markupTable: 'translate5', // can be empty

context: „xyz“, // can be empty

[loggingThreshold:"2"]

}

From OpenTM2 HTTP 200 OK:

{

'NumOfFoundProposals': 2,

'results':

[{

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

sourceLang: 'de', ← rfc5646

targetLang: 'en', ← rfc5646

matchRate: '100',

documentName: 'my file.sdlxliff',

DocumentShortName: 'shortnam.txt',

id: 'identifier',

type: 'Manual',

matchType: 'Exact',

segmentNumber: 123,

markupTable: 'XYZ',

timestamp: '2015-05-12 13:46:12',

author: „Thomas Lauria“.

context: '',

addInfo: ''

},{

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

sourceLang: 'de', ← rfc5646

targetLang: 'en', ← rfc5646

matchRate: '100',

documentName: 'my file.sdlxliff',

DocumentShortName: 'shortnam.txt',

id: 'identifier',

type: 'Manual',

matchType: 'Exact',

segmentNumber: 123,

markupTable: 'XYZ',

timestamp: '2015-05-12 13:46:12',

author: „Thomas Lauria“.

context: '',

addInfo: ''

}]}

Errors:
400 Bad Request – if search, query or language parameters are missing or are not well formed.
404 Not Found – if TM file to given [TM_Name] in URL was not found
500 Server Error – for other technical problems.





http://opentm2/translationmemory/[TM_Name]/concordancesearch /?
POST – Performs a context search of the given search string in the proposals contained in a memory. Returns one proposal per request.









To OpenTM2:

{

searchString: 'Haus des Nikolaus',

searchType: 'source', // values can be source or target

searchPosition: 123// can be empty; Position where a search should start in the memory, see below


numResults: 1,

msSearchAfterNumResults: 100 //number of milliseconds the search will continue, after the first result is found. All additional results that are found in this additional time will also be returned until numResults is reached. If numResults is reached before msSearchAfterNumResults is reached, the search will abort. If msSearchAfterNumResults is reached before numResults is reached, search is also aborted. All found results are delivered in both cases.

[loggingThreshold:"2"]

}

From OpenTM2 HTTP 200 OK:

{

NewSearchPosition: '123:54', /returns NULL, if end of TM is reached, see below


results:[{

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

sourceLang: 'de', ← rfc5646

targetLang: 'en', ← rfc5646

matchRate: '100',

documentName: 'my file.sdlxliff',

DocumentShortName: 'shortnam.txt',

id: 'identifier',

type: 'Manual',

matchType: 'Exact',

segmentNumber: 123,

markupTable: 'XYZ',

timestamp: '2015-05-12 13:46:12',

author: „Thomas Lauria“.

context: '',

addInfo: ''

},{

source: „Das ist das Haus des Nikolaus“,

target: „This is the house of St. Nicholas“,

sourceLang: 'de', ← rfc5646

targetLang: 'en', ← rfc5646

matchRate: '100',

documentName: 'my file.sdlxliff',

DocumentShortName: 'shortnam.txt',

id: 'identifier',

type: 'Manual',

matchType: 'Exact',

segmentNumber: 123,

markupTable: 'XYZ',

timestamp: '2015-05-12 13:46:12',

author: „Thomas Lauria“.

context: '',

addInfo: ''

}]}

Errors:
400 Bad Request – if search, query or language parameters are missing or are not well formed.
404 Not Found – if TM file to given [TM_Name] in URL was not found
500 Server Error – for other technical problems.                  


...