Skip to content

Migration Guide

Logan Patino edited this page Oct 18, 2018 · 4 revisions

Version 3.0.0

General getter/setter name changes

The bulk of the changes in this release are getter/setter name changes due to some work we've done changing naming conventions around during the generation process. Here is a full list to search through and find your replacement:

IBMAssistantV1Models

Model Old name New name
CaptureGroup getGroup getXgroup
CaptureGroup setGroup setXgroup
Context getSystem getXsystem
Context setSystem setXsystem
CreateDialogNode typeField nodeType
CreateDialogNodeBuilder typeField nodeType
CreateDialogNodeOptions typeField nodeType
CreateDialogNodeOptionsBuilder typeField nodeType
CreateValue typeField valueType
CreateValueBuilder typeField valueType
CreateValueOptions typeField valueType
CreateValueOptionsBuilder typeField valueType
DialogNode getDialogNode getDialogNodeId
DialogNode getType getNodeType
DialogNode setDialogNode setDialogNodeId
DialogNode setType setNodeType
DialogNodeAction getType getActionType
DialogNodeAction setType setActionType
DialogNodeOutputGeneric getTime getXtime
DialogNodeOutputGeneric setTime setXtime
DialogRuntimeResponseGeneric getTime getXtime
DialogRuntimeResponseGeneric setTime setXtime
Entity getEntity getEntityName
Entity setEntity setEntityName
EntityExport getEntity getEntityName
EntityExport setEntity setEntityName
EntityMention getText getExampleText
EntityMention getIntent getIntentName
EntityMention setText setExampleText
EntityMention setIntentName setIntentName
Example getText getExampleText
Example setText setExampleText
GetEntityOptions exportField xexport
GetEntityOptionsBuilder exportField xexport
GetIntentOptions exportField xexport
GetIntentOptionsBuilder exportField xexport
GetValueOptions exportField xexport
GetValueOptionsBuilder exportField xexport
GetWorkspaceOptions exportField xexport
GetWorkspaceOptionsBuilder exportField xexport
Intent getIntent getIntentName
Intent setIntent setIntentName
IntentExport getIntent getIntentName
IntentExport setIntent setIntentName
ListAllLogsOptions sortField xsort
ListAllLogsOptionsBuilder sortField xsort
ListCounterexamplesOptions sortField xsort
ListCounterexamplesOptionsBuilder sortField xsort
ListDialogNodesOptions sortField xsort
ListDialogNodesOptionsBuilder sortField xsort
ListEntitiesOptions exportField xexport
ListEntitiesOptions sortField xsort
ListEntitiesOptionsBuilder exportField xexport
ListEntitiesOptionsBuilder sortField xsort
ListExamplesOptions sortField xsort
ListExamplesOptionsBuilder sortField xsort
ListIntentsOptions exportField xexport
ListIntentsOptions sortField xsort
ListIntentsOptionsBuilder exportField xexport
ListIntentsOptionsBuilder sortField xsort
ListLogsOptions sortField xsort
ListLogsOptionsBuilder sortField xsort
ListMentionsOptions exportField xexport
ListMentionsOptionsBuilder exportField xexport
ListSynonymsOptions sortField xsort
ListSynonymsOptionsBuilder sortField xsort
ListValuesOptions exportField xexport
ListValuesOptions sortField xsort
ListValuesOptionsBuilder exportField xexport
ListValuesOptionsBuilder sortField xsort
ListWorkspacesOptions sortField xsort
ListWorkspacesOptionsBuilder sortField xsort
Synonym getSynonym getSynonymText
Synonym setSynonym setSynonymText
UpdateDialogNodeOptions newType nodeType
UpdateDialogNodeOptionsBuilder newType nodeType
UpdateValueOptions newType valueType
UpdateValueOptionsBuilder newType valueType
Value getValue getValueText
Value getType getValueType
Value setValue setValueText
Value setType setValueType
ValueExport getValue getValueText
ValueExport getType getValueType
ValueExport setValue setValueText
ValueExport setType setValueType

