Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
* [Concept Insights](alchemy)
* [Conversation](conversation)
* [Dialog](dialog)
* [Discovery](discovery)
* [Document Conversion](document-conversion)
* [Language Translation](language-translation)
* [Language Translator](language-translator)
Expand Down
5 changes: 5 additions & 0 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<artifactId>dialog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>discovery</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>document-conversion</artifactId>
Expand Down
30 changes: 30 additions & 0 deletions discovery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Discovery

## Installation

##### Maven
```xml
<dependency>
<groupId>com.ibm.watson.developer_cloud</groupId>
<artifactId>discovery</artifactId>
<version>3.5.3</version>
</dependency>
```

##### Gradle
```gradle
'com.ibm.watson.developer_cloud:discovery:3.5.3'
```

## Usage
The [Discovery][discovery] wraps the environment, collection, configuration, document, and query operations of the Discovery service.

```java
Discovery service = new Discovery("2016-12-15");
service.setEndpoint("https://gateway.watsonplatform.net/discovery/api/");
service.setUsernameAndPassword("<username>", "<password>");

//TODO add service
```

[discovery]: http://www.ibm.com/watson/developercloud/doc/discovery/
20 changes: 20 additions & 0 deletions discovery/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.ibm.watson.developer_cloud</groupId>
<version>3.5.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>discovery</artifactId>
<name>Discovery</name>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright 2016 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.discovery.v1.model.collection;

import com.google.gson.annotations.SerializedName;
import com.ibm.watson.developer_cloud.discovery.v1.model.common.Status;
import com.ibm.watson.developer_cloud.service.model.GenericModel;

import java.util.Date;

/**
* A Collection holds the documents that have been ingested and allows querying against it.
*/
public class Collection extends GenericModel {
@SerializedName(CollectionManager.ID)
private String collectionId;
@SerializedName(CollectionManager.NAME)
private String name;
@SerializedName(CollectionManager.STATUS)
private Status status;
@SerializedName(CollectionManager.CREATED)
private Date created;
@SerializedName(CollectionManager.UPDATED)
private Date updated;
@SerializedName(CollectionManager.DESCRIPTION)
private String description;
@SerializedName(CollectionManager.CONFIGURATION_ID)
private String configurationId;
@SerializedName(CollectionManager.LANGUAGE)
private String language;
@SerializedName(CollectionManager.DOCUMENT_COUNTS)
private DocumentCounts documentCounts;

public String getCollectionId() {
return collectionId;
}

public String getName() {
return name;
}

public Status getStatus() {
return status;
}

public Date getCreated() {
return created;
}

public Date getUpdated() {
return updated;
}

public String getDescription() {
return description;
}

public String getConfigurationId() {
return configurationId;
}

public String getLanguage() {
return language;
}

public DocumentCounts getDocumentCounts() {
return documentCounts;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright 2016 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.discovery.v1.model.collection;

import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsRequest;
import com.ibm.watson.developer_cloud.http.ServiceCall;
import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.GetCollectionFieldsResponse;
import com.ibm.watson.developer_cloud.discovery.v1.model.collection.field.Field;

/**
* Interface defining the constants and methods associated with Collections.
*
* @see Collection
*/
public interface CollectionManager {
String COLLECTIONS = "collections";

//Collection
String ID = "collection_id";
String NAME = "name";
String DESCRIPTION = "description";
String CREATED = "created";
String UPDATED = "update";
String STATUS = "status";
String CONFIGURATION_ID = "configuration_id";
String LANGUAGE = "language";
String DOCUMENT_COUNTS = "document_counts";

//Document Counts
String AVAILABLE = "available";
String PROCESSING = "processing";
String FAILED = "failed";

//Fields
String FIELDS = "fields";
String FIELD = "field";
String TYPE = "type";

/**
* Gets a list of {@link Collection}. An optional parameter of name can be provided to filter by name.
*
* @param getRequest options for getting the {@link Collection}s
* @return a {@link GetCollectionsResponse} containing the result of {@link GetCollectionsRequest}
*/
ServiceCall<GetCollectionsResponse> getCollections(GetCollectionsRequest getRequest);

/**
* Gets a {@link Collection}.
*
* @param getRequest options for getting the {@link Collection}
* @return a {@link GetCollectionResponse} containing the result of {@link GetCollectionRequest}
*/
ServiceCall<GetCollectionResponse> getCollection(GetCollectionRequest getRequest);

/**
* Creates a {@link Collection}.
*
* @param createRequest options for creating a {@link Collection}
* @return a {@link CreateCollectionResponse} containing the result of {@link CreateCollectionRequest}
*/
ServiceCall<CreateCollectionResponse> createCollection(CreateCollectionRequest createRequest);

/**
* Deletes a {@link Collection}.
*
* @param deleteRequest options for deleting a {@link Collection}
* @return a {@link DeleteCollectionResponse} containing the result of {@link DeleteCollectionRequest}
*/
ServiceCall<DeleteCollectionResponse> deleteCollection(DeleteCollectionRequest deleteRequest);

/**
* Gets a list of unique {@link Field}s from a {@link Collection}.
*
* @param getRequest options for getting a unique fields from a {@link Collection}
* @return a {@link GetCollectionFieldsResponse} containing the result of {@link GetCollectionFieldsRequest}
*/
ServiceCall<GetCollectionFieldsResponse> getCollectionFields(GetCollectionFieldsRequest getRequest);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright 2016 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

120 max line width

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is 119

* 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.discovery.v1.model.collection;

import com.ibm.watson.developer_cloud.service.model.GenericModel;

/**
* Request to create a {@link Collection}.
*/
public class CreateCollectionRequest extends GenericModel {
private final String environmentId;
private final String name;
private final String description;
private final String configurationId;
private final String language;

private CreateCollectionRequest(Builder builder) {
this.environmentId = builder.environmentId;
this.name = builder.name;
this.description = builder.description;
this.configurationId = builder.configurationId;
this.language = builder.language;
}

public String getEnvironmentId() {
return environmentId;
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

public String getConfigurationId() {
return configurationId;
}

public String getLanguage() {
return language;
}

public static class Builder {
private final String environmentId;
private final String name;
private final String configurationId;
private String description;
private String language;

public Builder(String environmentId, String configurationId, String name) {
this.environmentId = environmentId;
this.configurationId = configurationId;
this.name = name;
}

public Builder description(String description) {
this.description = description;
return this;
}

public Builder language(String language) {
this.language = language;
return this;
}

public CreateCollectionRequest build() {
return new CreateCollectionRequest(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2016 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.discovery.v1.model.collection;

/**
* Response from {@link CreateCollectionRequest}.
*/
public class CreateCollectionResponse extends Collection {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2016 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.discovery.v1.model.collection;

import com.ibm.watson.developer_cloud.service.model.GenericModel;

/**
* Request to delete a {@link Collection}.
*/
public class DeleteCollectionRequest extends GenericModel {
private final String environmentId;
private final String collectionId;

private DeleteCollectionRequest(Builder builder) {
this.environmentId = builder.environmentId;
this.collectionId = builder.collectionId;
}

public String getEnvironmentId() {
return environmentId;
}

public String getCollectionId() {
return collectionId;
}

public static class Builder {
private final String environmentId;
private final String collectionId;

public Builder(String environmentId, String collectionId) {
this.environmentId = environmentId;
this.collectionId = collectionId;
}

public DeleteCollectionRequest build() {
return new DeleteCollectionRequest(this);
}
}
}
Loading