Skip to content

Commit 23d15df

Browse files
Add descriptive Javadoc comments for Concept Insights classes, methods
#47
1 parent d104c9e commit 23d15df

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsights.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public ConceptInsights() {
219219
*/
220220
public Annotations annotateText(final Graph graph, final String text) {
221221
String graphId = IDHelper.getGraphId(graph, getAccountId());
222-
Validate.notNull(text, "text can't be null");
222+
Validate.notEmpty(text, "text cannot be empty");
223223

224224
HttpRequestBase request = Request.Post(API_VERSION + graphId + ANNOTATE_TEXT_PATH)
225225
.withContent(text, MediaType.TEXT_PLAIN).withHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
@@ -252,7 +252,7 @@ public Annotations annotateText(final Graph graph, final String text) {
252252
* @return {@link QueryConcepts}
253253
*/
254254
public QueryConcepts conceptualSearch(Corpus corpus, Map<String, Object> parameters) {
255-
Validate.notNull(parameters.get(IDS), "ids can't be null");
255+
Validate.notNull(parameters.get(IDS), "ids cannot be null");
256256
String corpusId = IDHelper.getCorpusId(corpus, getAccountId());
257257

258258
Map<String, Object> queryParams = new HashMap<String, Object>();
@@ -473,7 +473,7 @@ public Concepts getCorpusRelatedConcepts(final Corpus corpus, final Map<String,
473473
*/
474474
public Scores getCorpusRelationScores(final Corpus corpus, final List<Concept> concepts) {
475475
String corpusId = IDHelper.getCorpusId(corpus, getAccountId());
476-
Validate.notNull(concepts, "concepts can't be null");
476+
Validate.notEmpty(concepts, "concepts cannot be empty");
477477

478478
Map<String, Object> queryParameters = new HashMap<String, Object>();
479479
JsonObject contentJson = new JsonObject();
@@ -577,7 +577,7 @@ public Concepts getDocumentRelatedConcepts(final Document document, final Map<St
577577
*/
578578
public Scores getDocumentRelationScores(final Document document, final List<Concept> concepts) {
579579
String documentId = IDHelper.getDocumentId(document);
580-
Validate.notNull(concepts, "concepts can't be null");
580+
Validate.notEmpty(concepts, "concepts cannot be empty");
581581

582582
Map<String, Object> queryParams = new HashMap<String, Object>();
583583
JsonObject contentJson = new JsonObject();
@@ -613,7 +613,7 @@ public Scores getDocumentRelationScores(final Document document, final List<Conc
613613
public Concepts getGraphRelatedConcepts(final Graph graph, final List<Concept> concepts,
614614
final Map<String, Object> parameters) {
615615
String graphId = IDHelper.getGraphId(graph, getAccountId());
616-
Validate.notNull(concepts, "concepts should be specified");
616+
Validate.notEmpty(concepts, "concepts cannot be empty");
617617

618618
Map<String, Object> queryParameters = new HashMap<String, Object>();
619619
String[] queryParms = new String[] { LEVEL, LIMIT };
@@ -682,7 +682,7 @@ public Concepts getConceptRelatedConcepts(final Concept concept, final Map<Strin
682682
*/
683683
public Scores getGraphRelationScores(final Concept concept, final List<String> concepts) {
684684
String conceptId = IDHelper.getConceptId(concept);
685-
Validate.notNull(concepts, "concepts can't be null");
685+
Validate.notEmpty(concepts, "concepts cannot be empty");
686686

687687
Map<String, Object> queryParameters = new HashMap<String, Object>();
688688
JsonObject contentJson = new JsonObject();
@@ -714,7 +714,7 @@ public Corpora listCorpora() {
714714
* @return {@link Corpora}
715715
*/
716716
public Corpora listCorpora(final String accountId) {
717-
Validate.notNull(accountId, "account_id can't be null");
717+
Validate.notEmpty(accountId, "account_id cannot be empty");
718718
return executeRequest(CORPORA_PATH + FORWARD_SLASH + accountId, null, Corpora.class);
719719
}
720720

@@ -791,7 +791,7 @@ public Graphs listGraphs() {
791791
*/
792792
public Matches searchCorpusByLabel(final Corpus corpus, final Map<String, Object> parameters) {
793793
String corpusId = IDHelper.getCorpusId(corpus, getAccountId());
794-
Validate.notNull(parameters.get(QUERY), "query can't be null");
794+
Validate.notEmpty((String)parameters.get(QUERY), "query cannot be empty");
795795

796796
Map<String, Object> queryParameters = new HashMap<String, Object>();
797797
String[] queryParams = new String[] { QUERY, PREFIX, LIMIT, CONCEPTS };
@@ -836,7 +836,7 @@ public Matches searchCorpusByLabel(final Corpus corpus, final Map<String, Object
836836
*/
837837
public Matches searchGraphsConceptByLabel(final Graph graph, final Map<String, Object> parameters) {
838838
String graphId = IDHelper.getGraphId(graph, getAccountId());
839-
Validate.notNull(parameters.get(QUERY), "query can't be null");
839+
Validate.notEmpty((String)parameters.get(QUERY), "query cannot be empty");
840840

841841
Map<String, Object> queryParameters = new HashMap<String, Object>();
842842
String[] params = new String[] { QUERY, PREFIX, LIMIT };

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/BuildStatus.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,39 @@
2222
* BuildStatus returned by the {@link ConceptInsights} service.
2323
*
2424
*/
25-
public class BuildStatus extends GenericModel {
25+
public class BuildStatus extends GenericModel {
2626

27-
/** The error. */
27+
/** The number of documents that were processed with an error. */
2828
private Integer error;
2929

30-
/** The processing. */
30+
/** The number of documents that are being processed. */
3131
private Integer processing;
3232

33-
/** The ready. */
33+
/** The number of documents that were processed. */
3434
private Integer ready;
3535

3636
/**
37-
* Gets the error.
37+
* Gets the number of documents that were processed with an error.
3838
*
39-
* @return The error
39+
* @return The error count
4040
*/
4141
public Integer getError() {
4242
return error;
4343
}
4444

4545
/**
46-
* Gets the processing.
46+
* Gets the number of documents that are being processed.
4747
*
48-
* @return The processing
48+
* @return The processing count
4949
*/
5050
public Integer getProcessing() {
5151
return processing;
5252
}
5353

5454
/**
55-
* Gets the ready.
55+
* Gets the number of documents that were processed.
5656
*
57-
* @return The ready
57+
* @return The processed document count
5858
*/
5959
public Integer getReady() {
6060
return ready;

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Concept.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public Concept() {}
4747
* @param concept the concept
4848
*/
4949
public Concept(final String accountId, final String graphName, final String concept) {
50-
Validate.notNull(concept, "concept can't be null");
50+
Validate.notNull(concept, "concept cannot be null");
5151
setName(concept);
5252
setId(new Graph(accountId, graphName).getId() + "/concepts/" + concept);
5353
}
@@ -61,8 +61,8 @@ public Concept(final String accountId, final String graphName, final String conc
6161
* the concept
6262
*/
6363
public Concept(final Graph graph, final String concept) {
64-
Validate.notNull(graph, "graph can't be null");
65-
Validate.notNull(graph.getId(), "graph.id can't be null");
64+
Validate.notNull(graph, "graph cannot be null");
65+
Validate.notNull(graph.getId(), "graph.id cannot be null");
6666
setName(concept);
6767
setId(graph.getId() + "/concepts/" + concept);
6868
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Corpus.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public Corpus() {}
5555
* the corpus name
5656
*/
5757
public Corpus(String accountId, String name) {
58-
Validate.notNull(accountId,"accountId can't be null");
59-
Validate.notNull(name,"name can't be null");
58+
Validate.notEmpty(accountId,"accountId cannot be empty");
59+
Validate.notEmpty(name,"name cannot be empty");
6060
setName(name);
6161
setId("/corpora/" + accountId + "/" + name);
6262
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Document.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class Document extends GenericModel {
4242
public Document() {}
4343

4444
public Document(final String accountId, final String corpusName, final String document) {
45-
Validate.notNull(document, "document can't be null");
45+
Validate.notEmpty(document, "document cannot be empty");
4646
setName(document);
4747
setId(new Corpus(accountId, corpusName).getId() + "/documents/" + document);
4848
}
@@ -56,8 +56,8 @@ public Document(final String accountId, final String corpusName, final String do
5656
* the concept
5757
*/
5858
public Document(final Corpus corpus, final String concept) {
59-
Validate.notNull(corpus, "corpus can't be null");
60-
Validate.notNull(corpus.getId(), "corpus.id can't be null");
59+
Validate.notNull(corpus, "corpus cannot be null");
60+
Validate.notEmpty(corpus.getId(), "corpus.id cannot be empty");
6161
setName(concept);
6262
setId(corpus.getId() + "/documents/" + concept);
6363
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Graph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public Graph() {}
4747
* the name
4848
*/
4949
public Graph(String accountId, String name) {
50-
Validate.notNull(accountId, "accountId can't be null");
51-
Validate.notNull(name, "name can't be null");
50+
Validate.notEmpty(accountId,"accountId cannot be empty");
51+
Validate.notEmpty(name, "name cannot be empty");
5252
setName(name);
5353
setId("/graphs/" + accountId + "/" + name);
5454
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/util/IDHelper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ public class IDHelper {
6565
* @return the corpus id
6666
*/
6767
public static String getCorpusId(final Corpus corpus, final String accoundId) {
68-
Validate.notNull(corpus, "corpus can't be null");
68+
Validate.notNull(corpus, "corpus cannot be null");
6969
if (corpus.getId() != null) {
7070
validate(CORPUS_ID_REGEX, corpus.getId(), "Provide a valid corpus.id (format is " + '"'
7171
+ "/corpora/{account_id}/{corpus} +" + '"' + ")");
7272
return corpus.getId();
7373
} else {
74-
Validate.notNull(corpus.getName(), "corpus.name can't be null");
74+
Validate.notNull(corpus.getName(), "corpus.name cannot be null");
7575
return "/corpora/" + accoundId + "/" + corpus.getName();
7676
}
7777
}
@@ -87,13 +87,13 @@ public static String getCorpusId(final Corpus corpus, final String accoundId) {
8787
* @return the graph id
8888
*/
8989
public static String getGraphId(final Graph graph, final String accoundId) {
90-
Validate.notNull(graph, "graph object can't be null");
90+
Validate.notNull(graph, "graph object cannot be null");
9191
if (graph.getId() != null) {
9292
validate(GRAPH_ID_REGEX, graph.getId(), "Provide a valid graph.id (format is " + '"'
9393
+ " (/graphs/{account_id}/{graph}) +" + '"' + ")");
9494
return graph.getId();
9595
} else {
96-
Validate.notNull(graph.getName(), "graph.name can't be null");
96+
Validate.notNull(graph.getName(), "graph.name cannot be null");
9797
return "/graphs/" + accoundId + "/" + graph.getName();
9898
}
9999
}
@@ -106,8 +106,8 @@ public static String getGraphId(final Graph graph, final String accoundId) {
106106
* @return the document id
107107
*/
108108
public static String getDocumentId(final Document document) {
109-
Validate.notNull(document, "document can't be null");
110-
Validate.notNull(document.getId(), "document.id can't be null");
109+
Validate.notNull(document, "document cannot be null");
110+
Validate.notNull(document.getId(), "document.id cannot be null");
111111

112112
validate(DOCUMENT_ID_REGEX, document.getId(), "Provide a valid document.id (format is " + '"'
113113
+ " (/corpora/{account_id}/{corpus}/documents/{document}) +" + '"' + ")");
@@ -122,8 +122,8 @@ public static String getDocumentId(final Document document) {
122122
* @return the concept id
123123
*/
124124
public static String getConceptId(final Concept concept) {
125-
Validate.notNull(concept, "concept can't be null");
126-
Validate.notNull(concept.getId(), "concept.id can't be null");
125+
Validate.notNull(concept, "concept cannot be null");
126+
Validate.notNull(concept.getId(), "concept.id cannot be null");
127127

128128
validate(CONCEPT_ID_REGEX, concept.getId(), "Provide a valid concept.id (format is " + '"'
129129
+ " (/graphs/{account_id}/{graph}/concepts/{concept})+" + '"' + ")");

0 commit comments

Comments
 (0)