IBMAssistantV2Models

Model Old name New name
CaptureGroup getGroup getXgroup
CaptureGroup setGroup setXgroup
DialogNodeAction getType getActionType
DialogNodeAction setType setActionType
DialogRuntimeResponseGeneric getTime getXtime
DialogRuntimeResponseGeneric setTime setXtime
MessageContext getGlobal getXglobal
MessageContext setGlobal setXglobal
MessageContextGlobalSystem getSystem getXsystem
MessageContextGlobalSystem setSystem setXsystem

IBMDiscoveryV1Models

Model Old name New name
CreateEventOptions typeField xtype
CreateEventOptionsBuilder typeField xtype
CreateEventResponse getType getXtype
CreateEventResponse setType setXtype
Enrichment getEnrichment getEnrichmentName
Enrichment setEnrichment setEnrichmentName
FederatedQueryNoticesOptions returnField returnFields
FederatedQueryNoticesOptions sortField xsort
FederatedQueryNoticesOptionsBuilder addReturn addReturnFields
FederatedQueryNoticesOptionsBuilder addSort addXsort
FederatedQueryNoticesOptionsBuilder returnField returnFields
FederatedQueryNoticesOptionsBuilder sortField xsort
FederatedQueryOptions returnField returnFields
FederatedQueryOptions sortField xsort
FederatedQueryOptionsBuilder returnField returnFields
FederatedQueryOptionsBuilder sortField xsort
Field getField getFieldName
Field getType getFieldType
NluEnrichmentEntities getLimit getXlimit
NluEnrichmentEntitiesBuilder limitField xlimit
NluEnrichmentKeywords getLimit getXlimit
NluEnrichmentKeywordsBuilder limitField xlimit
NluEnrichmentSemanticRoles getLimit getXlimit
NluEnrichmentSemanticRolesBuilder limit xlimit
QueryAggregation getType getXtype
QueryAggregation setType setXtype
QueryEntitiesEntity getType getXtype
QueryEntitiesEntity setType setXtype
QueryEntitiesResponseItem getType getXtype
QueryEntitiesResponseItem setType setXtype
QueryEvidenceEntity getType getXtype
QueryEvidenceEntity setType setXtype
QueryLogOptions sortField xsort
QueryLogOptionsBuilder addSort addXsort
QueryLogOptionsBuilder sortField xsort
QueryNoticesOptions returnField returnFields
QueryNoticesOptions sortField xsort
QueryNoticesOptionsBuilder addReturn addReturnFields
QueryNoticesOptionsBuilder addSort addXsort
QueryNoticesOptionsBuilder returnField returnFields
QueryNoticesOptionsBuilder sortField xsort
QueryOptions returnField returnFields
QueryOptions sortField xsort
QueryOptionsBuilder addReturn addReturnFields
QueryOptionsBuilder addSort addXsort
QueryOptionsBuilder returnField returnFields
QueryOptionsBuilder sortField xsort
QueryRelationsEntity getType getXtype
QueryRelationsEntity setType setXtype
QueryRelationsOptions sortField xsort
QueryRelationsOptionsBuilder sortField xsort
QueryRelationsRelationship getType getXtype
QueryRelationsRelationship setType setXtype
Source getType getXtype
Source setType setXtype
SourceOptionsFolder getLimit getXlimit
SourceOptionsFolder setLimit setXlimit
SourceOptionsObject getLimit getXlimit
SourceOptionsObject setLimit setXlimit
SourceOptionsSiteColl getLimit getXlimit
SourceOptionsSiteColl setLimit setXlimit

IBMLanguageTranslatorV3Models

Model Old name New name
ListModelsOptions defaultField defaultModels
ListModelsOptionsBuilder defaultField defaultModels
Translation getTranslation getTranslationOutput
Translation setTranslation setTranslationOutput

