MultiTerm SDK: Importing Entries/Terms

Hello again,


I'm trying to find the information regarding importing entries/terms from an XML file into a termbase, using the MultiTerm SDK.

I've found ImportDefinitions, but does this only apply to the XDT definitions, rather than the XML termbase content?

Thanks in advance,

Samuel

Parents
  • Hi Samuel,

    ImportDefinitions define what kind of import settings you want to use (Merge, overwrite etc.) and are XDI files. Typically you can use one of the existing ImportDefinitions we pre-load into every termbase

    To run the actual import you need to use "ProcessImport" referring to an existing ImportDefinition.

    XDTs are not related to the import process, only to termbase creation.

    Thanks,
    Luis

    Best regards,
    Luis Lopes | Principal Product Manager | RWS | (twitter) @Luis___Lopes |

  • Hi Luis,
    Thanks for the reply, I think I understand the process in theory...although I'm still having trouble finding the example of importing the entries/terms from an external (MultiTerm) XML file.
    Something like:
    - Define the termbase
    - Define the ImportDefinitions
    - presumably at some point an XML file has to be referenced?
    - ProcessImport
    Thanks in advance,
    Samuel
  • Hi Samuel,

    The reference to the XML file is part of the ImportDefinition object, I don't think you can programmatically change the content of it, so you'd have to manipulate XML or use the wizard.
    Maybe it helps if you go through the flow once in MultiTerm to see what a ImportDefinition holds.

    To execute you only need this:

    Applying this method to an import definition runs the import. It requires the task type as parameter, i.e. whether the import should be run in script mode (i.e. without the wizard) or using the import wizard. In addition you can provide the optional source/target index parameters. Note that import definitions can use the source/target index as logical fields.

    //select termbase
    Termbase oTb = oTbs["Termbase name"];

    //select an import definition
    ImportDefinitions oImpDefs = oTb.ImportDefinitions;
    ImportDefinition oExpDef = oImpDefs["Default import definition"];
    oImpDef.ProcessImport(Sdl.MultiTerm.TMO.Interop.MtTaskType.mtScript, "English", "German");


    Thanks,
    Luis

    Best regards,
    Luis Lopes | Principal Product Manager | RWS | (twitter) @Luis___Lopes |

  • Hi Luis,

    Yeah, got it now.

    FYI: I think there might be a typo in the CHM and your reply:

    ImportDefinition oExpDef = oImpDefs["Default import definition"];
    oImpDef.ProcessImport(Sdl.MultiTerm.TMO.Interop.MtTaskType.mtScript, "English", "German");

     should be:

    ImportDefinition oImpDef = oImpDefs["Default import definition"];
    oImpDef.ProcessImport(Sdl.MultiTerm.TMO.Interop.MtTaskType.mtScript, "English", "German");

     Thanks for your help and guidance.

  • Hi ,

    can you please provide complete and WORKING(!!!) example of fully automated/unattended import of complete termbase (i.e. all languages) from XML/XDT, using just the default export/import definitions?
    I cannot make the ProcessImport work.
    And the MultiTerm SDK documentation is tragically incomplete and bad.

    Here is what I do (the termbase XML and XDT already exist):

    1. create new local termbase
    2. get the termbase's "Default import definition" object's "Content" property (the XML)
    3. modify content of the XML:
      • put full path of the termbase XML to "XMLFile" element
      • put full path of import log to "LogFile" element (or should it be ErrorFile?! how should I know?! no documentation... no CLEAR element names, not corresponding to UI elements either! :( )
    4. save the modified XML to file
    5. use the import definition object's "Load" method to load the modified XML and update the existing "Default import definition"
      • (when I now display the "Content" property, I see the modifications there)
    6. use the import definition object's "ProcessImport" method
      • when used with "mtScript" parameter, nothing happens - nothing gets imported, empty log is created (containing only XML declaration line)
      • when used with "mtWizard" parameter, EMPTY wizard opens WITHOUT any added paths or other modifications done in step 3

    WHAT THE HECK IS GOING ON?!
    I spent 2 days by trials and errors already, all to no avail... due to TOTALLY BAD OR MISSING DOCUMENTATION :(

    The definitions objects are total mystery - programmatically saved definition (using "Save" method) fails being added using the definitions collection "Add" method! What's going on?!

    • The "Content" displays only various options/settings enclosed in "List" element
    • but after using the "Save" method, everything gets enclosed into additional "object" root element and adds 3 more elements: name, description,  :-O
    • ...but saving the definition from GUI adds one more option: FullReorgOption :-O :-O

    Can I have some official SDL statement to this unbelievable CHAOS?

     

Reply
  • Hi ,

    can you please provide complete and WORKING(!!!) example of fully automated/unattended import of complete termbase (i.e. all languages) from XML/XDT, using just the default export/import definitions?
    I cannot make the ProcessImport work.
    And the MultiTerm SDK documentation is tragically incomplete and bad.

    Here is what I do (the termbase XML and XDT already exist):

    1. create new local termbase
    2. get the termbase's "Default import definition" object's "Content" property (the XML)
    3. modify content of the XML:
      • put full path of the termbase XML to "XMLFile" element
      • put full path of import log to "LogFile" element (or should it be ErrorFile?! how should I know?! no documentation... no CLEAR element names, not corresponding to UI elements either! :( )
    4. save the modified XML to file
    5. use the import definition object's "Load" method to load the modified XML and update the existing "Default import definition"
      • (when I now display the "Content" property, I see the modifications there)
    6. use the import definition object's "ProcessImport" method
      • when used with "mtScript" parameter, nothing happens - nothing gets imported, empty log is created (containing only XML declaration line)
      • when used with "mtWizard" parameter, EMPTY wizard opens WITHOUT any added paths or other modifications done in step 3

    WHAT THE HECK IS GOING ON?!
    I spent 2 days by trials and errors already, all to no avail... due to TOTALLY BAD OR MISSING DOCUMENTATION :(

    The definitions objects are total mystery - programmatically saved definition (using "Save" method) fails being added using the definitions collection "Add" method! What's going on?!

    • The "Content" displays only various options/settings enclosed in "List" element
    • but after using the "Save" method, everything gets enclosed into additional "object" root element and adds 3 more elements: name, description,  :-O
    • ...but saving the definition from GUI adds one more option: FullReorgOption :-O :-O

    Can I have some official SDL statement to this unbelievable CHAOS?

     

Children