From 3ca9c39bea60158a0788d321df0e4f34c3114779 Mon Sep 17 00:00:00 2001 From: German Attanasio Ruiz Date: Mon, 1 Aug 2016 17:21:44 -0400 Subject: [PATCH] :fire: remove deprecated services remove Tone Analyzer v3-beta and Relationship Extraction v1-Beta --- README.md | 17 --- .../RelationshipExtractionExample.java | 31 ----- .../tone_analyzer/v3/ToneAnalyzerExample.java | 7 +- .../v1_beta/RelationshipExtraction.java | 125 ------------------ .../v1_beta/ReturnType.java | 25 ---- .../v1_beta/model/Dataset.java | 51 ------- .../v1_beta/model/package-info.java | 5 - .../v1_beta/package-info.java | 5 - .../tone_analyzer/v3_beta/ToneAnalyzer.java | 96 -------------- .../v3_beta/model/ElementTone.java | 59 --------- .../v3_beta/model/SentenceTone.java | 110 --------------- .../v3_beta/model/ToneAnalysis.java | 79 ----------- .../v3_beta/model/ToneCategory.java | 95 ------------- .../v3_beta/model/ToneScore.java | 95 ------------- .../v3_beta/model/package-info.java | 5 - .../tone_analyzer/v3_beta/package-info.java | 5 - .../v1_beta/RelationshipExtractionIT.java | 81 ------------ .../service/GenericServiceTest.java | 2 - .../tone_analyzer/v3_beta/ToneAnalyzerIT.java | 72 ---------- .../v3_beta/ToneAnalyzerTest.java | 93 ------------- 20 files changed, 3 insertions(+), 1055 deletions(-) delete mode 100644 examples/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionExample.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtraction.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/ReturnType.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/Dataset.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/package-info.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/package-info.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzer.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ElementTone.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/SentenceTone.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneAnalysis.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneCategory.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneScore.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/package-info.java delete mode 100644 src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/package-info.java delete mode 100644 src/test/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionIT.java delete mode 100644 src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerIT.java delete mode 100644 src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerTest.java diff --git a/README.md b/README.md index d7ea31a6cec..9b02846364a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ APIs and SDKs that use cognitive computing to solve complex problems. * [Language Translation](#language-translation) * [Natural Language Classifier](#natural-language-classifier) * [Personality Insights](#personality-insights) - * [Relationship Extraction](#relationship-extraction) * [Retrieve and Rank](#retrieve-and-rank) * [Speech to Text](#speech-to-text) * [Text to Speech](#text-to-speech) @@ -366,21 +365,6 @@ authentication errors, remember that the Personality Insights service is not a free service. -### Relationship Extraction -Analyze an English news article and get the relationships between sentence -components (nouns, verbs, subjects, objects, etc.) by using the -[Relationship Extraction][relationship_extraction] service. - -```java -RelationshipExtraction service = new RelationshipExtraction(); -service.setUsernameAndPassword("", ""); - -service.setDataset(Dataset.ENGLISH_NEWS); -String response = service.extract("IBM Watson Developer Cloud").execute(); -System.out.println(response); -``` - - ### Retrieve and Rank The [Retrieve and Rank][retrieve_and_rank] service helps users find the most relevant information for their query by using a combination of search and @@ -618,7 +602,6 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md). [personality_insights]: http://www.ibm.com/watson/developercloud/doc/personality-insights/ [document_conversion]: http://www.ibm.com/watson/developercloud/doc/document-conversion/ -[relationship_extraction]: http://www.ibm.com/watson/developercloud/doc/sireapi/ [language_translation]: http://www.ibm.com/watson/developercloud/doc/language-translation/ [visual_recognition]: http://www.ibm.com/watson/developercloud/doc/visual-recognition/ [tradeoff_analytics]: http://www.ibm.com/watson/developercloud/doc/tradeoff-analytics/ diff --git a/examples/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionExample.java b/examples/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionExample.java deleted file mode 100644 index e8580ffbbb4..00000000000 --- a/examples/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionExample.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta; - -import com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.RelationshipExtraction; -import com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.model.Dataset; - - -public class RelationshipExtractionExample { - - public static void main(String[] args) { - RelationshipExtraction service = new RelationshipExtraction(); - service.setUsernameAndPassword("", ""); - - service.setDataset(Dataset.ENGLISH_NEWS); - String response = service.extract("IBM Watson developer cloud").execute(); - - System.out.println(response); - } -} diff --git a/examples/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzerExample.java b/examples/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzerExample.java index cb36519165c..162f135ca00 100644 --- a/examples/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzerExample.java +++ b/examples/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/ToneAnalyzerExample.java @@ -13,14 +13,13 @@ */ package com.ibm.watson.developer_cloud.tone_analyzer.v3; -import com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.ToneAnalyzer; -import com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model.ToneAnalysis; +import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis; public class ToneAnalyzerExample { public static void main(String[] args) { - ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_02_11); + ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_05_19); service.setUsernameAndPassword("", ""); String text = @@ -36,7 +35,7 @@ public static void main(String[] args) { + "business outcomes. Economy has nothing to do with it."; // Call the service and get the tone - ToneAnalysis tone = service.getTone(text).execute(); + ToneAnalysis tone = service.getTone(text, null).execute(); System.out.println(tone); } diff --git a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtraction.java b/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtraction.java deleted file mode 100644 index a2a4ae7c1be..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtraction.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta; - -import com.ibm.watson.developer_cloud.http.RequestBuilder; -import com.ibm.watson.developer_cloud.http.ServiceCall; -import com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.model.Dataset; -import com.ibm.watson.developer_cloud.service.WatsonService; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; -import com.ibm.watson.developer_cloud.util.Validator; - -import okhttp3.Request; - -/** - * Relationship Extraction intelligently finds relationships between sentence components (nouns, - * verbs, subjects, objects, etc.) - * - * @version v1 - * @see - * Relationship Extraction - */ -public class RelationshipExtraction extends WatsonService { - private static final String SERVICE_NAME = "relatonship_extraction"; - private static final String JSON = "json"; - private static final String XML = "xml"; - private static final String TEXT = "txt"; - private static final String RETURN_TYPE = "rt"; - private static final String SID = "sid"; - private static final String URL = "https://gateway.watsonplatform.net/relationship-extraction-beta/api"; - - private Dataset dataset; - private String returnType = XML; - - /** - * Instantiates a new relationship extraction service. - */ - public RelationshipExtraction() { - super(SERVICE_NAME); - setEndPoint(URL); - } - - /** - * Instantiates a new relationship extraction service by username and password. - * @param username the username - * @param password the password - */ - public RelationshipExtraction(String username, String password) { - this(); - setUsernameAndPassword(username, password); - } - - /** - * Extracts relationships between sentence components (nouns, verbs, subjects, objects, etc.) - * - *
- * Here is an example of how to extract sentence components: - * - *
-   * RelationshipExtraction service = new RelationshipExtraction();
-   * service.setUsernameAndPassword("<username>", "<password>");
-   * 
-   * service.setDataset(Dataset.ENGLISH_NEWS);
-   * String response = service.extract("IBM Watson developer cloud");
-   * 
-   * System.out.println(response);
-   * 
- * - * @param text the text to analyze - * - * @return the result as an XML/JSON string - */ - public ServiceCall extract(final String text) { - Validator.notNull(dataset, "dataset cannot be null"); - Validator.notNull(text, "text cannot be null"); - - final Request request = - RequestBuilder.post("/v1/sire/0").form(SID, dataset.getId(), RETURN_TYPE, returnType, TEXT, text).build(); - return createServiceCall(request, ResponseConverterUtils.getString()); - } - - /** - * Gets the dataset. - * - * - * @return the dataset - */ - public Dataset getDataset() { - return dataset; - } - - /** - * Sets the dataset. - * - * @param dataset the new dataset - */ - public void setDataset(final Dataset dataset) { - this.dataset = dataset; - } - - /** - * Sets the returnType. - * - * @param returnType the new returnType - */ - public void setReturnType(final ReturnType returnType) { - if (returnType == ReturnType.XML) { - this.returnType = XML; - } else if (returnType == ReturnType.JSON) { - this.returnType = JSON; - } - } - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/ReturnType.java b/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/ReturnType.java deleted file mode 100644 index 900ede39dcd..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/ReturnType.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta; - -/** - * Return type. - */ -public enum ReturnType { - - /** The xml. */ - XML, - /** The json. */ - JSON -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/Dataset.java b/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/Dataset.java deleted file mode 100644 index 11d4ec90cbb..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/Dataset.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.model; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Dataset to be use in the - * {@link com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.RelationshipExtraction} service. - */ -public class Dataset extends GenericModel { - - /** English News. */ - public static final Dataset ENGLISH_NEWS = new Dataset("ie-en-news"); - - /** Spanish news. */ - public static final Dataset SPANISH_NEWS = new Dataset("ie-es-news"); - - - private final String id; - - /** - * Instantiates a new dataset. - * - * @param id the id - */ - public Dataset(String id) { - this.id = id; - } - - /** - * Gets the id. - * - * - * @return the id - */ - public String getId() { - return id; - } -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/package-info.java b/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/package-info.java deleted file mode 100644 index 31540fcaa7b..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/model/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Classes that map the HTTP service requests and responses into POJOs - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.model; - diff --git a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/package-info.java b/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/package-info.java deleted file mode 100644 index fd06f3086ba..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Relationship Extraction Service v1-beta - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta; - diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzer.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzer.java deleted file mode 100644 index c33a3d39b32..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzer.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta; - -import com.google.gson.JsonObject; -import com.ibm.watson.developer_cloud.http.RequestBuilder; -import com.ibm.watson.developer_cloud.http.ServiceCall; -import com.ibm.watson.developer_cloud.service.WatsonService; -import com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model.ToneAnalysis; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; -import com.ibm.watson.developer_cloud.util.Validator; - -import okhttp3.Request; - -/** - * The IBM Watson Tone Analyzer service uses linguistic analysis to detect emotional tones, social - * propensities, and writing styles in written communication. Then it offers suggestions to help the - * writer improve their intended language tones. - * - * @version v3_beta - * @see Tone - * Analyzer - * @api.version_date 2016-02-11 - */ -public class ToneAnalyzer extends WatsonService { - - private static final String PATH_TONE = "/v3/tone"; - private static final String SERVICE_NAME = "tone_analyzer"; - private static final String TEXT = "text"; - private static final String URL = "https://gateway.watsonplatform.net/tone-analyzer-beta/api"; - private static final String VERSION_DATE = "version"; - /** Version date. */ - public static final String VERSION_DATE_2016_02_11 = "2016-02-11"; - - private String versionDate; - - - /** - * Instantiates a new tone analyzer V3_beta service. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. - */ - public ToneAnalyzer(String versionDate) { - super(SERVICE_NAME); - setEndPoint(URL); - this.versionDate = versionDate; - } - - /** - * Instantiates a new tone analyzer V3_beta service with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - */ - public ToneAnalyzer(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Analyzes the "tone" of a piece of text. The message is analyzed from several tones (social - * tone, emotional tone, writing tone), and for each of them various traits are derived (such as - * conscientiousness, agreeableness, openness). - * - * @param text The text to analyze - * @return the {@link ToneAnalysis} with the response - * - */ - public ServiceCall getTone(final String text) { - Validator.isTrue(text != null && !text.isEmpty(), "text cannot be null or empty"); - - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty(TEXT, text); - - final Request request = - RequestBuilder.post(PATH_TONE).query(VERSION_DATE, versionDate).bodyJson(contentJson).build(); - - return createServiceCall(request, ResponseConverterUtils.getObject(ToneAnalysis.class)); - } - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ElementTone.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ElementTone.java deleted file mode 100644 index 786da9bfa04..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ElementTone.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * This object represents the results of Tone analysis on an element; which may be a document or a - * sentence. Its structure is a 2-level tree, with tone categories in the top level and the - * individual tones (and their scores) in leaves. - * - */ -public class ElementTone extends GenericModel { - - @SerializedName("tone_categories") - private List tones; - - /** - * Adds the tone. - * - * @param tone the tone - */ - public void addTone(ToneCategory tone) { - this.tones.add(tone); - } - - /** - * Gets the tones. - * - * @return the tones - */ - public List getTones() { - return tones; - } - - /** - * Sets the tones. - * - * @param tones the new tones - */ - public void setTones(List tones) { - this.tones = tones; - } - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/SentenceTone.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/SentenceTone.java deleted file mode 100644 index 1374d637098..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/SentenceTone.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - -import com.google.gson.annotations.SerializedName; - -/** - * This element contains the result of analyzing an individual sentence. It contains a list of - * ToneCategory objects which is the actual result, and also some metadata about the sentence: The - * original text (if it needs to be tracked back), and the position of the sentence in the original - * text (as index of first and last character). - */ -public class SentenceTone extends ElementTone { - - @SerializedName("sentence_id") - private Integer id; - - @SerializedName("input_from") - private Integer inputFrom; - - @SerializedName("input_to") - private Integer inputTo; - - @SerializedName("text") - private String text; - - /** - * Gets the id. - * - * @return the id - */ - public Integer getId() { - return id; - } - - /** - * Gets the input from. - * - * @return the input from - */ - public Integer getInputFrom() { - return inputFrom; - } - - /** - * Gets the input to. - * - * @return the input to - */ - public Integer getInputTo() { - return inputTo; - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Sets the id. - * - * @param id the new id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * Sets the input from. - * - * @param inputFrom the new input from - */ - public void setInputFrom(Integer inputFrom) { - this.inputFrom = inputFrom; - } - - /** - * Sets the input to. - * - * @param inputTo the new input to - */ - public void setInputTo(Integer inputTo) { - this.inputTo = inputTo; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneAnalysis.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneAnalysis.java deleted file mode 100644 index d88f31c282b..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneAnalysis.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Main object containing the result of running Tone Analyzer on a document. It contains both the - * sentence-level and document-level results. - */ -public class ToneAnalysis extends GenericModel { - - @SerializedName("document_tone") - private ElementTone documentTone; - - @SerializedName("sentences_tone") - private List sentencesTone; - - /** - * Adds the sentences tone. - * - * @param analysis the analysis - */ - public void addSentencesTone(SentenceTone analysis) { - this.sentencesTone.add(analysis); - } - - /** - * Gets the document tone. - * - * @return the document tone - */ - public ElementTone getDocumentTone() { - return documentTone; - } - - /** - * Gets the sentences tone. - * - * @return the sentences tone - */ - public List getSentencesTone() { - return sentencesTone; - } - - /** - * Sets the document tone. - * - * @param documentTone the new document tone - */ - public void setDocumentTone(ElementTone documentTone) { - this.documentTone = documentTone; - } - - /** - * Sets the sentences tone. - * - * @param sentencesTone the new sentences tone - */ - public void setSentencesTone(List sentencesTone) { - this.sentencesTone = sentencesTone; - } - - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneCategory.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneCategory.java deleted file mode 100644 index e60e157d9f7..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneCategory.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Top level tone (or Tone Category) from the list of Writing Tone, Emotion Tone or Social Tone. It - * holds a list of scores for individual Tones. - */ -public class ToneCategory extends GenericModel { - - @SerializedName("category_id") - private String id; - @SerializedName("category_name") - private String name; - private List tones; - - /** - * Adds the tone. - * - * @param score the score - */ - public void addTone(ToneScore score) { - this.tones.add(score); - } - - /** - * Gets the id. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the tones. - * - * @return the tones - */ - public List getTones() { - return tones; - } - - /** - * Sets the id. - * - * @param id the new id - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the tones. - * - * @param tones the new tones - */ - public void setTones(List tones) { - this.tones = tones; - } -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneScore.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneScore.java deleted file mode 100644 index 81e73ca40e7..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/ToneScore.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Object representing scoring of a single Tone (of any category) on our responses. It contains the - * Tone ID, a score, and optionally a list of evidences. - */ -public class ToneScore extends GenericModel { - - @SerializedName("tone_id") - private String id; - - @SerializedName("tone_name") - private String name; - - /** The score. */ - private Double score; - - /** - * Instantiates a new tone score. - */ - public ToneScore() { - - } - - /** - * Gets the id. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the score. - * - * @return the score - */ - public Double getScore() { - return score; - } - - /** - * Sets the id. - * - * @param id the new id - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the score. - * - * @param score the new score - */ - public void setScore(Double score) { - this.score = score; - } - -} diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/package-info.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/package-info.java deleted file mode 100644 index a79c869b6aa..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/model/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Classes that map the HTTP service requests and responses into POJOs - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model; - diff --git a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/package-info.java b/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/package-info.java deleted file mode 100644 index 32d0a12a791..00000000000 --- a/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Tone Analyzer Service v3-beta - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta; - diff --git a/src/test/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionIT.java b/src/test/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionIT.java deleted file mode 100644 index 0e78caa34e5..00000000000 --- a/src/test/java/com/ibm/watson/developer_cloud/relationship_extraction/v1_beta/RelationshipExtractionIT.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.relationship_extraction.v1_beta; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.model.Dataset; - -/** - * The Class RelationshipExtractionTest. - * - */ -public class RelationshipExtractionIT extends WatsonServiceTest { - - /** - * The service. - */ - private RelationshipExtraction service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developercloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - service = new RelationshipExtraction(); - service.setUsernameAndPassword(getValidProperty("relationship_extraction.username"), - getValidProperty("relationship_extraction.password")); - service.setEndPoint(getValidProperty("relationship_extraction.url")); - service.setDefaultHeaders(getDefaultHeaders()); - } - - /** - * Test extract. - */ - @Test - public void testExtract() { - String text ="IBM Watson Developer Cloud"; - service.setDataset(Dataset.ENGLISH_NEWS); - String response = service.extract(text).execute(); - Assert.assertNotNull(response); - - service.setReturnType(ReturnType.JSON); - response = service.extract(text).execute(); - Assert.assertNotNull(response); - - } - - /** - * Test missing dataset. - */ - @Test - public void testMissingDataset() { - service.setDataset(null); - boolean fail = true; - try { - service.extract("IBM Watson Developer Cloud"); - } catch (final IllegalArgumentException e) { - fail = false; - } - Assert.assertFalse(fail); - } - -} diff --git a/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java b/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java index 5ac270700ed..118642c98fe 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java +++ b/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java @@ -53,7 +53,6 @@ import com.ibm.watson.developer_cloud.natural_language_classifier.v1.NaturalLanguageClassifier; import com.ibm.watson.developer_cloud.personality_insights.v2.PersonalityInsights; import com.ibm.watson.developer_cloud.personality_insights.v2.model.Profile; -import com.ibm.watson.developer_cloud.relationship_extraction.v1_beta.RelationshipExtraction; import com.ibm.watson.developer_cloud.retrieve_and_rank.v1.RetrieveAndRank; import com.ibm.watson.developer_cloud.retrieve_and_rank.v1.util.ZipUtils; import com.ibm.watson.developer_cloud.service.exception.BadRequestException; @@ -126,7 +125,6 @@ public void testConstructors() { checkApiKey(new LanguageTranslation(u, p), key); checkApiKey(new NaturalLanguageClassifier(u, p), key); checkApiKey(new PersonalityInsights(u, p), key); - checkApiKey(new RelationshipExtraction(u, p), key); checkApiKey(new RetrieveAndRank(u, p), key); checkApiKey(new SpeechToText(u, p), key); checkApiKey(new TextToSpeech(u, p), key); diff --git a/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerIT.java b/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerIT.java deleted file mode 100644 index 4b1d51a2e80..00000000000 --- a/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerIT.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - -import com.ibm.watson.developer_cloud.WatsonServiceTest; -import com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model.ToneAnalysis; - -/** - * Tone Analyzer v3 Beta Integration tests. - */ -@Ignore -public class ToneAnalyzerIT extends WatsonServiceTest { - - /** The service. */ - private ToneAnalyzer service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_02_11); - service.setUsernameAndPassword(getValidProperty("tone_analyzer.v3_beta.username"), - getValidProperty("tone_analyzer.v3_beta.password")); - service.setEndPoint(getValidProperty("tone_analyzer.v3_beta.url")); - service.setDefaultHeaders(getDefaultHeaders()); - - } - - /** - * Test get tone. - */ - @Test - public void testGetTone() { - final String text = - "I know the times are difficult! Our sales have been " - + "disappointing for the past three quarters for our data analytics " - + "product suite. We have a competitive data analytics product " - + "suite in the industry. But we need to do our job selling it! "; - - - // Call the service and get the tone - final ToneAnalysis tone = service.getTone(text).execute(); - Assert.assertNotNull(tone); - Assert.assertNotNull(tone.getDocumentTone()); - Assert.assertEquals(3, tone.getDocumentTone().getTones().size()); - Assert.assertNotNull(tone.getSentencesTone()); - Assert.assertEquals(4, tone.getSentencesTone().size()); - Assert.assertEquals("I know the times are difficult!", tone.getSentencesTone().get(0).getText()); - } - -} diff --git a/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerTest.java b/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerTest.java deleted file mode 100644 index ccbe16848d3..00000000000 --- a/src/test/java/com/ibm/watson/developer_cloud/tone_analyzer/v3_beta/ToneAnalyzerTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright 2015 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.ibm.watson.developer_cloud.tone_analyzer.v3_beta; - -import java.io.FileNotFoundException; - -import okhttp3.HttpUrl; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import com.google.gson.JsonObject; -import com.ibm.watson.developer_cloud.WatsonServiceUnitTest; -import com.ibm.watson.developer_cloud.tone_analyzer.v3_beta.model.ToneAnalysis; - -/** - * Tone Analyzer unit test. - */ -public class ToneAnalyzerTest extends WatsonServiceUnitTest { - - private static final String VERSION_DATE = "version"; - private static final String TEXT = "text"; - private static final String FIXTURE = "src/test/resources/tone_analyzer/tone.json"; - private final static String TONE_PATH = "/v3/tone"; - - /** The service. */ - private ToneAnalyzer service; - - /* - * (non-Javadoc) - * - * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp() - */ - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_02_11); - service.setApiKey(""); - service.setEndPoint(getMockWebServerUrl()); - - } - - /** - * Test get tone. - * - * @throws FileNotFoundException the file not found exception - * @throws InterruptedException the interrupted exception - */ - @Test - public void testGetTone() throws FileNotFoundException, InterruptedException { - final String text = "I know the times are difficult! Our sales have been " - + "disappointing for the past three quarters for our data analytics " - + "product suite. We have a competitive data analytics product " - + "suite in the industry. But we need to do our job selling it! "; - - ToneAnalysis response = loadFixture(FIXTURE, ToneAnalysis.class); - - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty(TEXT, text); - - server.enqueue(jsonResponse(response)); - Assert.assertEquals(response, service.getTone(text).execute()); - final RecordedRequest request = server.takeRequest(); - final HttpUrl url = HttpUrl.parse(getMockWebServerUrl() + request.getPath()); - - Assert.assertEquals(POST, request.getMethod()); - Assert.assertEquals(TONE_PATH, url.encodedPath()); - Assert.assertEquals(ToneAnalyzer.VERSION_DATE_2016_02_11, url.queryParameter(VERSION_DATE)); - Assert.assertEquals(contentJson.toString(), request.getBody().readUtf8()); - } - - /** - * Test tone with null. - */ - @Test(expected = IllegalArgumentException.class) - public void testGetToneWithNull() { - service.getTone(null); - } - -}