IBMNaturalLanguageClassifierV1Models

Model Old name New name
CreateClassifierOptions trainingMetadata metadata
CreateClassifierOptionsBuilder trainingMetadata metadata

IBMNaturalLanguageUnderstandingV1Models

Model Old name New name
ConceptsOptions limitField xlimit
ConceptsOptionsBuilder limitField xlimit
EntitiesOptions limitField xlimit
EntitiesOptionsBuilder limitField xlimit
EntitiesResult getType getXtype
EntitiesResult setType setXtype
KeywordsOptions limitField xlimit
KeywordsOptionsBuilder limitField xlimit
RelationEntity getType getXtype
RelationEntity setType setXtype
RelationsResult getType getXtype
RelationsResult setType setXtype
SemanticRolesEntity getType getXtype
SemanticRolesEntity setType setXtype
SemanticRolesOptions limitField xlimit
SemanticRolesOptionsBuilder limitField xlimit
SemanticRolesResult getObject getXobject
SemanticRolesResult setObject setXobject

IBMSpeechToTextV1Models

Model Old name New name
AudioDetails getType getXtype
AudioDetails setType setXtype
ListWordsOptions sortField xsort
ListWordsOptionsBuilder sortField xsort
SpeakerLabelsResult getFrom getXfrom
SpeakerLabelsResult getFinal getFinalResults
SpeakerLabelsResult setFrom setXfrom
SpeakerLabelsResult setFinal setFinalResults
SpeechRecognitionResult getFinal getFinalResults
SpeechRecognitionResult setFinal setFinalResults

IBMVisualRecognitionV3Models

Model Old name New name
ModelClass getClass getClassName
ModelClass setClass setClassName
ClassResult getClass getClassName
ClassResult setClass setClassName

Conversation

The Conversation service has been removed in this release. To migrate, you can switch to using the IBMAssistantV1 class, which is functionally equivalent.

Discovery

Some parameters in the FederatedQueryOptions/FederatedQueryOptionsBuilder and QueryOptions/QueryOptionsBuilder models have been changed from List<String> to String. These are listed below:

  • passagesFields
  • returnFields
  • similarDocumentIds
  • similarFields
  • xsort

The size(Long size) setter in CreateEnvironmentOptionsBuilder which was deprecated has officially been removed. To migrate, switch to using the size(String size).

Language Translator v2

This service is officially deprecated and has been removed from the SDK. Users should migrate to using the IBMLanguageTranslatorV3 class for the newest features.

Personality Insights

The getProfileAsCSV method has changed in a couple ways, which are demonstrated below.

Before:

IBMPersonalityInsightsV3Models.ProfileOptions options = new IBMPersonalityInsightsV3Models.ProfileOptionsBuilder()
  .text('This is some example profile text')
  .build();

String csvResult = service.getProfileAsCSV(options, true);

Now:

IBMPersonalityInsightsV3Models.ProfileOptions options = new IBMPersonalityInsightsV3Models.ProfileOptionsBuilder()
  .text('This is some example profile text')
  .csvHeaders(true) // you now specify the headers option in the ProfileOptionsBuilder
  .build();

// return type and method name have changed
IBMWatsonFile csvResult = service.profileAsCsv(options);

Speech to Text

Some methods which were marked as deprecated have been removed. These are listed below, along with the method to migrate to, or nothing if the functionality has been removed altogether.

Model Old method New method
AddAudioOptions audio audioResource
AddAudioOptionsBuilder audio audioResource
AddCorpusOptions corpusFileContentType -
AddCorpusOptionsBuilder corpusFileContentType -
CreateJobOptions audioFilename -
CreateJobOptionsBuilder audioFilename -
RecognizeOptions audioFilename -
RecognizeOptions continuous -
RecognizeOptions interimResults -
RecognizeOptionsBuilder audioFilename -
RecognizeOptionsBuilder continuous -
RecognizeOptionsBuilder interimResults -

