Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Description

The database-side storage of terms is extended by the "TermCollection",  which makes it possible, for example, to group terms that belong to a specifc client. This way an end client can be assigned to one or more TermCollections.

Provides access to the Term collections available in the application.

URL:

/editor/termcollection/[ID]

Available Methods:

GET / POST / DELETE

Specialities:

  • Deleting term collection will remove all terms, terms attributes and term entry attributes assigned to this term collection

Resource Layout

Name

Type

Info

id

int

GET only

name

string

The name of the term collection (unique)

timestamp

DateTimeDate and time when the term collection is created

customerId

integer

Foreign key to the customers table


POST request parameters example :

  • create new empty term collection

{

 data:{

       "name":"The name of the term collection",

       "customerId":"the id of the customer to whom this collection is associated"

 }
}


GET request parameters example :

  • return the term collection name,timestamp and customerId for the termcollection with id = 1

{

 data:{

       "id":1

 }
}


Search term in term collection.

URL:

editor/termcollection/search

Available Methods:

GET

Specialities:

  • Find term/terms in the given term collection by searched string

Resource Layout

Name

Type

Info

term

string

Search term string. The search string can be combined with wildcards also.


language

array

Term language/s ids from lek_languages table

disableLimit

boolean

Disable the result limit configured in searchTermsCount config variable.

Search term entry and term attributes in term collection.

URL:

editor/termcollection/searchattribute

Available Methods:

GET

Specialities:

  • Find term entry and term attributes by groupId(termEntry id).
  • The result array will return term attributes and term entry attribute values

Info: For search and searchatribute actions, will search in the collection assigned to the customers which customers are assigned to the currently logged user assigned customers.


Resource Layout

Name

Type

Info

groupId

string

Lek_terms table groupId field.


  • Response array example
{ 
"rows":{ 
	"termAttributes":[ 
	{ 
		"definition":"",
		"groupId":"001",
		"label":"gravure printing",
		"value":"11413",
		"desc":"gravure printing",
		"termId":"11413",
		"collectionId":"122",
		"languageId":"5",
		"labelId":"323",
		"attributeId":"73178",
		"parentId":null,
		"internalCount":null,
		"name":"transac",
		"attrType":"origination",
		"attrTarget":null,
		"attrId":null,
		"attrLang":"en",
		"attrValue":"origination",
		"attrCreated":"2018-05-07 17:32:07",
		"attrUpdated":"2018-05-07 17:32:07",
		"attrDataType":null,
		"language":"en"
	}
],
"termEntryAttributes":[ 
	{ 
		"id":"8737",
		"labelId":"331",
		"collectionId":"122",
		"termEntryId":"4965",
		"parentId":null,
		"internalCount":"1",
		"language":null,
		"name":"note",
		"attrType":null,
		"attrDataType":null,
		"attrTarget":null,
		"attrId":null,
		"attrLang":null,
		"value":"Aleksandar",
		"created":"2018-05-07 17:32:07",
		"updated":"2018-05-07 17:32:07",
		"attributeId":"8737",
		"attrValue":"Aleksandar",
		"attrCreated":"2018-05-07 17:32:07",
		"attrUpdated":"2018-05-07 17:32:07"
		}
		]
	}
}

Import terms to the term collection

URL:editor/termcollection/import
Available Methods:POST
Specialities:Import the provided terms from the tbx file to the term collection

 

POST request parameters example(json):

{

"data":{

          "collectionId":"the id of the term collection where those terms from the tbx file are going to",

          "customerId":"customer to that this term collection is associated",

          "mergeTerms":"see details for the mergeTerms behaviour below",

          "tbxUpload": "tbx file/files uploaded as multipart/form-data"

          }
}

Details for the mergeTerms parameter

  • If the parameter is true, translate5 will search all existing terms to see if the same term already exists in the TermCollection in the same language.
    • If so, the first term that is found is updated by the values in the TBX file. The term-ID and termEntry-ID remain the same as they already existed in translate5.
      • All other terms of this termEntry in the TBX file will be imported/merged to the same termEntry of the TermCollection, that just has been found through the matching 
      • This means, if 2 (or more) terms that belong to the same termEntry-ID in the TBX file can be merged with a term in the database, but in the database those terms do NOT belong to the same termEntry-ID, only the first one will be merged with the one it matches and the second one (or more) will be put into the same termEntry as the first one.
    • If no term of a termEntry can be matched with an existing term in the termCollection, a new termEntry is added with the termEntry ID of the TBX in the TermCollection and all terms of the termEntry of the TBX are added to this termEntry in the TermCollection
    • Summarized this means, that the checks should be done in the following order, in case the termEntry-ID does not exist in the termCollection and mergeTerms is true
      • For each term of a termEntry of the TBX file check, if the term exists in the termCollection within the same language.
        • If yes, merge it 
          • Also put all other terms of the same termEntry of the TBX (independent of their language) file into this termEntry in the termCollection
          • For all other terms in the same termEntry you therefore can stop checking, if they match with something (abort the loop)
        • If the term does not match, check the next
        • if no term of the termEntry of the TBX file can be matched, create a new termEntry with the termEntry-ID of the TBX and add all terms from the TBX to that termEntry in the termCollection with the term-IDs of the TBX.
  • If the parameter is false, a new termEntry is added to the termCollection with the term ID of the TBX file and all terms of this termEntry of the TBX file are added to this new termEntry in the termCollection with the term IDs of the TBX file (same thing as if  no term from this termEntry in the TBX can be matched in the termCollection).

Important: with the import call, one or multiple tbx files must be provided.


There can be additional possibility to import terms to the term collection. 

  1. Import tbx files via language resources panel with term collection as resource
  2. Using the term import plugin ( see more at Plug-In TermImport: TermImport )


  • No labels