diff --git a/.config.properties.enc b/.config.properties.enc index e1674470ae0..af005d956a1 100644 Binary files a/.config.properties.enc and b/.config.properties.enc differ diff --git a/examples/java/com/ibm/watson/developer_cloud/alchemy_language/v1/AlchemyLanguageExample.java b/examples/java/com/ibm/watson/developer_cloud/alchemy_language/v1/AlchemyLanguageExample.java index 9011414f815..f0f218612c0 100644 --- a/examples/java/com/ibm/watson/developer_cloud/alchemy_language/v1/AlchemyLanguageExample.java +++ b/examples/java/com/ibm/watson/developer_cloud/alchemy_language/v1/AlchemyLanguageExample.java @@ -20,6 +20,7 @@ import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentSentiment; import com.ibm.watson.developer_cloud.alchemy.v1.model.Entities; +import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelations; public class AlchemyLanguageExample { @@ -31,12 +32,18 @@ public static void main(String[] args) { params.put(AlchemyLanguage.TEXT, "IBM Watson won the Jeopardy television show hosted by Alex Trebek"); + // get sentiment DocumentSentiment sentiment = service.getSentiment(params).execute(); System.out.println("Sentiment: " + sentiment); - + + // get entities Entities entities = service.getEntities(params).execute(); System.out.println("Entities: " + entities); + // get typed relations + TypedRelations relations = service.getTypedRelations(params).execute(); + System.out.println("Relations: " + relations); + } } diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java index 2697225d3a0..ab680983164 100755 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Article.java @@ -37,7 +37,7 @@ public static class EnrichedTitle extends GenericModel { private Sentiment sentiment; private List taxonomy; - + /** * Gets the concepts. * @@ -64,6 +64,7 @@ public List getEntities() { public List getKeywords() { return keywords; } + /** * Gets the relations. * @@ -72,7 +73,7 @@ public List getKeywords() { public List getRelations() { return relations; } - + /** * Gets the sentiment. * @@ -200,6 +201,7 @@ public List getConcepts() { public EnrichedTitle getEnrichedTitle() { return enrichedTitle; } + /** * Gets the entities. * @@ -208,6 +210,7 @@ public EnrichedTitle getEnrichedTitle() { public List getEntities() { return entities; } + /** * Gets the feeds. * @@ -216,6 +219,7 @@ public List getEntities() { public List getFeeds() { return feeds; } + /** * Gets the image. * @@ -224,6 +228,7 @@ public List getFeeds() { public String getImage() { return image; } + /** * Gets the image keywords. * @@ -232,6 +237,7 @@ public String getImage() { public List getImageKeywords() { return imageKeywords; } + /** * Gets the keywords. * @@ -240,6 +246,7 @@ public List getImageKeywords() { public List getKeywords() { return keywords; } + /** * Gets the language. * @@ -248,6 +255,7 @@ public List getKeywords() { public String getLanguage() { return language; } + /** * Gets the publication date. * @@ -256,6 +264,7 @@ public String getLanguage() { public PublicationDate getPublicationDate() { return publicationDate; } + /** * Gets the relations. * @@ -264,6 +273,7 @@ public PublicationDate getPublicationDate() { public List getRelations() { return relations; } + /** * Gets the sentiment. * @@ -272,6 +282,7 @@ public List getRelations() { public Sentiment getSentiment() { return sentiment; } + /** * Gets the taxonomy. * @@ -280,6 +291,7 @@ public Sentiment getSentiment() { public List getTaxonomy() { return taxonomy; } + /** * Gets the text. * @@ -288,6 +300,7 @@ public List getTaxonomy() { public String getText() { return text; } + /** * Gets the title. * @@ -296,6 +309,7 @@ public String getText() { public String getTitle() { return title; } + /** * Gets the url. * @@ -304,6 +318,7 @@ public String getTitle() { public String getUrl() { return url; } + /** * Sets the author. * @@ -322,7 +337,7 @@ public void setCleanedTitle(String cleanedTitle) { this.cleanedTitle = cleanedTitle; } - + /** * Sets the concepts. * @@ -349,7 +364,7 @@ public void setEnrichedTitle(EnrichedTitle enrichedTitle) { public void setEntities(List entities) { this.entities = entities; } - + /** * Sets the feeds. * diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java index d0e743e24c5..448d3a80d1d 100755 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java @@ -65,7 +65,7 @@ public String getText() { * @param hierarchy The hierarchy. */ public void setHierarchy(String hierarchy) { - if(knowledgeGraph == null) { + if (knowledgeGraph == null) { knowledgeGraph = new KnowledgeGraph(); } diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java index 3cf5a6ea28c..8d4a902ebd6 100755 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Taxonomy.java @@ -14,7 +14,6 @@ package com.ibm.watson.developer_cloud.alchemy.v1.model; import com.google.gson.annotations.JsonAdapter; - import com.ibm.watson.developer_cloud.service.model.GenericModel; import com.ibm.watson.developer_cloud.util.BooleanToStringTypeAdapter; diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java new file mode 100644 index 00000000000..ad3b5bda1ba --- /dev/null +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedArguments.java @@ -0,0 +1,86 @@ +/** + * 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.alchemy.v1.model; + +import java.util.List; + +import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; +import com.ibm.watson.developer_cloud.service.model.GenericModel; + +/** + * Argument of a typed relation. It includes the detected {@link TypedEntity}, text and part. + * + * @see AlchemyLanguage#getTypedRelations(java.util.Map) + */ +public class TypedArguments extends GenericModel { + + private String part; + private String text; + private List entities; + + /** + * Gets the entities. + * + * @return the entities + */ + public List getEntities() { + return entities; + } + + /** + * Sets the entities. + * + * @param entities the new entities + */ + public void setTypedEntities(List entities) { + this.entities = entities; + } + + /** + * Gets the part. + * + * @return the part + */ + public String getPart() { + return part; + } + + /** + * Sets the part. + * + * @param part the new part + */ + public void setPart(String part) { + this.part = part; + } + + /** + * Gets the text. + * + * @return the text + */ + public String getText() { + return text; + } + + /** + * 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/alchemy/v1/model/TypedEntity.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java index 54e17cd4a72..850ef38f748 100644 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedEntity.java @@ -14,20 +14,17 @@ package com.ibm.watson.developer_cloud.alchemy.v1.model; -import com.google.gson.annotations.SerializedName; import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; +import com.ibm.watson.developer_cloud.service.model.GenericModel; /** * Recognized entity from {@link AlchemyLanguage#getTypedRelations(java.util.Map)} */ -public class TypedEntity { +public class TypedEntity extends GenericModel { + private String id; private String text; - private String mention; private String type; - @SerializedName("argNum") - private Integer argumentNumber; - private String id; /** * Gets the text. @@ -47,24 +44,6 @@ public void setText(String text) { this.text = text; } - /** - * Gets the mention. - * - * @return The mention - */ - public String getMention() { - return mention; - } - - /** - * Sets the mention. - * - * @param mention The mention - */ - public void setMention(String mention) { - this.mention = mention; - } - /** * Gets the type. * @@ -83,24 +62,6 @@ public void setType(String type) { this.type = type; } - /** - * Gets the argument number. - * - * @return The argument number - */ - public Integer getArgumentNumber() { - return argumentNumber; - } - - /** - * Sets the argument number. - * - * @param argumentNumber the new argument number - */ - public void setArgumentNumber(Integer argumentNumber) { - this.argumentNumber = argumentNumber; - } - /** * Gets the id. * diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java index 52a350c57bf..f782607bca6 100644 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelation.java @@ -1,4 +1,4 @@ -/* +/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except @@ -17,88 +17,91 @@ import java.util.List; import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage; +import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * Typed relation between {@link TypedEntity}. + * Typed relation between {@link TypedArguments}. + * * @see AlchemyLanguage#getTypedRelations(java.util.Map) */ -public class TypedRelation { +public class TypedRelation extends GenericModel { + + private String sentence; + private String type; + private Double score; - private String text; - private String type; - private Double score; - private List entities; + private List arguments; - /** - * Gets the text. - * - * @return The text - */ - public String getText() { - return text; - } + /** + * Gets the type. + * + * @return The type + */ + public String getType() { + return type; + } - /** - * Sets the text. - * - * @param text The text - */ - public void setText(String text) { - this.text = text; - } + /** + * Sets the type. + * + * @param type The type + */ + public void setType(String type) { + this.type = type; + } - /** - * Gets the type. - * - * @return The type - */ - public String getType() { - return type; - } + /** + * Gets the score. + * + * @return The score + */ + public Double getScore() { + return score; + } - /** - * Sets the type. - * - * @param type The type - */ - public void setType(String type) { - this.type = type; - } + /** + * Sets the score. + * + * @param score The score + */ + public void setScore(Double score) { + this.score = score; + } - /** - * Gets the score. - * - * @return The score - */ - public Double getScore() { - return score; - } + /** + * Gets the sentence. + * + * @return the sentence + */ + public String getSentence() { + return sentence; + } - /** - * Sets the score. - * - * @param score The score - */ - public void setScore(Double score) { - this.score = score; - } + /** + * Sets the sentence. + * + * @param sentence the new sentence + */ + public void setSentence(String sentence) { + this.sentence = sentence; + } - /** - * Gets the entities. - * - * @return The entities - */ - public List getEntities() { - return entities; - } + /** + * Gets the arguments. + * + * @return the arguments + */ + public List getArguments() { + return arguments; + } - /** - * Sets the entities. - * - * @param entities The entities - */ - public void setEntities(List entities) { - this.entities = entities; - } + /** + * Sets the arguments. + * + * @param arguments the new arguments + */ + public void setArguments(List arguments) { + this.arguments = arguments; + } } diff --git a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java index 8426f8b2230..4969c88707a 100644 --- a/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java +++ b/src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/TypedRelations.java @@ -1,4 +1,4 @@ -/* +/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except @@ -20,10 +20,30 @@ /** * Typed relation between {@link TypedEntity}. + * * @see AlchemyLanguage#getTypedRelations(java.util.Map) */ -public class TypedRelations extends AlchemyLanguageGenericModel{ +public class TypedRelations extends AlchemyLanguageGenericModel { + private String model; + + /** + * Gets the model. + * + * @return the model + */ + public String getModel() { + return model; + } + + /** + * Sets the model. + * + * @param model the new model + */ + public void setModel(String model) { + this.model = model; + } /** The typedRelations. */ private List typedRelations; @@ -45,6 +65,6 @@ public List getTypedRelations() { public void setTypedRelations(List typedRelations) { this.typedRelations = typedRelations; } - - + + } diff --git a/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java b/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java index db197d06ca9..1df062564a0 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguageIT.java @@ -16,6 +16,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.junit.Assert; @@ -40,17 +41,17 @@ import com.ibm.watson.developer_cloud.alchemy.v1.model.Microformats; import com.ibm.watson.developer_cloud.alchemy.v1.model.SAORelations; import com.ibm.watson.developer_cloud.alchemy.v1.model.Taxonomies; +import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedArguments; +import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedEntity; +import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelation; import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelations; /** - * Created by nizar on 8/25/15. + * Alchemy Language Integration tests */ public class AlchemyLanguageIT extends WatsonServiceTest { - /** The html example. */ private String htmlExample; - - /** The service. */ private AlchemyLanguage service; /* @@ -484,12 +485,30 @@ public void testGetTypedRelationsHTML() { */ @Test public void testGetTypedRelationsText() { - final Map params = new HashMap(); - params.put(AlchemyLanguage.TEXT, "Jake is one of the developers in the team."); - params.put(AlchemyLanguage.MODEL_ID, "en-us-tir"); - final TypedRelations typedRelations = service.getTypedRelations(params).execute(); - Assert.assertNotNull(typedRelations); - Assert.assertNotNull(typedRelations.getTypedRelations()); + final Map params = new HashMap(); + params.put(AlchemyLanguage.TEXT, "Leiming Qian lives in New York."); + params.put(AlchemyLanguage.MODEL_ID, "ie-en-news"); + final TypedRelations typedRelations = service.getTypedRelations(params).execute(); + Assert.assertNotNull(typedRelations); + List relations = typedRelations.getTypedRelations(); + Assert.assertNotNull(relations); + Assert.assertFalse(relations.isEmpty()); + for (TypedRelation relation : relations) { + Assert.assertNotNull(relation.getType()); + Assert.assertNotNull(relation.getSentence()); + Assert.assertNotNull(relation.getArguments()); + Assert.assertFalse(relation.getArguments().isEmpty()); + for (TypedArguments arg : relation.getArguments()) { + Assert.assertNotNull(arg.getPart()); + Assert.assertNotNull(arg.getText()); + Assert.assertNotNull(arg.getEntities()); + for (TypedEntity e : arg.getEntities()) { + Assert.assertNotNull(e.getId()); + Assert.assertNotNull(e.getText()); + Assert.assertNotNull(e.getType()); + } + } + } } /** diff --git a/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java b/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java index 9a4447ff03d..0838921ae54 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVisionIT.java @@ -38,7 +38,7 @@ public class AlchemyVisionIT extends WatsonServiceTest { private static final String IMAGE_OBAMA = "src/test/resources/alchemy/obama.jpg"; private static final String IMAGE_COLORADO = "src/test/resources/alchemy/colorado.jpg"; - private static final String IMAGE_COLORADO_URL = "http://vision.alchemy.ai/img/demo/1754836.jpg"; + private static final String IMAGE_COLORADO_URL = "https://raw.githubusercontent.com/watson-developer-cloud/doc-tutorial-downloads/master/visual-recognition/colorado.jpg"; private static final String BABY_IMAGE = "https://visual-recognition-demo.mybluemix.net/images/samples/1.jpg"; diff --git a/src/test/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsightsIT.java b/src/test/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsightsIT.java index 4ef960e66ad..ce1cfcba848 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsightsIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsightsIT.java @@ -21,6 +21,7 @@ import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import com.ibm.watson.developer_cloud.WatsonServiceTest; @@ -53,6 +54,7 @@ /** * The Class ConceptInsightsTest. */ +@Ignore public class ConceptInsightsIT extends WatsonServiceTest { /** The Constant PUBLIC. */ diff --git a/src/test/java/com/ibm/watson/developer_cloud/conversation/v1_experimental/ConversationServiceIT.java b/src/test/java/com/ibm/watson/developer_cloud/conversation/v1_experimental/ConversationServiceIT.java index b7847064841..9be20b178bf 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/conversation/v1_experimental/ConversationServiceIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/conversation/v1_experimental/ConversationServiceIT.java @@ -18,6 +18,7 @@ import java.util.Map; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import com.ibm.watson.developer_cloud.WatsonServiceTest; @@ -27,6 +28,7 @@ /** * Integration test for the {@link ConversationService}. */ +@Ignore public class ConversationServiceIT extends WatsonServiceTest { private ConversationService service; diff --git a/src/test/java/com/ibm/watson/developer_cloud/personality_insights/v2/PersonalityInsightsIT.java b/src/test/java/com/ibm/watson/developer_cloud/personality_insights/v2/PersonalityInsightsIT.java index 77c164c264b..5e2e4e19d5f 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/personality_insights/v2/PersonalityInsightsIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/personality_insights/v2/PersonalityInsightsIT.java @@ -17,7 +17,6 @@ import java.io.File; import java.io.FileInputStream; -import java.util.Arrays; import java.util.Collections; import java.util.Date; diff --git a/src/test/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1/RetrieveAndRankIT.java b/src/test/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1/RetrieveAndRankIT.java index 653dd5fd8cd..bbacc41b015 100644 --- a/src/test/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1/RetrieveAndRankIT.java +++ b/src/test/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1/RetrieveAndRankIT.java @@ -13,7 +13,11 @@ */ package com.ibm.watson.developer_cloud.retrieve_and_rank.v1; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; @@ -81,6 +85,7 @@ public void setUp() throws Exception { /** * Test delete all rankers. */ + @Ignore @Test public void testDeleteAllRankers() { List rankers = service.getRankers().execute().getRankers(); @@ -208,6 +213,7 @@ public void testGetRankerStatus() { * Test get solr cluster. */ @Test + @Ignore public void testGetSolrCluster() { final SolrCluster cluster = service.getSolrCluster(clusterId).execute(); assertNotNull(cluster); @@ -323,6 +329,7 @@ public void testUploadAndDeleteSolrClusterConfigurationZip() { * @throws InterruptedException */ @Test + @Ignore public void testSolrClusterResize() throws InterruptedException { SolrClusterSizeResponse resizeRequestResponse = service.resizeSolrCluster(clusterId, 2).execute(); 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 index 5bf3b57641c..4b1d51a2e80 100644 --- 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 @@ -15,14 +15,16 @@ 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 Integration tests. + * Tone Analyzer v3 Beta Integration tests. */ +@Ignore public class ToneAnalyzerIT extends WatsonServiceTest { /** The service. */