Visual Recognition

In the ClassifyOptions/ClassifyOptionsBuilder and DetectFacesOptions/DetectFacesOptionsBuilder models, the parameters getters and setters were marked as deprecated. These have been removed in this release.

To migrate, you should get/set the individual fields previously contained in your parameters object. For example, if this was your parameters JSON string:

{
  "url": "https://example.url.com",
  "threshold": 0.25,
  "classifier_ids": [ "01234", "56789" ]
}

you would set it like this in the previous version:

IBMVisualRecognitionV3Models.ClassifyOptions options = new IBMVisualRecognitionV3Models.ClassifyOptionsBuilder()
  .parameters(parametersJsonString) // where parametersJsonString is the value above
  .build();

This should now be done like this:

IBMVisualRecognitionV3Models.ClassifyOptions options = new IBMVisualRecognitionV3Models.ClassifyOptionsBuilder()
  .url('https://example.url.com')
  .threshold(0.25)
  .classifierIds(new List<String> { '01234', '56789' })
  .build();

The CreateClassifierOptions/CreateClassifierOptionsBuilder and UpdateClassifierOptions/UpdateClassifierOptionsBuilder models have also changed. Previously on the "options" models, there was a property called classnamePositiveExamples, which was a Map<String, IBMWatsonFile> that held the class name and files themselves. This has been replaced with two separate properties: one for the files, and one for the filenames. Below is a comparison using CreateClassifierOptions.

Before:

IBMVisualRecognitionV3Models.CreateClassifierOptions options = new IBMVisualRecognitionV3Models.CreateClassifierOptionsBuilder()
  .name('example-classifier')
  .addClass('positive-class-name', positiveClassFileVariable) // takes class name and the corresponding file
  .build();

Now:

// one variable to hold the class names and corresponding files
Map<String, IBMWatsonFile> positiveExampleFiles = new Map<String,IBMWatsonFile>();
positiveExamples.put('positive-class-name', positiveClassFileVariable);

// another to hold the SAME class names and corresponding filenames
Map<String, String> positiveExampleFilenames = new Map<String, String>();
positiveExampleFilenames.put('positive-class-name', 'positive-class-filename');

IBMVisualRecognitionV3Models.CreateClassifierOptions options = new IBMVisualRecognitionV3Models.CreateClassifierOptionsBuilder()
  .name('example-classifier')
  .positiveExamples(positiveExampleFiles)
  .positiveExamplesFilename(positiveExampleFilenames)
  .build();

It's important to note that the positiveExampleFiles and positiveExampleFilenames objects are tied together by the same key values, which represents the positive class.

Finally, authentication using the basic API key has been removed in this version. To authenticate with Visual Recognition from now on, you must use either username/password or IAM credentials with the IBMWatsonIAMOptions class. See the authentication section of the main README for full defails on using these methods.

Version 2.0.0

In this version, the builder pattern was introduced for the enrichment models in the Discovery service. This changes the way these models are constructed. Below is an example of switching from the old NluEnrichmentSemanticRoles model to the new one. Changes to the other affected models (EnrichmentOptions, NluEnrichmentEmotion, NluEnrichmentEntities, NluEnrichmentFeatures, NluEnrichmentKeywords, NluEnrichmentSentiment) will follow the same pattern.

// before
IBMDiscoveryV1Models.NluEnrichmentSemanticRoles semanticRoles
  = new IBMDiscoveryV1Models.NluEnrichmentSemanticRoles();
semanticRoles.setEntities(true);
semanticRoles.setKeywords(true);
semanticRoles.setLimit(5);
// now
IBMDiscoveryV1Models.NluEnrichmentSemanticRoles semanticRoles
  = new IBMDiscoveryV1Models.NluEnrichmentSemanticRolesBuilder()
  .entities(true);
  .keywords(true);
  .limit(5)
  .build();

This pattern should also be consistent with the way other models are typically built up in the SDK.