From eea431916a83c7054118f3ee8e9907a670a4abd7 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Wed, 1 Mar 2017 16:57:48 -0500 Subject: [PATCH 001/735] RLPNC-4241: Fixed some documentation errors, work on name deduplication --- .../basistech/rosette/api/RosetteAPITest.java | 2 + .../api/common/AbstractRosetteAPI.java | 1 + .../examples/NameDeduplicationExample.java | 58 ++++++++++ .../com/basistech/rosette/examples/README.md | 10 +- .../apimodel/jackson/ApiModelMixinModule.java | 4 + .../NameDeduplicationRequestMixin.java | 35 ++++++ .../NameDeduplicationResponseMixin.java | 29 +++++ .../basistech/rosette/apimodel/ModelTest.java | 2 +- .../apimodel/PolymorphicRequestTest.java | 1 + .../apimodel/NameDeduplicationRequest.java | 100 ++++++++++++++++++ .../apimodel/NameDeduplicationResponse.java | 61 +++++++++++ release/src/scripts/run_all_examples.sh | 8 +- 12 files changed, 303 insertions(+), 8 deletions(-) create mode 100644 examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationResponseMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationResponse.java diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index ba45bdcb8..24c308152 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -426,4 +426,6 @@ private void verifyException(HttpRosetteAPIException e) throws IOException { ErrorResponse goldResponse = mapper.readValue(responseStr, ErrorResponse.class); assertEquals(goldResponse.getCode(), e.getErrorResponse().getCode()); } + + //todo add tests here for name dedup } diff --git a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java index 0b924488a..be1cd0fee 100644 --- a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java +++ b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java @@ -34,6 +34,7 @@ public abstract class AbstractRosetteAPI implements AutoCloseable { public static final String CATEGORIES_SERVICE_PATH = "/categories"; public static final String RELATIONSHIPS_SERVICE_PATH = "/relationships"; public static final String SENTIMENT_SERVICE_PATH = "/sentiment"; + public static final String NAME_DEDUPLICATION_SERVICE_PATH = "/name-deduplication"; public static final String NAME_TRANSLATION_SERVICE_PATH = "/name-translation"; public static final String NAME_SIMILARITY_SERVICE_PATH = "/name-similarity"; public static final String TOKENS_SERVICE_PATH = "/tokens"; diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java new file mode 100644 index 000000000..417ec257d --- /dev/null +++ b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java @@ -0,0 +1,58 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.examples; + +import com.basistech.rosette.api.HttpRosetteAPI; +import com.basistech.rosette.apimodel.Name; +import com.basistech.rosette.apimodel.NameDeduplicationRequest; +import com.basistech.rosette.apimodel.NameDeduplicationResponse; + +import java.io.IOException; +import java.util.ArrayList; + +/** + * Example which demonstrates name deduplication. + */ +public final class NameDeduplicationExample extends ExampleBase { + public static void main(String[] args) { + try { + new NameDeduplicationExample().run(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void run() throws IOException { + ArrayList names = new ArrayList<>(); + names.add(new Name("John Smith")); + names.add(new Name("Johnathan Smith")); + names.add(new Name("Fred Jones")); + + double threshold = 0.8; + + HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() + .key(getApiKeyFromSystemProperty()) + .url(getAltUrlFromSystemProperty()) + .build(); + //The api object creates an http client, but to provide your own: + //api.httpClient(CloseableHttpClient) + NameDeduplicationRequest request = new NameDeduplicationRequest(names, threshold); + NameDeduplicationResponse response = rosetteApi.perform(HttpRosetteAPI.NAME_DEDUPLICATION_SERVICE_PATH, request, + NameDeduplicationResponse.class); + System.out.println(responseToJson(response)); + } +} diff --git a/examples/src/main/java/com/basistech/rosette/examples/README.md b/examples/src/main/java/com/basistech/rosette/examples/README.md index 159b518c7..59cdd5a7f 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/README.md +++ b/examples/src/main/java/com/basistech/rosette/examples/README.md @@ -14,19 +14,21 @@ Otherwise you can compile and run these examples by hand: | File Name | Description | ------------- |------------- -| Base64InputExample.java | Entities using base64 encoded string | CategoriesExample.java | Gets the category of a document at a URL | EntitiesExample.java | Extracts entities | InfoExample.java | Gets information about Rosette API | LanguageExample.java | Detects language -| MatchedNameExample.java | Matches two names for similarity comparison | MorphologyCompleteExample.java | Gets the complete morphological analysis | MorphologyCompoundComponentsExample.java | Gets the de-compounded words | MorphologyHanReadingsExample.java | Gets the Chinese/Han readings | MorphologyLemmasExample.java | Gets the lemmas | MorphologyPartsOfSpeechExample.java | Gets the part-of-speech tags +| NameSimilarityExample.java | Matches two names and produces a match score +| NameTranslationExample.java | Translates a name | PingExample.java | Pings the Rosette API to check for availability +| RelationshipsExample.java | Demonstrates the entity extraction api. | SentencesExample.java | Gets the sentences | SentimentExample.java | Gets the sentiment of a local file -| TokenExample.java | Gets the tokens -| TranslatedNameExample.java | Transliterates a name +| SyntaxDependenciesExample.java | Demonstrates the syntax dependencies endpoint +| TextEmbeddingExample.java | Demonstrates text embeddings +| TokensExample.java | Gets the tokens diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 8ec054845..6979ed185 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -36,6 +36,8 @@ import com.basistech.rosette.apimodel.MorphologyOptions; import com.basistech.rosette.apimodel.MorphologyResponse; import com.basistech.rosette.apimodel.Name; +import com.basistech.rosette.apimodel.NameDeduplicationRequest; +import com.basistech.rosette.apimodel.NameDeduplicationResponse; import com.basistech.rosette.apimodel.NameSimilarityRequest; import com.basistech.rosette.apimodel.NameSimilarityResponse; import com.basistech.rosette.apimodel.NameTranslationRequest; @@ -99,6 +101,8 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(MorphologyOptions.class, MorphologyOptionsMixin.class); context.setMixInAnnotations(MorphologyResponse.class, MorphologyResponseMixin.class); context.setMixInAnnotations(Name.class, NameMixin.class); + context.setMixInAnnotations(NameDeduplicationRequest.class, NameDeduplicationRequestMixin.class); + context.setMixInAnnotations(NameDeduplicationResponse.class, NameDeduplicationResponseMixin.class); context.setMixInAnnotations(NameSimilarityRequest.class, NameSimilarityRequestMixin.class); context.setMixInAnnotations(NameSimilarityResponse.class, NameSimilarityResponseMixin.class); context.setMixInAnnotations(NameTranslationRequest.class, NameTranslationRequestMixin.class); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java new file mode 100644 index 000000000..094333133 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java @@ -0,0 +1,35 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.basistech.rosette.apimodel.Name; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.List; + +@JsonTypeName("NameDeduplicationRequest") +public class NameDeduplicationRequestMixin extends BaseMixin { + @JsonCreator + protected NameDeduplicationRequestMixin( + @JsonProperty("names") List names, + @JsonProperty("threshold") double threshold + ) { + // + } +} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationResponseMixin.java new file mode 100644 index 000000000..7749a4e6b --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationResponseMixin.java @@ -0,0 +1,29 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class NameDeduplicationResponseMixin extends BaseMixin { + @JsonCreator + protected NameDeduplicationResponseMixin(@JsonProperty("results") List results) { + // + } +} diff --git a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java index df5d18941..f839c3ba1 100644 --- a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java +++ b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java @@ -139,7 +139,7 @@ public void packageTest() throws ClassNotFoundException, IllegalAccessException, } String json = writer.writeValueAsString(o1); // deserialize - Object o2 = mapper.readValue(json, (Class) clazz); + Object o2 = mapper.readValue(json, (Class) clazz); // verify assertEquals(o1, o2); } diff --git a/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java b/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java index 6b9a6b9a1..6ea1470c2 100644 --- a/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java +++ b/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java @@ -45,5 +45,6 @@ public void testRequestTypes() throws Exception { request = mapper.readValue(json, NameTranslationRequest.class); assertTrue(request instanceof NameTranslationRequest); + //todo need to add for NameDeduplicationRequest? } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java new file mode 100644 index 000000000..60df5cda2 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java @@ -0,0 +1,100 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Objects; + +/** + * Request object for name-deduplication. + * + * This class carries the list of names to dedupe as well as the score threshold. + */ +public final class NameDeduplicationRequest extends Request { + + @NotNull + private List names; + @NotNull + private double threshold; + + /** + * Constructor for {@code NameMatchingRequest} + * @param names List of names to be deduplicated + * @param threshold score threshold used to tune the strictness of the clustering algorithm + */ + public NameDeduplicationRequest(List names, + double threshold) { + this.names = names; + this.threshold = threshold; + } + + /** + * Gets the names + * @return the names + */ + public List getNames() { + return names; + } + + /** + * Gets the threshold + * @return the threshold + */ + public double getThreshold() { + return threshold; + } + + /** + * Sets the names + * @param names the names. + */ + public void setNames(List names) { + this.names = names; + } + + /** + * Sets the threshold + * @param threshold the threshold. + */ + public void setName2(double threshold) { + this.threshold = threshold; + } + + @Override + public int hashCode() { + return Objects.hash(names, threshold); + } + + /** + * if the param is a {@code NameSimilarityRequest}, compare contents for equality + * @param o the object + * @return whether or not the param object is equal to this object + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NameDeduplicationRequest that = (NameDeduplicationRequest) o; + return Double.compare(that.threshold, threshold) == 0 + && Objects.equals(names, that.names); + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationResponse.java b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationResponse.java new file mode 100644 index 000000000..0e1661dca --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationResponse.java @@ -0,0 +1,61 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.List; +import java.util.Objects; + +/** + * Response data model for the deduplication of a list of names + */ +public final class NameDeduplicationResponse extends Response { + + private final List results; + + /** + * Constructor for {@code NameMatchingResponse} + * @param results the results from deduplication as a list of cluster IDs. + */ + public NameDeduplicationResponse(List results) { + this.results = results; + } + + /** + * Gets the name deduplication results + * @return name deduplication results + */ + public List getResults() { + return results; + } + + @Override + public int hashCode() { + return Objects.hash(results); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NameDeduplicationResponse that = (NameDeduplicationResponse) o; + return Objects.equals(results, that.results); + } +} diff --git a/release/src/scripts/run_all_examples.sh b/release/src/scripts/run_all_examples.sh index 4e883405f..b15a20d24 100644 --- a/release/src/scripts/run_all_examples.sh +++ b/release/src/scripts/run_all_examples.sh @@ -10,21 +10,23 @@ key=$1 read -d '' examples < Date: Wed, 1 Mar 2017 17:33:00 -0500 Subject: [PATCH 002/735] RLPNC-4241: Added case to PolymorphicRequestTest for name deduplication --- .../basistech/rosette/apimodel/PolymorphicRequestTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java b/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java index 6ea1470c2..ddd6c386f 100644 --- a/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java +++ b/json/src/test/java/com/basistech/rosette/apimodel/PolymorphicRequestTest.java @@ -45,6 +45,8 @@ public void testRequestTypes() throws Exception { request = mapper.readValue(json, NameTranslationRequest.class); assertTrue(request instanceof NameTranslationRequest); - //todo need to add for NameDeduplicationRequest? + json = "{\"names\": [{\"text\": \"Joe\"}, {\"text\": \"Smith\"}], \"threshold\": 0.8}"; + request = mapper.readValue(json, NameDeduplicationRequest.class); + assertTrue(request instanceof NameDeduplicationRequest); } } From 2d6cc992bda4224df42226141c9e6761382f9f72 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Thu, 2 Mar 2017 14:50:10 -0500 Subject: [PATCH 003/735] RLPNC-4241: Reverting some changes, more work on tests --- .../com/basistech/rosette/api/RosetteAPI.java | 16 ++++++++++ .../basistech/rosette/api/RosetteAPITest.java | 31 ++++++++++++++++++- .../request/rni-1-name-deduplication.json | 7 +++++ .../response/rni-1-name-deduplication.json | 7 +++++ .../response/rni-1-name-deduplication.status | 1 + .../com/basistech/rosette/examples/README.md | 7 ++--- .../basistech/rosette/apimodel/ModelTest.java | 2 +- release/src/scripts/run_all_examples.sh | 3 +- 8 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 api/src/test/mock-data/request/rni-1-name-deduplication.json create mode 100644 api/src/test/mock-data/response/rni-1-name-deduplication.json create mode 100644 api/src/test/mock-data/response/rni-1-name-deduplication.status diff --git a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java index e600bdded..01ea41bea 100644 --- a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java @@ -28,6 +28,7 @@ import com.basistech.rosette.apimodel.MorphologyOptions; import com.basistech.rosette.apimodel.MorphologyResponse; import com.basistech.rosette.apimodel.Name; +import com.basistech.rosette.apimodel.NameDeduplicationResponse; import com.basistech.rosette.apimodel.NameSimilarityRequest; import com.basistech.rosette.apimodel.NameSimilarityResponse; import com.basistech.rosette.apimodel.NameTranslationRequest; @@ -121,6 +122,7 @@ public class RosetteAPI implements Closeable { public static final String CATEGORIES_SERVICE_PATH = "/categories"; public static final String RELATIONSHIPS_SERVICE_PATH = "/relationships"; public static final String SENTIMENT_SERVICE_PATH = "/sentiment"; + public static final String NAME_DEDUPLICATION_SERVICE_PATH = "/name-deduplication"; public static final String NAME_TRANSLATION_SERVICE_PATH = "/name-translation"; public static final String NAME_SIMILARITY_SERVICE_PATH = "/name-similarity"; public static final String TOKENS_SERVICE_PATH = "/tokens"; @@ -358,6 +360,20 @@ public NameTranslationResponse getNameTranslation(NameTranslationRequest request return sendPostRequest(request, urlBase + NAME_TRANSLATION_SERVICE_PATH, NameTranslationResponse.class); } + /** + * Returns a list of cluster IDs to be used in deduplication from a list of names specified in + * NameDeduplicationRequest. + * + * @param request NameDeduplication contains the names to be deduplicated and the score threshold. + * @return the response. + * @throws RosetteAPIException - If there is a problem with the Rosette API request. + * @throws IOException - If there is a communication or JSON serialization/deserialization error. + */ + public NameDeduplicationResponse getNameDeduplication(NameTranslationRequest request) + throws RosetteAPIException, IOException { + return sendPostRequest(request, urlBase + NAME_DEDUPLICATION_SERVICE_PATH, NameDeduplicationResponse.class); + } + /** * Performs language identification on data read from an InputStream. Return a list of languages. * diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index 24c308152..70449fc5b 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -23,6 +23,8 @@ import com.basistech.rosette.apimodel.ErrorResponse; import com.basistech.rosette.apimodel.LanguageResponse; import com.basistech.rosette.apimodel.MorphologyResponse; +import com.basistech.rosette.apimodel.NameDeduplicationRequest; +import com.basistech.rosette.apimodel.NameDeduplicationResponse; import com.basistech.rosette.apimodel.NameSimilarityRequest; import com.basistech.rosette.apimodel.NameSimilarityResponse; import com.basistech.rosette.apimodel.NameTranslationRequest; @@ -427,5 +429,32 @@ private void verifyException(HttpRosetteAPIException e) throws IOException { assertEquals(goldResponse.getCode(), e.getErrorResponse().getCode()); } - //todo add tests here for name dedup + @Test + public void testNameDeduplication() throws IOException { + if (!(testFilename.endsWith("-name-deduplication.json"))) { + return; + } + System.out.println("DEDUPLICATE NAME HAPPENING"); + NameDeduplicationRequest request = readValueNameDeduplication(); + try { + NameDeduplicationResponse response = api.perform(AbstractRosetteAPI.NAME_DEDUPLICATION_SERVICE_PATH, + request, NameDeduplicationResponse.class); + verifyNameDeduplication(response); + } catch (HttpRosetteAPIException e) { + verifyException(e); + } + } + + private void verifyNameDeduplication(NameDeduplicationResponse response) throws IOException { + NameDeduplicationResponse goldResponse = mapper.readValue(responseStr, NameDeduplicationResponse.class); + for (String str : response.getResults()) { + System.out.println("Result: " + str); + } + assertEquals(goldResponse.getResults(),response.getResults()); + } + + private NameDeduplicationRequest readValueNameDeduplication() throws IOException { + File input = new File("src/test/mock-data/request", testFilename); + return mapper.readValue(input, NameDeduplicationRequest.class); + } } diff --git a/api/src/test/mock-data/request/rni-1-name-deduplication.json b/api/src/test/mock-data/request/rni-1-name-deduplication.json new file mode 100644 index 000000000..b0ed81ad9 --- /dev/null +++ b/api/src/test/mock-data/request/rni-1-name-deduplication.json @@ -0,0 +1,7 @@ +{ + "names": [ + {"text": "Joe"}, + {"text": "Smith"} + ], + "threshold": 0.8 +} \ No newline at end of file diff --git a/api/src/test/mock-data/response/rni-1-name-deduplication.json b/api/src/test/mock-data/response/rni-1-name-deduplication.json new file mode 100644 index 000000000..b0ed81ad9 --- /dev/null +++ b/api/src/test/mock-data/response/rni-1-name-deduplication.json @@ -0,0 +1,7 @@ +{ + "names": [ + {"text": "Joe"}, + {"text": "Smith"} + ], + "threshold": 0.8 +} \ No newline at end of file diff --git a/api/src/test/mock-data/response/rni-1-name-deduplication.status b/api/src/test/mock-data/response/rni-1-name-deduplication.status new file mode 100644 index 000000000..ae4ee13c0 --- /dev/null +++ b/api/src/test/mock-data/response/rni-1-name-deduplication.status @@ -0,0 +1 @@ +200 \ No newline at end of file diff --git a/examples/src/main/java/com/basistech/rosette/examples/README.md b/examples/src/main/java/com/basistech/rosette/examples/README.md index 59cdd5a7f..240966581 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/README.md +++ b/examples/src/main/java/com/basistech/rosette/examples/README.md @@ -14,6 +14,7 @@ Otherwise you can compile and run these examples by hand: | File Name | Description | ------------- |------------- +| Base64InputExample.java | Entities using base64 encoded string | CategoriesExample.java | Gets the category of a document at a URL | EntitiesExample.java | Extracts entities | InfoExample.java | Gets information about Rosette API @@ -23,12 +24,10 @@ Otherwise you can compile and run these examples by hand: | MorphologyHanReadingsExample.java | Gets the Chinese/Han readings | MorphologyLemmasExample.java | Gets the lemmas | MorphologyPartsOfSpeechExample.java | Gets the part-of-speech tags +| NameDeduplicationExample.java | Gets a list of cluster IDs given a list of names | NameSimilarityExample.java | Matches two names and produces a match score | NameTranslationExample.java | Translates a name | PingExample.java | Pings the Rosette API to check for availability -| RelationshipsExample.java | Demonstrates the entity extraction api. | SentencesExample.java | Gets the sentences | SentimentExample.java | Gets the sentiment of a local file -| SyntaxDependenciesExample.java | Demonstrates the syntax dependencies endpoint -| TextEmbeddingExample.java | Demonstrates text embeddings -| TokensExample.java | Gets the tokens +| TokenExample.java | Gets the tokens diff --git a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java index f839c3ba1..df5d18941 100644 --- a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java +++ b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java @@ -139,7 +139,7 @@ public void packageTest() throws ClassNotFoundException, IllegalAccessException, } String json = writer.writeValueAsString(o1); // deserialize - Object o2 = mapper.readValue(json, (Class) clazz); + Object o2 = mapper.readValue(json, (Class) clazz); // verify assertEquals(o1, o2); } diff --git a/release/src/scripts/run_all_examples.sh b/release/src/scripts/run_all_examples.sh index b15a20d24..8fb39bc71 100644 --- a/release/src/scripts/run_all_examples.sh +++ b/release/src/scripts/run_all_examples.sh @@ -10,6 +10,7 @@ key=$1 read -d '' examples < Date: Thu, 2 Mar 2017 15:17:24 -0500 Subject: [PATCH 004/735] RLPNC-4241: Disabling test for now --- .../java/com/basistech/rosette/api/RosetteAPITest.java | 2 ++ .../test/mock-data/response/rni-1-name-deduplication.json | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index 70449fc5b..e5e7c8d25 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -37,6 +37,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpHeaders; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -429,6 +430,7 @@ private void verifyException(HttpRosetteAPIException e) throws IOException { assertEquals(goldResponse.getCode(), e.getErrorResponse().getCode()); } + @Ignore @Test public void testNameDeduplication() throws IOException { if (!(testFilename.endsWith("-name-deduplication.json"))) { diff --git a/api/src/test/mock-data/response/rni-1-name-deduplication.json b/api/src/test/mock-data/response/rni-1-name-deduplication.json index b0ed81ad9..e69de29bb 100644 --- a/api/src/test/mock-data/response/rni-1-name-deduplication.json +++ b/api/src/test/mock-data/response/rni-1-name-deduplication.json @@ -1,7 +0,0 @@ -{ - "names": [ - {"text": "Joe"}, - {"text": "Smith"} - ], - "threshold": 0.8 -} \ No newline at end of file From 3c7fcd171580ee95f6e4c86cac428cf66a9e43b7 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Wed, 8 Mar 2017 16:06:35 -0500 Subject: [PATCH 005/735] RLPNC-4241: Updating test --- .../test/java/com/basistech/rosette/api/RosetteAPITest.java | 5 ----- .../test/mock-data/response/rni-1-name-deduplication.json | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index e5e7c8d25..48c9a208a 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -430,13 +430,11 @@ private void verifyException(HttpRosetteAPIException e) throws IOException { assertEquals(goldResponse.getCode(), e.getErrorResponse().getCode()); } - @Ignore @Test public void testNameDeduplication() throws IOException { if (!(testFilename.endsWith("-name-deduplication.json"))) { return; } - System.out.println("DEDUPLICATE NAME HAPPENING"); NameDeduplicationRequest request = readValueNameDeduplication(); try { NameDeduplicationResponse response = api.perform(AbstractRosetteAPI.NAME_DEDUPLICATION_SERVICE_PATH, @@ -449,9 +447,6 @@ public void testNameDeduplication() throws IOException { private void verifyNameDeduplication(NameDeduplicationResponse response) throws IOException { NameDeduplicationResponse goldResponse = mapper.readValue(responseStr, NameDeduplicationResponse.class); - for (String str : response.getResults()) { - System.out.println("Result: " + str); - } assertEquals(goldResponse.getResults(),response.getResults()); } diff --git a/api/src/test/mock-data/response/rni-1-name-deduplication.json b/api/src/test/mock-data/response/rni-1-name-deduplication.json index e69de29bb..2c8999d30 100644 --- a/api/src/test/mock-data/response/rni-1-name-deduplication.json +++ b/api/src/test/mock-data/response/rni-1-name-deduplication.json @@ -0,0 +1,5 @@ +{ + "results": [ + "1", "2" + ] +} \ No newline at end of file From 355871fb0a7b3ec0355cdfd6b3b5c9423be96de1 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Wed, 8 Mar 2017 17:11:33 -0500 Subject: [PATCH 006/735] RLPNC-4241: Minor cosmetic changes again --- api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java | 1 - .../basistech/rosette/examples/NameDeduplicationExample.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index 48c9a208a..b9f38b939 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -37,7 +37,6 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpHeaders; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java index 417ec257d..aaf89cccf 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java @@ -42,7 +42,7 @@ private void run() throws IOException { names.add(new Name("Johnathan Smith")); names.add(new Name("Fred Jones")); - double threshold = 0.8; + double threshold = 0.75; HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() .key(getApiKeyFromSystemProperty()) From 0ab53043356f63caa106d483e34cfe11c826f18e Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Wed, 8 Mar 2017 17:13:55 -0500 Subject: [PATCH 007/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 06d755680..7c6e56b8b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 834be8514..5de059baf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 2f7c37d43..a8a003000 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 627951a88..1cc31a977 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 085d5977d..d079f918b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7db1dd58f..7d34893c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.7 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index cae44b88f..868d81ee5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-release From 3492cfa53e338994fb934961cecf072928f75c4b Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Wed, 8 Mar 2017 17:41:18 -0500 Subject: [PATCH 008/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7c6e56b8b..0826ac468 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 5de059baf..14b8a9e6c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a8a003000..bc9b52d4a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1cc31a977..d4a4e3c4f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d079f918b..9acdb0a45 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7d34893c7..cdc905e25 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.7 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 868d81ee5..8075fb71c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-release From c887354fb1a13ae440deeddaac5572352ec657d4 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Mon, 10 Apr 2017 15:25:15 -0400 Subject: [PATCH 009/735] RCT-66: Add API for /transliteration endpoint --- .../apimodel/jackson/ApiModelMixinModule.java | 6 +- .../jackson/TransliterationOptionsMixin.java | 27 +++++++++ .../jackson/TransliterationResponseMixin.java | 27 +++++++++ .../apimodel/TransliterationOptions.java | 55 ++++++++++++++++++ .../apimodel/TransliterationResponse.java | 57 +++++++++++++++++++ 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationResponseMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/TransliterationOptions.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/TransliterationResponse.java diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 8ec054845..75d8b383a 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,8 @@ import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; import com.basistech.rosette.apimodel.TextEmbeddingResponse; import com.basistech.rosette.apimodel.TokensResponse; +import com.basistech.rosette.apimodel.TransliterationOptions; +import com.basistech.rosette.apimodel.TransliterationResponse; import com.basistech.rosette.apimodel.batch.BatchRequest; import com.basistech.rosette.apimodel.batch.BatchRequestItem; import com.basistech.rosette.apimodel.batch.BatchResponse; @@ -113,6 +115,8 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(Relationship.class, RelationshipsMixin.class); context.setMixInAnnotations(RelationshipsOptions.class, RelationshipsOptionsMixin.class); context.setMixInAnnotations(Options.class, OptionsMixin.class); + context.setMixInAnnotations(TransliterationOptions.class, TransliterationOptionsMixin.class); + context.setMixInAnnotations(TransliterationResponse.class, TransliterationResponseMixin.class); context.setMixInAnnotations(AccuracyMode.class, AccuracyModeMixin.class); SimpleSerializers keySerializers = new SimpleSerializers(); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java new file mode 100644 index 000000000..5466ff90f --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java @@ -0,0 +1,27 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class TransliterationOptionsMixin extends BaseMixin { + @JsonCreator + protected TransliterationOptionsMixin(@JsonProperty("reversed") final Boolean reversed) { + // + } +} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationResponseMixin.java new file mode 100644 index 000000000..9ce09fe7e --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationResponseMixin.java @@ -0,0 +1,27 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class TransliterationResponseMixin extends BaseMixin { + @JsonCreator + protected TransliterationResponseMixin(@JsonProperty("transliteration") final String transliteration) { + // + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/TransliterationOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/TransliterationOptions.java new file mode 100644 index 000000000..090314754 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/TransliterationOptions.java @@ -0,0 +1,55 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.Objects; + +public final class TransliterationOptions extends Options { + private Boolean reversed; + + /** + * Constructs a set of transliteration options. + * @param reversed whether to do reverse transliteration + */ + public TransliterationOptions(final Boolean reversed) { + this.reversed = reversed; + } + + /** + * Returns whether to do reverse transliteration. + * @return whether to do reverse transliteration + */ + public Boolean getReversed() { + return reversed; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } else if (obj == null || getClass() != obj.getClass()) { + return false; + } + final TransliterationOptions that = (TransliterationOptions) obj; + return Objects.equals(reversed, that.reversed); + } + + @Override + public int hashCode() { + return Objects.hashCode(reversed); + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/TransliterationResponse.java b/model/src/main/java/com/basistech/rosette/apimodel/TransliterationResponse.java new file mode 100644 index 000000000..8c7be4746 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/TransliterationResponse.java @@ -0,0 +1,57 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.Objects; + +/** + * Simple API response data model for RCT. + */ +public final class TransliterationResponse extends Response { + private final String transliteration; + + /** + * Constructs a transliteration response. + * @param transliteration a transliteration string + */ + public TransliterationResponse(final String transliteration) { + this.transliteration = transliteration; + } + + /** + * Returns the transliteration. + * @return the transliteration + */ + public String getTransliteration() { + return transliteration; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } else if (obj == null || getClass() != obj.getClass()) { + return false; + } + return Objects.equals(transliteration, ((TransliterationResponse) obj).transliteration); + } + + @Override + public int hashCode() { + return Objects.hashCode(transliteration); + } +} From 37aa316d29995bb602b99b103b1beb4eccbdde0b Mon Sep 17 00:00:00 2001 From: Gil Irizarry Date: Thu, 13 Apr 2017 10:08:55 -0400 Subject: [PATCH 010/735] RLPNC-4241: add test files for name dedupe with language and script, and fix some typos --- .../main/java/com/basistech/rosette/api/RosetteAPI.java | 3 ++- .../test/mock-data/request/rni-2-name-deduplication.json | 7 +++++++ .../mock-data/response/rni-2-name-deduplication.status | 1 + .../test/mock-data/response/rni-2-name-deduplications.json | 5 +++++ .../rosette/apimodel/NameDeduplicationRequest.java | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 api/src/test/mock-data/request/rni-2-name-deduplication.json create mode 100644 api/src/test/mock-data/response/rni-2-name-deduplication.status create mode 100644 api/src/test/mock-data/response/rni-2-name-deduplications.json diff --git a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java index 01ea41bea..b28ea121c 100644 --- a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java @@ -28,6 +28,7 @@ import com.basistech.rosette.apimodel.MorphologyOptions; import com.basistech.rosette.apimodel.MorphologyResponse; import com.basistech.rosette.apimodel.Name; +import com.basistech.rosette.apimodel.NameDeduplicationRequest; import com.basistech.rosette.apimodel.NameDeduplicationResponse; import com.basistech.rosette.apimodel.NameSimilarityRequest; import com.basistech.rosette.apimodel.NameSimilarityResponse; @@ -369,7 +370,7 @@ public NameTranslationResponse getNameTranslation(NameTranslationRequest request * @throws RosetteAPIException - If there is a problem with the Rosette API request. * @throws IOException - If there is a communication or JSON serialization/deserialization error. */ - public NameDeduplicationResponse getNameDeduplication(NameTranslationRequest request) + public NameDeduplicationResponse getNameDeduplication(NameDeduplicationRequest request) throws RosetteAPIException, IOException { return sendPostRequest(request, urlBase + NAME_DEDUPLICATION_SERVICE_PATH, NameDeduplicationResponse.class); } diff --git a/api/src/test/mock-data/request/rni-2-name-deduplication.json b/api/src/test/mock-data/request/rni-2-name-deduplication.json new file mode 100644 index 000000000..085af17d6 --- /dev/null +++ b/api/src/test/mock-data/request/rni-2-name-deduplication.json @@ -0,0 +1,7 @@ +{ + "names": [ + {"text": "Joe", "entityType":"PERSON", "script":"Latn", "language":"eng"}, + {"text": "Smith", "entityType":"PERSON", "script":"Latn", "language":"eng"} + ], + "threshold": 0.8 +} diff --git a/api/src/test/mock-data/response/rni-2-name-deduplication.status b/api/src/test/mock-data/response/rni-2-name-deduplication.status new file mode 100644 index 000000000..ae4ee13c0 --- /dev/null +++ b/api/src/test/mock-data/response/rni-2-name-deduplication.status @@ -0,0 +1 @@ +200 \ No newline at end of file diff --git a/api/src/test/mock-data/response/rni-2-name-deduplications.json b/api/src/test/mock-data/response/rni-2-name-deduplications.json new file mode 100644 index 000000000..2c8999d30 --- /dev/null +++ b/api/src/test/mock-data/response/rni-2-name-deduplications.json @@ -0,0 +1,5 @@ +{ + "results": [ + "1", "2" + ] +} \ No newline at end of file diff --git a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java index 60df5cda2..47f161be4 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java @@ -71,7 +71,7 @@ public void setNames(List names) { * Sets the threshold * @param threshold the threshold. */ - public void setName2(double threshold) { + public void setThreshold(double threshold) { this.threshold = threshold; } From 1a9c1653a616ead282516beb420198afec9f78b2 Mon Sep 17 00:00:00 2001 From: Karin-Basis Date: Tue, 18 Apr 2017 13:48:31 -0400 Subject: [PATCH 011/735] =?UTF-8?q?WS-1078:=20add=20AdmRequestMixin=20to?= =?UTF-8?q?=20ApiModelMixinModule=20to=20allow=20for=20dese=E2=80=A6=20(#8?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WS-1078: add AdmRequestMixin to ApiModelMixinModule to allow for deserializing AdmRequest * switching from openjdk7 to openjdk8 * change dist to trusty --- .travis.yml | 4 +- .../apimodel/jackson/AdmRequestMixin.java | 37 +++++++++++++++++++ .../apimodel/jackson/ApiModelMixinModule.java | 2 + 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java diff --git a/.travis.yml b/.travis.yml index cc6776b11..97a9582d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ script: mvn verify jdk: - oraclejdk8 - oraclejdk7 -- openjdk7 +- openjdk8 # suggested by travis support. sudo: required -dist: precise +dist: trusty group: edge diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java new file mode 100644 index 000000000..a018db638 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java @@ -0,0 +1,37 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.basistech.rosette.apimodel.Options; +import com.basistech.rosette.dm.AnnotatedText; +import com.basistech.util.LanguageCode; +import com.fasterxml.jackson.annotation.*; + +//CHECKSTYLE:OFF +@JsonTypeName("AdmRequest") +public abstract class AdmRequestMixin extends BaseMixin { + + @JsonCreator + protected AdmRequestMixin( + @JsonProperty("text") AnnotatedText text, + @JsonProperty("options") Options options, + @JsonProperty("genre") String genre, + @JsonProperty("language") LanguageCode language + ) { + // + } +} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 8ec054845..31b6d8778 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -17,6 +17,7 @@ package com.basistech.rosette.apimodel.jackson; import com.basistech.rosette.apimodel.AccuracyMode; +import com.basistech.rosette.apimodel.AdmRequest; import com.basistech.rosette.apimodel.CategoriesOptions; import com.basistech.rosette.apimodel.CategoriesResponse; import com.basistech.rosette.apimodel.ConstantsResponse; @@ -105,6 +106,7 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(NameTranslationResponse.class, NameTranslationResponseMixin.class); context.setMixInAnnotations(PingResponse.class, PingResponseMixin.class); context.setMixInAnnotations(DocumentRequest.class, DocumentRequestMixin.class); + context.setMixInAnnotations(AdmRequest.class, AdmRequestMixin.class); context.setMixInAnnotations(SentencesResponse.class, SentencesResponseMixin.class); context.setMixInAnnotations(SentimentOptions.class, SentimentOptionsMixin.class); context.setMixInAnnotations(SentimentResponse.class, SentimentResponseMixin.class); From 3bc1a3f9bc5c2340ee7499017d5f7788c6c58e94 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 13:53:22 -0400 Subject: [PATCH 012/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 06d755680..7c6e56b8b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 834be8514..5de059baf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 2f7c37d43..a8a003000 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 627951a88..1cc31a977 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 085d5977d..d079f918b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7db1dd58f..7d34893c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.7 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index cae44b88f..868d81ee5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-release From 9f3ca438d1b3d02a9c41ecbc9dc4e342d04df30e Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:08:56 -0400 Subject: [PATCH 013/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7c6e56b8b..06d755680 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 5de059baf..834be8514 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a8a003000..2f7c37d43 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1cc31a977..627951a88 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d079f918b..085d5977d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7d34893c7..7db1dd58f 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.7 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 868d81ee5..cae44b88f 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-release From 9a44b2aef8a39ba7317eb30e72b529b0d6af4820 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:14:11 -0400 Subject: [PATCH 014/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 06d755680..7c6e56b8b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 834be8514..5de059baf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 2f7c37d43..a8a003000 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 627951a88..1cc31a977 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 085d5977d..d079f918b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7db1dd58f..7d34893c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.7 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index cae44b88f..868d81ee5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-release From 7e605f351e1c863c9c195fff0854b35a78166c69 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:16:05 -0400 Subject: [PATCH 015/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7c6e56b8b..06d755680 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 5de059baf..834be8514 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a8a003000..2f7c37d43 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1cc31a977..627951a88 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d079f918b..085d5977d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7d34893c7..7db1dd58f 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.7 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 868d81ee5..cae44b88f 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-release From 5cd4d37fb9c50a48ecd95f76f4573ba3bf5e7b3d Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:19:45 -0400 Subject: [PATCH 016/735] remove blank line --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5dcf4986f..b3ade796b 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,3 @@ Additional environment settings: ## Additional Information ## For more, visit [Rosette API site](https://developer.rosette.com) - From 7dc765b5a0c6fdcb9e880243a86ccae4fac2679c Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:24:57 -0400 Subject: [PATCH 017/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 06d755680..7c6e56b8b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 834be8514..5de059baf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 2f7c37d43..a8a003000 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 627951a88..1cc31a977 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 085d5977d..d079f918b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7db1dd58f..7d34893c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.7 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index cae44b88f..868d81ee5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-release From 8fd9cd1ef232d1d32c0d3af1b7beea217223ff4a Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:44:30 -0400 Subject: [PATCH 018/735] Revert "[maven-release-plugin] prepare release rosette-api-java-binding-1.5.7" This reverts commit 7dc765b5a0c6fdcb9e880243a86ccae4fac2679c. --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7c6e56b8b..06d755680 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 5de059baf..834be8514 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a8a003000..2f7c37d43 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1cc31a977..627951a88 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d079f918b..085d5977d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7d34893c7..7db1dd58f 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.7 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 868d81ee5..cae44b88f 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.7-SNAPSHOT com.basistech.rosette rosette-api-release From a73dc046cd92c1900dba2555fcda246a5637b897 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:46:56 -0400 Subject: [PATCH 019/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.7 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 06d755680..7c6e56b8b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 834be8514..5de059baf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 2f7c37d43..a8a003000 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 627951a88..1cc31a977 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 085d5977d..d079f918b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7db1dd58f..7d34893c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.7 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index cae44b88f..868d81ee5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7-SNAPSHOT + 1.5.7 com.basistech.rosette rosette-api-release From 2a92c5054e292c38cdbc41bdf455e9c43e17f132 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Tue, 18 Apr 2017 14:47:00 -0400 Subject: [PATCH 020/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7c6e56b8b..0826ac468 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 5de059baf..14b8a9e6c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a8a003000..bc9b52d4a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1cc31a977..d4a4e3c4f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d079f918b..9acdb0a45 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 7d34893c7..cdc905e25 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.7 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 868d81ee5..8075fb71c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.7 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-release From 4fcff71af61f0fad6ae9a3df7679f441d2e5bc57 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 09:39:30 -0400 Subject: [PATCH 021/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0826ac468..1bdb28ee4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 14b8a9e6c..3c698ca1e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index bc9b52d4a..64c02809a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d4a4e3c4f..963f82a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 9acdb0a45..bac948860 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cdc905e25..cb713c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 8075fb71c..85035a01c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-release From c3744cd756d4faa9af019742a302800972e44c81 Mon Sep 17 00:00:00 2001 From: Gil Irizarry Date: Thu, 20 Apr 2017 09:55:51 -0400 Subject: [PATCH 022/735] resolve merge conflicts --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0826ac468..1bdb28ee4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 14b8a9e6c..3c698ca1e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index bc9b52d4a..64c02809a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d4a4e3c4f..963f82a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 9acdb0a45..bac948860 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cdc905e25..cb713c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 8075fb71c..85035a01c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-release From 05829f80efa24b377b5a3cd4569541c210e8bc41 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 10:05:49 -0400 Subject: [PATCH 023/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.8 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1bdb28ee4..0826ac468 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3c698ca1e..14b8a9e6c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 64c02809a..bc9b52d4a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 963f82a1e..d4a4e3c4f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index bac948860..9acdb0a45 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cb713c0b3..cdc905e25 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 85035a01c..8075fb71c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-release From a23def2c40e3d74b90ab1f543578afc9be7b2898 Mon Sep 17 00:00:00 2001 From: Gil Irizarry Date: Thu, 20 Apr 2017 10:11:59 -0400 Subject: [PATCH 024/735] resolve merge conflicts --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1bdb28ee4..0826ac468 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3c698ca1e..14b8a9e6c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 64c02809a..bc9b52d4a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 963f82a1e..d4a4e3c4f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index bac948860..9acdb0a45 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cb713c0b3..cdc905e25 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 85035a01c..8075fb71c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-release From fbc1b046b16bde01204949d55784ea79c488a99e Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 10:26:52 -0400 Subject: [PATCH 025/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.8 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0826ac468..a67fa00a3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 14b8a9e6c..820a80cd6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index bc9b52d4a..4943ec281 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d4a4e3c4f..dab5fcb01 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 9acdb0a45..b6098632d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cdc905e25..01e75f307 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.8 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 8075fb71c..14bb4c49d 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 com.basistech.rosette rosette-api-release From 4742ac265a352fc0100f5eac88b12f2ad09505a5 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 10:29:20 -0400 Subject: [PATCH 026/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.8 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index a67fa00a3..0826ac468 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 820a80cd6..14b8a9e6c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 4943ec281..bc9b52d4a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index dab5fcb01..d4a4e3c4f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index b6098632d..9acdb0a45 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 01e75f307..cdc905e25 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.8 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 14bb4c49d..8075fb71c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.8-SNAPSHOT com.basistech.rosette rosette-api-release From 52f3b9532a3a7e170b052d5ceb199f2b77763e8d Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 10:35:40 -0400 Subject: [PATCH 027/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.8 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0826ac468..a67fa00a3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 14b8a9e6c..820a80cd6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index bc9b52d4a..4943ec281 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d4a4e3c4f..dab5fcb01 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 9acdb0a45..b6098632d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cdc905e25..01e75f307 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.8 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 8075fb71c..14bb4c49d 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8-SNAPSHOT + 1.5.8 com.basistech.rosette rosette-api-release From e27668ea3f5339b1c84b50831b329d0c634ff571 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Thu, 20 Apr 2017 10:35:44 -0400 Subject: [PATCH 028/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index a67fa00a3..1bdb28ee4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 820a80cd6..3c698ca1e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 4943ec281..64c02809a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index dab5fcb01..963f82a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index b6098632d..bac948860 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 01e75f307..cb713c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.8 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 14bb4c49d..85035a01c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.8 + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-release From 250029cc7aa35d0cd4594d68bfa39b97bc90d69c Mon Sep 17 00:00:00 2001 From: David Corbett Date: Tue, 25 Apr 2017 10:29:04 -0400 Subject: [PATCH 029/735] RCT-69: Add an example of /transliteration --- .../api/common/AbstractRosetteAPI.java | 3 +- .../examples/TransliterationExample.java | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java diff --git a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java index be1cd0fee..e0e2b8b1e 100644 --- a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java +++ b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java @@ -1,5 +1,5 @@ /* -* Copyright 2016 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ public abstract class AbstractRosetteAPI implements AutoCloseable { public static final String SENTENCES_SERVICE_PATH = "/sentences"; public static final String TEXT_EMBEDDING_SERVICE_PATH = "/text-embedding"; public static final String SYNTAX_DEPENDENCIES_SERVICE_PATH = "/syntax/dependencies"; + public static final String TRANSLITERATION_SERVICE_PATH = "/transliteration"; public static final String INFO_SERVICE_PATH = "/info"; public static final String PING_SERVICE_PATH = "/ping"; diff --git a/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java b/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java new file mode 100644 index 000000000..235fd4905 --- /dev/null +++ b/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java @@ -0,0 +1,55 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.examples; + +import com.basistech.rosette.api.HttpRosetteAPI; +import com.basistech.rosette.apimodel.DocumentRequest; +import com.basistech.rosette.apimodel.TransliterationOptions; +import com.basistech.rosette.apimodel.TransliterationResponse; +import com.basistech.util.LanguageCode; + +import java.io.IOException; + +/** + * Example which demonstrates the transliteration API. + */ +public class TransliterationExample extends ExampleBase { + public static void main(String[] args) { + try { + new TransliterationExample().run(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void run() throws IOException { + String transliterationData = "haza ya7taj fakat ila an takoun ba3dh el-nousous allati na7n ymkn an tata7awal ila al-3arabizi."; + + HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() + .key(getApiKeyFromSystemProperty()) + .url(getAltUrlFromSystemProperty()) + .build(); + // The API object creates an HTTP client, but to provide your own: + // HttpRosetteAPI.Builder#httpClient(CloseableHttpClient) + DocumentRequest request = new DocumentRequest.Builder() + .content(transliterationData) + .language(LanguageCode.ARABIC) + .build(); + TransliterationResponse response = rosetteApi.perform(HttpRosetteAPI.TRANSLITERATION_SERVICE_PATH, request, TransliterationResponse.class); + System.out.println(responseToJson(response)); + } +} From 69780735b917de75c697f97a593a1ce4ed8f2e42 Mon Sep 17 00:00:00 2001 From: Karin-Basis Date: Thu, 27 Apr 2017 16:01:40 -0400 Subject: [PATCH 030/735] =?UTF-8?q?RAAP-377:=20change=20configuration=20of?= =?UTF-8?q?=20mapper=20to=20avoid=20access=20problems=20fro=E2=80=A6=20(#9?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * RAAP-377: change configuration of mapper to avoid access problems from RapidMiner * RAAP-377: change configuration of mapper in HttpRosetteAPI to avoid access problems from RapidMiner --- .../main/java/com/basistech/rosette/api/HttpRosetteAPI.java | 3 ++- api/src/main/java/com/basistech/rosette/api/RosetteAPI.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java index 8bee35dce..5b644f8ec 100644 --- a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java @@ -29,6 +29,7 @@ import com.basistech.rosette.dm.AnnotatedText; import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.io.ByteStreams; @@ -152,7 +153,7 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { } mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - + mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); if (httpClient == null) { initClient(key, additionalHeaders); } else { diff --git a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java index b28ea121c..19ac68255 100644 --- a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java @@ -50,6 +50,7 @@ import com.basistech.rosette.apimodel.jackson.DocumentRequestMixin; import com.basistech.util.LanguageCode; import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.io.ByteStreams; @@ -180,7 +181,7 @@ public RosetteAPI(String key, String alternateUrl) throws IOException, RosetteAP } this.failureRetries = 1; mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - + mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); initClient(key, null); } @@ -207,6 +208,7 @@ private RosetteAPI(String key, String urlToCall, int failureRetries, urlBase = urlToCall.trim().replaceAll("/+$", ""); this.failureRetries = failureRetries; mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); + mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); this.connectionConcurrency = connectionConcurrency; if (httpClient == null) { From 8f128e00eac041f146846e42878f624fcda045cb Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:14:23 -0400 Subject: [PATCH 031/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.9 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1bdb28ee4..635c12bfa 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3c698ca1e..094e775fb 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 64c02809a..45a7764f2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 963f82a1e..4b98ac781 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index bac948860..06d843e84 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cb713c0b3..b549ef7c0 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.9 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 85035a01c..40a9e6a82 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-release From 7060a440aefcb073d0180ef43955bf78fdec81f0 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:14:31 -0400 Subject: [PATCH 032/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 635c12bfa..6eff6c03f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 094e775fb..816bb14b6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 45a7764f2..af00dd722 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 4b98ac781..5d2808a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 06d843e84..c611c82a2 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index b549ef7c0..6211b7366 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.9 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 40a9e6a82..0d240186e 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-release From 25fe65f0af4f9d7ac93e99967c71f044a7cd9d67 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:15:09 -0400 Subject: [PATCH 033/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.9 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6eff6c03f..1bdb28ee4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 816bb14b6..3c698ca1e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index af00dd722..64c02809a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 5d2808a1e..963f82a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c611c82a2..bac948860 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 6211b7366..cb713c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 0d240186e..85035a01c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-release From 3b457113daf555cc01ab9c21cd46a9358fb73347 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:19:31 -0400 Subject: [PATCH 034/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.9 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1bdb28ee4..635c12bfa 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3c698ca1e..094e775fb 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 64c02809a..45a7764f2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 963f82a1e..4b98ac781 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index bac948860..06d843e84 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cb713c0b3..b549ef7c0 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.9 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 85035a01c..40a9e6a82 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-release From b21759916309f2763d65b010cd75872610adcd4c Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:19:37 -0400 Subject: [PATCH 035/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 635c12bfa..6eff6c03f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 094e775fb..816bb14b6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 45a7764f2..af00dd722 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 4b98ac781..5d2808a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 06d843e84..c611c82a2 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index b549ef7c0..6211b7366 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.9 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 40a9e6a82..0d240186e 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-release From a4b241f136edaaf0921dcee4fcef10aa2fac2a3d Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:20:25 -0400 Subject: [PATCH 036/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.5.9 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6eff6c03f..1bdb28ee4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 816bb14b6..3c698ca1e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index af00dd722..64c02809a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 5d2808a1e..963f82a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c611c82a2..bac948860 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 6211b7366..cb713c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 0d240186e..85035a01c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.5.9-SNAPSHOT com.basistech.rosette rosette-api-release From 1d2d5cea2ddae172b484644f950c87a31173ccb7 Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:30:04 -0400 Subject: [PATCH 037/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.5.9 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1bdb28ee4..635c12bfa 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3c698ca1e..094e775fb 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 64c02809a..45a7764f2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 963f82a1e..4b98ac781 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index bac948860..06d843e84 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index cb713c0b3..b549ef7c0 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.5.9 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 85035a01c..40a9e6a82 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9-SNAPSHOT + 1.5.9 com.basistech.rosette rosette-api-release From 9668692b09ab4a4b59180d9555e961b98ff7569b Mon Sep 17 00:00:00 2001 From: Karin Lin Date: Thu, 27 Apr 2017 16:30:11 -0400 Subject: [PATCH 038/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 635c12bfa..6eff6c03f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 094e775fb..816bb14b6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 45a7764f2..af00dd722 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 4b98ac781..5d2808a1e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 06d843e84..c611c82a2 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index b549ef7c0..6211b7366 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.5.9 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 40a9e6a82..0d240186e 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.9 + 1.5.10-SNAPSHOT com.basistech.rosette rosette-api-release From 0a7c1abf00cb8286cfccb2ed54002f489a51aaa6 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Mon, 15 May 2017 10:30:00 -0400 Subject: [PATCH 039/735] Updated name deduplication example - Now uses NameDedupeData token - Parses names in string to generate Name objects for submission --- .../rosette/examples/NameDeduplicationExample.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java index aaf89cccf..c1b048f60 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; /** * Example which demonstrates name deduplication. @@ -37,11 +38,12 @@ public static void main(String[] args) { } private void run() throws IOException { - ArrayList names = new ArrayList<>(); - names.add(new Name("John Smith")); - names.add(new Name("Johnathan Smith")); - names.add(new Name("Fred Jones")); + String nameDedupeData = "John Smith,Johnathon Smith,Fred Jones"; + ArrayList names = new ArrayList<>(); + for (String name: new ArrayList(Arrays.asList(nameDedupeData.split(",")))) { + names.add(new Name(name)); + } double threshold = 0.75; HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() From 56a941fb5a6d37af9bf2e8abce7321830654d36d Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 24 May 2017 10:37:11 -0400 Subject: [PATCH 040/735] Updated gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 465b5073c..4198ad157 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ mockserver*log **/.DS_Store */tests/mock-data classpath +.classpath .checkstyle .ruleset .pmd @@ -19,3 +20,4 @@ target *.iml *~ build.log +.vscode/** From 24116f81449ff38d65349065de834a49a9b78574 Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Thu, 25 May 2017 15:12:10 -0400 Subject: [PATCH 041/735] WS-1138 changing dedup threshold to Double so it can be null --- .../NameDeduplicationRequestMixin.java | 2 +- .../apimodel/NameDeduplicationRequest.java | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java index 094333133..a01943afb 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/NameDeduplicationRequestMixin.java @@ -28,7 +28,7 @@ public class NameDeduplicationRequestMixin extends BaseMixin { @JsonCreator protected NameDeduplicationRequestMixin( @JsonProperty("names") List names, - @JsonProperty("threshold") double threshold + @JsonProperty("threshold") Double threshold ) { // } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java index 47f161be4..15676cf90 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java @@ -17,6 +17,7 @@ package com.basistech.rosette.apimodel; import javax.validation.constraints.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -29,16 +30,15 @@ public final class NameDeduplicationRequest extends Request { @NotNull private List names; - @NotNull - private double threshold; + private Double threshold; /** * Constructor for {@code NameMatchingRequest} * @param names List of names to be deduplicated - * @param threshold score threshold used to tune the strictness of the clustering algorithm + * @param threshold score threshold used to tune the strictness of the clustering algorithm. Can be null for default threshold. */ public NameDeduplicationRequest(List names, - double threshold) { + Double threshold) { this.names = names; this.threshold = threshold; } @@ -55,7 +55,7 @@ public List getNames() { * Gets the threshold * @return the threshold */ - public double getThreshold() { + public Double getThreshold() { return threshold; } @@ -71,7 +71,7 @@ public void setNames(List names) { * Sets the threshold * @param threshold the threshold. */ - public void setThreshold(double threshold) { + public void setThreshold(Double threshold) { this.threshold = threshold; } @@ -94,7 +94,10 @@ public boolean equals(Object o) { return false; } NameDeduplicationRequest that = (NameDeduplicationRequest) o; - return Double.compare(that.threshold, threshold) == 0 - && Objects.equals(names, that.names); + + boolean sameThresh = (that.threshold == null || threshold == null) ? that.threshold == threshold + : Double.compare(that.threshold, threshold) == 0; + + return sameThresh && Objects.equals(names, that.names); } } From c3671590f84f6ff3616590a8b1dad042e5a99a2d Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Thu, 25 May 2017 15:34:48 -0400 Subject: [PATCH 042/735] WS-1138 fixing checkstyle --- .../com/basistech/rosette/apimodel/NameDeduplicationRequest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java index 15676cf90..8fa056fb1 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/NameDeduplicationRequest.java @@ -17,7 +17,6 @@ package com.basistech.rosette.apimodel; import javax.validation.constraints.NotNull; -import java.util.ArrayList; import java.util.List; import java.util.Objects; From 276e2023eeda3a5bb7447cf4f7ddb80b87b6fb0e Mon Sep 17 00:00:00 2001 From: Li Xu Date: Mon, 5 Jun 2017 14:26:13 -0400 Subject: [PATCH 043/735] WS-1155: there's a confidence --- .../apimodel/jackson/EntityMentionMixin.java | 3 ++- .../rosette/apimodel/EntityMention.java | 22 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java index bacec7f82..a08f1b749 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java @@ -27,7 +27,8 @@ public EntityMentionMixin( @JsonProperty("mention") String mention, @JsonProperty("normalized") String normalized, @JsonProperty("count") Integer count, - @JsonProperty("entityId") String entityId + @JsonProperty("entityId") String entityId, + @JsonProperty("confidence") Double confidence ) { // } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java index cb57ee47a..37c2fbde7 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java @@ -30,6 +30,7 @@ public final class EntityMention { private final String normalized; private final Integer count; private final String entityId; + private final Double confidence; /** * constructor for {@code EntityMention} @@ -47,7 +48,8 @@ public EntityMention( String mention, String normalized, Integer count, - String entityId + String entityId, + Double confidence ) { this.indocChainId = indocChainId; this.type = type; @@ -55,6 +57,7 @@ public EntityMention( this.normalized = normalized; this.count = count; this.entityId = entityId; + this.confidence = confidence; } /** @@ -70,7 +73,8 @@ public EntityMention( String mention, String normalized, String entityId, - Integer count + Integer count, + Double confidence ) { this.indocChainId = null; this.type = type; @@ -78,6 +82,7 @@ public EntityMention( this.normalized = normalized; this.entityId = entityId; this.count = count; + this.confidence = confidence; } /** @@ -131,6 +136,14 @@ public String getEntityId() { return entityId; } + /** + * get the confidence score for the entity. + * @return the confidence score (0.0-1.0) + */ + public Double getConfidence() { + return confidence; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -145,11 +158,12 @@ public boolean equals(Object o) { && Objects.equals(mention, that.mention) && Objects.equals(normalized, that.normalized) && Objects.equals(count, that.count) - && Objects.equals(entityId, that.entityId); + && Objects.equals(entityId, that.entityId) + && Objects.equals(confidence, that.confidence); } @Override public int hashCode() { - return Objects.hash(indocChainId, type, mention, normalized, count, entityId); + return Objects.hash(indocChainId, type, mention, normalized, count, entityId, confidence); } } From 0a552b70f339f7d4c91c4ba35551ae2cbe33239c Mon Sep 17 00:00:00 2001 From: Li Xu Date: Mon, 5 Jun 2017 15:30:06 -0400 Subject: [PATCH 044/735] WS-1155: add EntitySentiment --- .../apimodel/jackson/EntitySentimentMixin.java | 1 + .../rosette/apimodel/EntitySentiment.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java index 1116fd507..36877b0f9 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java @@ -31,6 +31,7 @@ public EntitySentimentMixin( @JsonProperty("normalized") String normalized, @JsonProperty("count") Integer count, @JsonProperty("entityId") String entityId, + @JsonProperty("confidence") Double confidence, @JsonProperty("sentiment") Label sentiment) { // } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java index 18fbd58e5..f7cebcaa0 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java @@ -28,6 +28,7 @@ public final class EntitySentiment { private final String normalized; private final Integer count; private final String entityId; + private final Double confidence; private final Label sentiment; /** @@ -37,6 +38,7 @@ public final class EntitySentiment { * @param normalized normalized mention text * @param count mention count * @param entityId if the entity was linked, the ID from the knowledge base. + * @param confidence entity confidence. * @param sentiment the sentiment information. */ public EntitySentiment(String type, @@ -44,12 +46,14 @@ public EntitySentiment(String type, String normalized, Integer count, String entityId, + Double confidence, Label sentiment) { this.type = type; this.mention = mention; this.normalized = normalized; this.count = count; this.entityId = entityId; + this.confidence = confidence; this.sentiment = sentiment; } @@ -95,6 +99,14 @@ public String getEntityId() { return entityId; } + /** + * get the entity confidence + * @return the entity confidence + */ + public Double getConfidence() { + return confidence; + } + /** * @return the sentiment information. */ @@ -116,11 +128,12 @@ public boolean equals(Object o) { && Objects.equals(normalized, that.normalized) && Objects.equals(count, that.count) && Objects.equals(entityId, that.entityId) + && Objects.equals(confidence, that.confidence) && Objects.equals(sentiment, that.sentiment); } @Override public int hashCode() { - return Objects.hash(type, mention, normalized, count, entityId, sentiment); + return Objects.hash(type, mention, normalized, count, entityId, confidence, sentiment); } } From 29c1260cbaad069dbf896647d1bf287fd53c34a7 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 6 Jun 2017 12:49:53 -0400 Subject: [PATCH 045/735] No-Jira: version bump for 1.7.0 dev --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6eff6c03f..606cbce6e 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 816bb14b6..365823cb7 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index af00dd722..32580bca1 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 5d2808a1e..00f33f83c 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c611c82a2..408ebdc2a 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 6211b7366..1585de8a5 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 0d240186e..ff0118d13 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.5.10-SNAPSHOT + 1.6.100-SNAPSHOT com.basistech.rosette rosette-api-release From e605791f31d1d4034d988c0b09dcc62a2c2732ad Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 6 Jun 2017 12:52:38 -0400 Subject: [PATCH 046/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.6.100 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 606cbce6e..cb4283c26 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 365823cb7..7f2ebefc8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 32580bca1..e89d1f864 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 00f33f83c..74194de27 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 408ebdc2a..586e30476 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 1585de8a5..15f20c323 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.6.100 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index ff0118d13..703112595 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100-SNAPSHOT + 1.6.100 com.basistech.rosette rosette-api-release From 6ce6532691ef17cb7792d73eca27e1951bba0ac2 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 6 Jun 2017 12:52:42 -0400 Subject: [PATCH 047/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index cb4283c26..6a17a0644 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 7f2ebefc8..1ff5c2daf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index e89d1f864..a10ea4976 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 74194de27..cea6db747 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 586e30476..99a060970 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 15f20c323..0dde3323b 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.6.100 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 703112595..35ab2c830 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.100 + 1.6.101-SNAPSHOT com.basistech.rosette rosette-api-release From a5101d524516537ebb5770efe78d15a4024490ef Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 09:03:44 -0400 Subject: [PATCH 048/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.6.101 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6a17a0644..d2c54b8f7 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 1ff5c2daf..e5a13c10c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index a10ea4976..22315ce44 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index cea6db747..2027f5402 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 99a060970..f1cb61491 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 0dde3323b..009cba697 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.6.101 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 35ab2c830..d4c6d6072 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101-SNAPSHOT + 1.6.101 com.basistech.rosette rosette-api-release From 10a23bca2636607c04868f13cd2f61c9256214d4 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 09:03:51 -0400 Subject: [PATCH 049/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index d2c54b8f7..96e089a01 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index e5a13c10c..b1471c750 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 22315ce44..b8c0cc9d1 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 2027f5402..2a7dafee1 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index f1cb61491..d2846cc9f 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 009cba697..957d84c80 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.6.101 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index d4c6d6072..c4756788a 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.101 + 1.6.102-SNAPSHOT com.basistech.rosette rosette-api-release From 6c157520bc0fe95a1b4851c58dbb4509a9e7b238 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 09:25:02 -0400 Subject: [PATCH 050/735] Update to 1.7.0-SNAPSHOT --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 96e089a01..5b55d385e 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index b1471c750..3398cbf87 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index b8c0cc9d1..17da6ad6c 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 2a7dafee1..32c3e1381 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index d2846cc9f..58609efa1 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 957d84c80..757ba71c7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index c4756788a..456e3a2b0 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.6.102-SNAPSHOT + 1.7.0-SNAPSHOT com.basistech.rosette rosette-api-release From e2d15a5c5dcc94aebc802a83a44ae71270846caa Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 09:32:39 -0400 Subject: [PATCH 051/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.0 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 5b55d385e..1282d89b2 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 3398cbf87..e45c4610a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 17da6ad6c..281f48a66 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 32c3e1381..efecc2eb4 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 58609efa1..f633616c9 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 757ba71c7..ec6644db1 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.0 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 456e3a2b0..e34e9d24a 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0-SNAPSHOT + 1.7.0 com.basistech.rosette rosette-api-release From 5b19d6b0c787d23d4e945693fbc47ca10ebb48e6 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 09:32:47 -0400 Subject: [PATCH 052/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1282d89b2..94d786843 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index e45c4610a..01765bdd9 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 281f48a66..3f73c4910 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index efecc2eb4..cb27fbf3e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index f633616c9..7c0cba410 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index ec6644db1..c4dd38a31 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.0 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index e34e9d24a..17021313b 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.0 + 1.7.1-SNAPSHOT com.basistech.rosette rosette-api-release From cc28328a785d2f7ce81618d08eabeb656c11bee2 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 14 Jun 2017 10:55:20 -0400 Subject: [PATCH 053/735] Attempt to fix Travis - for oraclejdk7 --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97a9582d8..cf70ea91f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,7 @@ jdk: # suggested by travis support. sudo: required -dist: trusty -group: edge +dist: trusty +group: + +sudo: required From 69b521948035a3d8cb8a25aac8d80fdb804b0577 Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Thu, 15 Jun 2017 14:55:31 -0400 Subject: [PATCH 054/735] WS-1160 Removing restriction on Jackson's use of reflection And modifying unit test to correctly use the HttpRosetteAPI.Builder --- .../main/java/com/basistech/rosette/api/HttpRosetteAPI.java | 2 -- api/src/test/java/com/basistech/rosette/api/BasicTest.java | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java index 5b644f8ec..51a7f1121 100644 --- a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java @@ -29,7 +29,6 @@ import com.basistech.rosette.dm.AnnotatedText; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.io.ByteStreams; @@ -153,7 +152,6 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { } mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); if (httpClient == null) { initClient(key, additionalHeaders); } else { diff --git a/api/src/test/java/com/basistech/rosette/api/BasicTest.java b/api/src/test/java/com/basistech/rosette/api/BasicTest.java index 74f441548..d9ae71910 100644 --- a/api/src/test/java/com/basistech/rosette/api/BasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/BasicTest.java @@ -161,7 +161,10 @@ public void testAdm() throws Exception { .withStatusCode(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(respIns, "UTF-8"))); - api = new HttpRosetteAPI("foo-key", String.format("http://localhost:%d/rest/v1", serverPort)); + api = new HttpRosetteAPI.Builder() + .key("foo-key") + .url(String.format("http://localhost:%d/rest/v1", serverPort)) + .build(); AnnotatedText testData = ApiModelMixinModule.setupObjectMapper( new ObjectMapper()).readValue(reqIns, AnnotatedText.class); AnnotatedText resp = api.perform(HttpRosetteAPI.ENTITIES_SERVICE_PATH, new AdmRequest<>(testData, null, null, null)); From 4ca1b584a49296f70c6a20f6e462b8a24f8b7781 Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Thu, 15 Jun 2017 16:01:49 -0400 Subject: [PATCH 055/735] WS-1160 Removing restriction on Jackson's use of reflection (#95) And modifying unit test to correctly use the HttpRosetteAPI.Builder --- .../main/java/com/basistech/rosette/api/HttpRosetteAPI.java | 2 -- api/src/test/java/com/basistech/rosette/api/BasicTest.java | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java index 5b644f8ec..51a7f1121 100644 --- a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java @@ -29,7 +29,6 @@ import com.basistech.rosette.dm.AnnotatedText; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.io.ByteStreams; @@ -153,7 +152,6 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { } mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); if (httpClient == null) { initClient(key, additionalHeaders); } else { diff --git a/api/src/test/java/com/basistech/rosette/api/BasicTest.java b/api/src/test/java/com/basistech/rosette/api/BasicTest.java index 74f441548..d9ae71910 100644 --- a/api/src/test/java/com/basistech/rosette/api/BasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/BasicTest.java @@ -161,7 +161,10 @@ public void testAdm() throws Exception { .withStatusCode(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(respIns, "UTF-8"))); - api = new HttpRosetteAPI("foo-key", String.format("http://localhost:%d/rest/v1", serverPort)); + api = new HttpRosetteAPI.Builder() + .key("foo-key") + .url(String.format("http://localhost:%d/rest/v1", serverPort)) + .build(); AnnotatedText testData = ApiModelMixinModule.setupObjectMapper( new ObjectMapper()).readValue(reqIns, AnnotatedText.class); AnnotatedText resp = api.perform(HttpRosetteAPI.ENTITIES_SERVICE_PATH, new AdmRequest<>(testData, null, null, null)); From c18f02281c4e648c3d5b47293a234097a8f73f32 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 15 Jun 2017 16:29:24 -0400 Subject: [PATCH 056/735] RCB-512: default to accept unknown json fields --- .../basistech/rosette/api/HttpRosetteAPI.java | 58 ++++++++----------- .../basistech/rosette/api/AbstractTest.java | 2 + .../com/basistech/rosette/api/BasicTest.java | 5 +- .../basistech/rosette/api/RosetteAPITest.java | 38 +++++++++++- .../request/unknown-field-entities.json | 5 ++ .../response/unknown-field-entities.json | 40 +++++++++++++ .../response/unknown-field-entities.status | 1 + 7 files changed, 113 insertions(+), 36 deletions(-) create mode 100644 api/src/test/mock-data/request/unknown-field-entities.json create mode 100644 api/src/test/mock-data/response/unknown-field-entities.json create mode 100644 api/src/test/mock-data/response/unknown-field-entities.status diff --git a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java index 51a7f1121..55ce64b35 100644 --- a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java @@ -29,6 +29,7 @@ import com.basistech.rosette.dm.AnnotatedText; import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.io.ByteStreams; @@ -91,38 +92,8 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { private int connectionConcurrency = 2; private boolean closeClientOnClose = true; - /** - * Constructs a Rosette API instance using an API key. - * - * @param key Rosette API key. This may be null for use with an on-premise deployment - * of the Rosette API. - * @throws HttpRosetteAPIException If the service is not compatible with the version of the binding. - */ - HttpRosetteAPI(String key) throws HttpRosetteAPIException { - this(key, DEFAULT_URL_BASE); - } - - /** - * Constructs a Rosette API instance using an API key and accepts an - * alternate URL for testing purposes. - * - * @param key Rosette API key. This may be null for use with an on-premise deployment - * of the Rosette API. - * @param alternateUrl Alternate Rosette API URL. {@code null} uses the default. - * @throws HttpRosetteAPIException If the service is not compatible with the version of the binding. - * - */ - HttpRosetteAPI(String key, String alternateUrl) throws HttpRosetteAPIException { - if (alternateUrl != null) { - urlBase = alternateUrl; - if (urlBase.endsWith("/")) { - urlBase = urlBase.substring(0, urlBase.length() - 1); - } - } - this.failureRetries = 1; - mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - - initClient(key, null); + private HttpRosetteAPI() { + // use builder } /** @@ -141,7 +112,7 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { */ HttpRosetteAPI(String key, String urlToCall, Integer failureRetries, CloseableHttpClient httpClient, List
additionalHeaders, - Integer connectionConcurrency) throws HttpRosetteAPIException { + Integer connectionConcurrency, boolean onlyAcceptKnownFields) throws HttpRosetteAPIException { urlBase = urlToCall == null ? urlBase : urlToCall.trim().replaceAll("/+$", ""); if (failureRetries != null && failureRetries >= 1) { this.failureRetries = failureRetries; @@ -152,6 +123,7 @@ public class HttpRosetteAPI extends AbstractRosetteAPI { } mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, onlyAcceptKnownFields); if (httpClient == null) { initClient(key, additionalHeaders); } else { @@ -582,6 +554,7 @@ public static class Builder { private Integer concurrency; private CloseableHttpClient httpClient; private List
additionalHeaders = new ArrayList<>(); + private boolean onlyAcceptKnownFields; /** * Specify the API key. This is required for use with the public API, and @@ -652,13 +625,30 @@ public Builder additionalHeader(String name, String value) { return this; } + /** + * Only process the response from server if all fields are recognized. If set and a new + * field is returned in the response, exception will be thrown. + * + * @return this. + */ + public Builder onlyAcceptKnownFields(boolean onlyAcceptKnownFields) { + this.onlyAcceptKnownFields = onlyAcceptKnownFields; + return this; + } + /** * Build the API object. * @return the new API object. * @throws HttpRosetteAPIException for some error encountered. */ public HttpRosetteAPI build() throws HttpRosetteAPIException { - return new HttpRosetteAPI(key, url, failureRetries, httpClient, additionalHeaders, concurrency); + return new HttpRosetteAPI(key, + url, + failureRetries, + httpClient, + additionalHeaders, + concurrency, + onlyAcceptKnownFields); } } } diff --git a/api/src/test/java/com/basistech/rosette/api/AbstractTest.java b/api/src/test/java/com/basistech/rosette/api/AbstractTest.java index c275507dc..632272adb 100644 --- a/api/src/test/java/com/basistech/rosette/api/AbstractTest.java +++ b/api/src/test/java/com/basistech/rosette/api/AbstractTest.java @@ -17,6 +17,7 @@ package com.basistech.rosette.api; import com.basistech.rosette.apimodel.jackson.ApiModelMixinModule; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Charsets; import com.google.common.io.Resources; @@ -41,6 +42,7 @@ public static void before() throws IOException { String clientPort = Resources.toString(url, Charsets.UTF_8); serverPort = Integer.parseInt(clientPort); mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } protected static byte[] gzip(String text) throws IOException { diff --git a/api/src/test/java/com/basistech/rosette/api/BasicTest.java b/api/src/test/java/com/basistech/rosette/api/BasicTest.java index d9ae71910..5bf5a6c41 100644 --- a/api/src/test/java/com/basistech/rosette/api/BasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/BasicTest.java @@ -184,7 +184,10 @@ public void testExtendedInfo() throws Exception { .withHeader("X-FooMulti", "Bar1", "Bar2") .withHeader("X-RosetteAPI-Concurrency", "5") .withBody("{\"message\":\"Rosette API at your service\",\"time\":1461788498633}", StandardCharsets.UTF_8)); - api = new HttpRosetteAPI("foo-key", String.format("http://localhost:%d/rest/v1", serverPort)); + api = new HttpRosetteAPI.Builder() + .key("foo-key") + .url(String.format("http://localhost:%d/rest/v1", serverPort)) + .build(); Response resp = api.ping(); assertEquals("Bar", resp.getExtendedInformation().get("X-Foo")); Set foos = (Set)resp.getExtendedInformation().get("X-FooMulti"); diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index b9f38b939..8e958236f 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -16,6 +16,7 @@ package com.basistech.rosette.api; +import com.basistech.rosette.RosetteRuntimeException; import com.basistech.rosette.api.common.AbstractRosetteAPI; import com.basistech.rosette.apimodel.CategoriesResponse; import com.basistech.rosette.apimodel.DocumentRequest; @@ -33,6 +34,7 @@ import com.basistech.rosette.apimodel.Request; import com.basistech.rosette.apimodel.SentimentResponse; import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.http.HttpHeaders; @@ -62,6 +64,8 @@ public class RosetteAPITest extends AbstractTest { private HttpRosetteAPI api; private String responseStr; private MockServerClient mockServer; + private String mockServiceUrl = "http://localhost:" + Integer.toString(serverPort) + "/rest/v1"; + public RosetteAPITest(String filename) { testFilename = filename; @@ -127,7 +131,6 @@ public void setUp() throws Exception { .withHeader("X-RosetteAPI-Concurrency", "5") .withBody(INFO_REPONSE, StandardCharsets.UTF_8)); - String mockServiceUrl = "http://localhost:" + Integer.toString(serverPort) + "/rest/v1"; api = new HttpRosetteAPI.Builder() .key("my-key-123") .url(mockServiceUrl) @@ -263,6 +266,39 @@ public void testGetEntityDoc() throws IOException { } } + @Test + public void testIgnoredUnknownField() throws IOException { + if ("unknown-field-entities.json".equals(testFilename)) { + DocumentRequest request = readValue(DocumentRequest.class); + try { + EntitiesResponse response = api.perform(AbstractRosetteAPI.ENTITIES_SERVICE_PATH, request, EntitiesResponse.class); + verifyEntity(response); + } catch (HttpRosetteAPIException e) { + verifyException(e); + } + } + } + + @Test + public void testNonIgnoredUnknownField() throws IOException { + if ("unknown-field-entities.json".equals(testFilename)) { + DocumentRequest request = readValue(DocumentRequest.class); + HttpRosetteAPI tmpApi = new HttpRosetteAPI.Builder() + .key("my-key-123") + .url(mockServiceUrl) + .onlyAcceptKnownFields(true) + .build(); + try { + tmpApi.perform(AbstractRosetteAPI.ENTITIES_SERVICE_PATH, request, EntitiesResponse.class); + } catch (RosetteRuntimeException e) { + if (e.getCause() instanceof UnrecognizedPropertyException) { + return; + } + } + fail("Unknown field is ignored when it shouldn't be "); + } + } + private void verifyEntity(EntitiesResponse response) throws IOException { EntitiesResponse goldResponse = mapper.readValue(responseStr, EntitiesResponse.class); assertEquals(response.getEntities().size(), goldResponse.getEntities().size()); diff --git a/api/src/test/mock-data/request/unknown-field-entities.json b/api/src/test/mock-data/request/unknown-field-entities.json new file mode 100644 index 000000000..7549afddc --- /dev/null +++ b/api/src/test/mock-data/request/unknown-field-entities.json @@ -0,0 +1,5 @@ +{ + + "content": "He also acknowledged the ongoing U.S. conflicts in Iraq and Afghanistan, noting that he is the \"commander in chief of a country that is responsible for ending a war and working in another theater to confront a ruthless adversary that directly threatens the American people\" and U.S. allies.", + "language": "eng" +} diff --git a/api/src/test/mock-data/response/unknown-field-entities.json b/api/src/test/mock-data/response/unknown-field-entities.json new file mode 100644 index 000000000..bc6dda1bd --- /dev/null +++ b/api/src/test/mock-data/response/unknown-field-entities.json @@ -0,0 +1,40 @@ +{ + "entities": [ + { + "count": 2, + "indocChainId": 0, + "mention": "U.S.", + "normalized": "U.S.", + "type": "LOCATION", + "some-future-field": "foo" + }, + { + "count": 1, + "indocChainId": 1, + "mention": "Iraq", + "normalized": "Iraq", + "type": "LOCATION" + }, + { + "count": 1, + "indocChainId": 2, + "mention": "Afghanistan", + "normalized": "Afghanistan", + "type": "LOCATION" + }, + { + "count": 1, + "indocChainId": 3, + "mention": "commander in chief", + "normalized": "commander in chief", + "type": "TITLE" + }, + { + "count": 1, + "indocChainId": 4, + "mention": "American", + "normalized": "American", + "type": "NATIONALITY" + } + ] +} diff --git a/api/src/test/mock-data/response/unknown-field-entities.status b/api/src/test/mock-data/response/unknown-field-entities.status new file mode 100644 index 000000000..ae4ee13c0 --- /dev/null +++ b/api/src/test/mock-data/response/unknown-field-entities.status @@ -0,0 +1 @@ +200 \ No newline at end of file From 973f20d95d86c15a0fece44f8e6e14bf238b8753 Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Fri, 16 Jun 2017 08:58:07 -0400 Subject: [PATCH 057/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.1 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 94d786843..31f329bf0 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 01765bdd9..f12a0e756 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 3f73c4910..e8602c230 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index cb27fbf3e..ce015c584 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 7c0cba410..1e4032c36 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index c4dd38a31..ef1df46aa 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.1 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 17021313b..c5af35080 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1-SNAPSHOT + 1.7.1 com.basistech.rosette rosette-api-release From 8b30d53eddd2aed22c02a2f6bff7e18c567b7ea3 Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Fri, 16 Jun 2017 09:04:23 -0400 Subject: [PATCH 058/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 31f329bf0..c6a14a2c9 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index f12a0e756..577c6a1bd 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index e8602c230..efa6674c7 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index ce015c584..01ed6a18f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 1e4032c36..59977fb7d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index ef1df46aa..24b8ca773 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.1 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index c5af35080..8cb520705 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.1 + 1.7.2-SNAPSHOT com.basistech.rosette rosette-api-release From de81293c1a4bf07811628e5871d38bc1c61f679c Mon Sep 17 00:00:00 2001 From: Brian Sawyer Date: Fri, 16 Jun 2017 09:08:16 -0400 Subject: [PATCH 059/735] Update version in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3ade796b..8e843e78f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you use Maven, include this dependency in your `pom.xml`: com.basistech.rosette rosette-api - 1.5.6 + 1.7.1 ``` From 1fdcf411bded09e773aafcf51691fa90aca0b33c Mon Sep 17 00:00:00 2001 From: Li Xu Date: Sun, 18 Jun 2017 14:02:40 -0400 Subject: [PATCH 060/735] No-Jira: remove invalid statement --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 8e843e78f..e3cf3303f 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ If you use Maven, include this dependency in your `pom.xml`: The version will change as new versions of the binding are released. Note that versions of the form `x.y.Nxx`, where `N` is greater than 100, are internal testing versions; do not use them without consultation with Basis Technology Corp. -You can also download the [self-contained jar file](http://mvnrepository.com/artifact/com.basistech.rosette/rosette-api) to include on your classpath. - The source code on the master branch is the current state of development; it is not recommended for general use. If you prefer to build from source, please use an appropriate release tag. From b3872332857f04a221093bb513665fce7e0780df Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 20 Jun 2017 12:49:32 -0400 Subject: [PATCH 061/735] RCB-514: ent/sent confidence options (#97) --- .../rosette/apimodel/EntitiesOptions.java | 33 +++++++++-- .../rosette/apimodel/SentimentOptions.java | 55 ++++++++++++++++++- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java index d5519e888..23c588f42 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java @@ -23,15 +23,18 @@ */ public final class EntitiesOptions extends Options { - public static final EntitiesOptions DEFAULT_OPTIONS = new EntitiesOptions(false); + public static final EntitiesOptions DEFAULT_OPTIONS = new EntitiesOptions(false, true); + private Boolean calculatConfidence; private Boolean linkEntities; /** * Constructor for {@code EntitiesOptions} * + * @param calculateConfidence return confidence score for the extraction. * @param linkEntities perform entity linking in addition to extraction. */ - protected EntitiesOptions(Boolean linkEntities) { + protected EntitiesOptions(Boolean calculateConfidence, Boolean linkEntities) { + this.calculatConfidence = calculateConfidence; this.linkEntities = linkEntities; } @@ -42,6 +45,13 @@ public Boolean getLinkEntities() { return linkEntities; } + /** + * @return the calculatConfidence flag. + */ + public Boolean getCalculatConfidence() { + return calculatConfidence; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -51,21 +61,34 @@ public boolean equals(Object o) { return false; } EntitiesOptions that = (EntitiesOptions) o; - return Objects.equals(linkEntities, that.linkEntities); + return Objects.equals(linkEntities, that.linkEntities) + && Objects.equals(calculatConfidence, that.calculatConfidence); } @Override public int hashCode() { - return Objects.hash(linkEntities); + return Objects.hash(calculatConfidence, linkEntities); } public static class Builder { + private Boolean calculateConfidence; private Boolean linkEntities; public Builder() { // } + /** + * DocumentRequest calculate confidence score. If the value is {@code true}, then the endpoint will + * return confidence scores. If {@code false} or {@code null}, not. + * @param calculateConfidence whether to get confidence score. + * @return this. + */ + public Builder calculateConfidence(Boolean calculateConfidence) { + this.calculateConfidence = calculateConfidence; + return this; + } + /** * DocumentRequest entity linking. If the value is {@code true}, then the the endpoint will link entities to the * knowledge base. If {@code false}, not. If {@code null}, the endpoint will perform default processing. @@ -78,7 +101,7 @@ public Builder linkEntities(Boolean linkEntities) { } public EntitiesOptions build() { - return new EntitiesOptions(linkEntities); + return new EntitiesOptions(calculateConfidence, linkEntities); } } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java index 428584dda..269787d35 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java @@ -16,15 +16,64 @@ package com.basistech.rosette.apimodel; +import java.util.Objects; + /** * Sentiment options. */ public final class SentimentOptions extends Options { + public static final SentimentOptions DEGAULT_OPTIONS = new SentimentOptions(false); + private Boolean calculateEntityConfidence; /** - * Create a set of sentiment analysis options with default values. + * Constructor for {@code SentimentOptions} + * + * @param calculateEntityConfidence return confidence score for the entities. */ - public SentimentOptions() { - // + protected SentimentOptions(Boolean calculateEntityConfidence) { + this.calculateEntityConfidence = calculateEntityConfidence; + } + + /** + * @return the calculateEntityConfidence flag. + */ + public Boolean getCalculateEntityConfidence() { + return calculateEntityConfidence; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SentimentOptions that = (SentimentOptions)o; + return Objects.equals(this.calculateEntityConfidence, that.calculateEntityConfidence); + } + + @Override + public int hashCode() { + return Objects.hash(calculateEntityConfidence); + } + + public static class Builder { + private Boolean calculateEntityConfidence; + + /** + * DocumentRequest calculate entity confidence score. If the value is {@code true}, then the endpoint will + * return confidence scores. If {@code false} or {@code null}, not. + * @param calculateEntityConfidence whether to get entity confidence score. + * @return this. + */ + public Builder calculateEntityConfidence(Boolean calculateEntityConfidence) { + this.calculateEntityConfidence = calculateEntityConfidence; + return this; + } + + public SentimentOptions build() { + return new SentimentOptions(calculateEntityConfidence); + } } } From e5cde785e15726c0da568db704430a6d51f7a75f Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 20 Jun 2017 13:56:26 -0400 Subject: [PATCH 062/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.2 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index c6a14a2c9..965f291e1 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 577c6a1bd..1de49ae93 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index efa6674c7..d9aa0ebb8 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 01ed6a18f..ea0eccd62 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 59977fb7d..eebf7c402 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 24b8ca773..807aad433 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.2 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 8cb520705..d95ca8de9 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2-SNAPSHOT + 1.7.2 com.basistech.rosette rosette-api-release From 463d937a77746688da1b0eefcadeed5f9e2bf1e5 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Tue, 20 Jun 2017 13:56:30 -0400 Subject: [PATCH 063/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 965f291e1..1f4669e81 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 1de49ae93..58660c120 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index d9aa0ebb8..02c9dbe01 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index ea0eccd62..251973d82 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index eebf7c402..4c4848f75 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 807aad433..70732fbb7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.2 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index d95ca8de9..e6234712c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.2 + 1.7.3-SNAPSHOT com.basistech.rosette rosette-api-release From 745de48d10361885c0de91b998ab9c85a7202688 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Wed, 21 Jun 2017 08:21:35 -0400 Subject: [PATCH 064/735] RCB-514: forgot jackson mixin (#98) * RCB-514: ent/sent confidence options * RCB-514: sorry I kept forgetting Monsignor Jackson * RCB-514: fix typo + issue --- .../apimodel/jackson/EntitiesOptionsMixin.java | 1 + .../apimodel/jackson/SentimentOptionsMixin.java | 5 ++++- .../basistech/rosette/apimodel/EntitiesOptions.java | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java index b1c1f99c4..72aa2180f 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java @@ -24,6 +24,7 @@ public final class EntitiesOptionsMixin extends OptionsMixin { @JsonCreator private EntitiesOptionsMixin( + @JsonProperty("calculateConfidence") Boolean calculateConfidence, @JsonProperty("linkEntities") Boolean linkEntities ) { // diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java index 7112dc8f0..440e3c601 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java @@ -17,12 +17,15 @@ package com.basistech.rosette.apimodel.jackson; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; @JsonTypeName("SentimentOptions") public abstract class SentimentOptionsMixin extends OptionsMixin { @JsonCreator - protected SentimentOptionsMixin() { + protected SentimentOptionsMixin( + @JsonProperty("calculateEntityConfidence") Boolean calculateEntityConfidence + ) { // } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java index 23c588f42..0d608e03b 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java @@ -24,7 +24,7 @@ public final class EntitiesOptions extends Options { public static final EntitiesOptions DEFAULT_OPTIONS = new EntitiesOptions(false, true); - private Boolean calculatConfidence; + private Boolean calculateConfidence; private Boolean linkEntities; /** @@ -34,7 +34,7 @@ public final class EntitiesOptions extends Options { * @param linkEntities perform entity linking in addition to extraction. */ protected EntitiesOptions(Boolean calculateConfidence, Boolean linkEntities) { - this.calculatConfidence = calculateConfidence; + this.calculateConfidence = calculateConfidence; this.linkEntities = linkEntities; } @@ -48,8 +48,8 @@ public Boolean getLinkEntities() { /** * @return the calculatConfidence flag. */ - public Boolean getCalculatConfidence() { - return calculatConfidence; + public Boolean getCalculateConfidence() { + return calculateConfidence; } @Override @@ -62,12 +62,12 @@ public boolean equals(Object o) { } EntitiesOptions that = (EntitiesOptions) o; return Objects.equals(linkEntities, that.linkEntities) - && Objects.equals(calculatConfidence, that.calculatConfidence); + && Objects.equals(calculateConfidence, that.calculateConfidence); } @Override public int hashCode() { - return Objects.hash(calculatConfidence, linkEntities); + return Objects.hash(calculateConfidence, linkEntities); } public static class Builder { From 8d44953489f1b3a52253c777692c9f40ae30114e Mon Sep 17 00:00:00 2001 From: Li Xu Date: Wed, 21 Jun 2017 11:27:46 -0400 Subject: [PATCH 065/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.3 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 1f4669e81..96075f0b4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 58660c120..0b300b3b6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 02c9dbe01..62547d4d0 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 251973d82..4675f89ff 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 4c4848f75..c02d1ec5d 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 70732fbb7..2d9e6650d 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.3 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index e6234712c..e84526644 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3-SNAPSHOT + 1.7.3 com.basistech.rosette rosette-api-release From a8c3d7adb6efc26cef54763bdac509b5d37502ce Mon Sep 17 00:00:00 2001 From: Li Xu Date: Wed, 21 Jun 2017 11:27:50 -0400 Subject: [PATCH 066/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 96075f0b4..0c1daf0a7 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 0b300b3b6..35aa3dde4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 62547d4d0..e31adf0bd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 4675f89ff..cdaf4b81f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c02d1ec5d..72360ac25 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 2d9e6650d..7d2df1591 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.3 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index e84526644..92a5bfc88 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.3 + 1.7.4-SNAPSHOT com.basistech.rosette rosette-api-release From 12e2aba16a35ce730b9cb4d4a6408af74785096d Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Mon, 17 Jul 2017 16:21:50 -0400 Subject: [PATCH 067/735] RD-2002 support for topics results (keyphrases, concepts) --- .../apimodel/jackson/ApiModelMixinModule.java | 6 ++ .../apimodel/jackson/ConceptMixin.java | 30 +++++++ .../apimodel/jackson/KeyphraseMixin.java | 29 +++++++ .../apimodel/jackson/TopicsResponseMixin.java | 33 ++++++++ .../basistech/rosette/apimodel/Concept.java | 84 +++++++++++++++++++ .../basistech/rosette/apimodel/Keyphrase.java | 71 ++++++++++++++++ .../rosette/apimodel/TopicsResponse.java | 73 ++++++++++++++++ pom.xml | 4 +- 8 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/Concept.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/TopicsResponse.java diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 3e6f0bcbe..cf7ef48b8 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -20,6 +20,7 @@ import com.basistech.rosette.apimodel.AdmRequest; import com.basistech.rosette.apimodel.CategoriesOptions; import com.basistech.rosette.apimodel.CategoriesResponse; +import com.basistech.rosette.apimodel.Concept; import com.basistech.rosette.apimodel.ConstantsResponse; import com.basistech.rosette.apimodel.Dependency; import com.basistech.rosette.apimodel.DocumentRequest; @@ -29,6 +30,7 @@ import com.basistech.rosette.apimodel.EntitySentiment; import com.basistech.rosette.apimodel.ErrorResponse; import com.basistech.rosette.apimodel.InfoResponse; +import com.basistech.rosette.apimodel.Keyphrase; import com.basistech.rosette.apimodel.Label; import com.basistech.rosette.apimodel.LanguageDetectionResult; import com.basistech.rosette.apimodel.LanguageOptions; @@ -56,6 +58,7 @@ import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; import com.basistech.rosette.apimodel.TextEmbeddingResponse; import com.basistech.rosette.apimodel.TokensResponse; +import com.basistech.rosette.apimodel.TopicsResponse; import com.basistech.rosette.apimodel.TransliterationOptions; import com.basistech.rosette.apimodel.TransliterationResponse; import com.basistech.rosette.apimodel.batch.BatchRequest; @@ -123,6 +126,9 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(Options.class, OptionsMixin.class); context.setMixInAnnotations(TransliterationOptions.class, TransliterationOptionsMixin.class); context.setMixInAnnotations(TransliterationResponse.class, TransliterationResponseMixin.class); + context.setMixInAnnotations(TopicsResponse.class, TopicsResponseMixin.class); + context.setMixInAnnotations(Keyphrase.class, KeyphraseMixin.class); + context.setMixInAnnotations(Concept.class, ConceptMixin.class); context.setMixInAnnotations(AccuracyMode.class, AccuracyModeMixin.class); SimpleSerializers keySerializers = new SimpleSerializers(); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java new file mode 100644 index 000000000..df9acfb38 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java @@ -0,0 +1,30 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ConceptMixin extends BaseMixin { + @JsonCreator + public ConceptMixin( + @JsonProperty("phrase") String phrase, + @JsonProperty("salience") Double salience, + @JsonProperty("conceptId") String conceptId) { + // + } +} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java new file mode 100644 index 000000000..6a2403ff6 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java @@ -0,0 +1,29 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class KeyphraseMixin extends BaseMixin { + @JsonCreator + public KeyphraseMixin( + @JsonProperty("phrase") String phrase, + @JsonProperty("salience") Double salience) { + // + } +} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java new file mode 100644 index 000000000..423355644 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java @@ -0,0 +1,33 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.basistech.rosette.apimodel.Concept; +import com.basistech.rosette.apimodel.Keyphrase; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class TopicsResponseMixin extends BaseMixin { + @JsonCreator + public TopicsResponseMixin( + @JsonProperty("keyphrases")List keyphrases, + @JsonProperty("concepts")List concepts) { + // + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/Concept.java b/model/src/main/java/com/basistech/rosette/apimodel/Concept.java new file mode 100644 index 000000000..cd9177422 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/Concept.java @@ -0,0 +1,84 @@ +/* +* Copyright 2016 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.Objects; + +/** + * Concepts found in a document. + */ +public final class Concept { + private final String phrase; + private final Double salience; + private final String conceptId; + + /** + * constructor for {@code Concept} + * @param phrase text of the concept + * @param salience concept salience + * @param conceptId the id of the concept + */ + public Concept(String phrase, Double salience, String conceptId) { + this.phrase = phrase; + this.salience = salience; + this.conceptId = conceptId; + } + + /** + * get the concept text + * @return the concept text + */ + public String getPhrase() { + return phrase; + } + + /** + * get the concept salience + * @return the concept salience + */ + public Double getSalience() { + return salience; + } + + /** + * get the concept id + * @return the concept id + */ + public String getConceptId() { + return conceptId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Concept that = (Concept) o; + return Objects.equals(phrase, that.phrase) + && Objects.equals(salience, that.salience) + && Objects.equals(conceptId, that.conceptId); + } + + @Override + public int hashCode() { + return Objects.hash(phrase, salience, conceptId); + } +} \ No newline at end of file diff --git a/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java b/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java new file mode 100644 index 000000000..28a54b8fa --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java @@ -0,0 +1,71 @@ +/* +* Copyright 2016 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.Objects; + +/** + * Keyphrases found in a document. + */ +public final class Keyphrase { + private final String phrase; + private final Double salience; + + /** + * constructor for {@code Keyphrase} + * @param phrase text of the keyphrase + * @param salience keyphrase salience + */ + public Keyphrase(String phrase, Double salience) { + this.phrase = phrase; + this.salience = salience; + } + + /** + * get the keyphrase text + * @return the keyphrase text + */ + public String getPhrase() { + return phrase; + } + + /** + * get the keyphrase salience + * @return the keyphrase salience + */ + public Double getSalience() { + return salience; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Keyphrase that = (Keyphrase) o; + return Objects.equals(phrase, that.phrase) + && Objects.equals(salience, that.salience); + } + + @Override + public int hashCode() { + return Objects.hash(phrase, salience); + } +} \ No newline at end of file diff --git a/model/src/main/java/com/basistech/rosette/apimodel/TopicsResponse.java b/model/src/main/java/com/basistech/rosette/apimodel/TopicsResponse.java new file mode 100644 index 000000000..a4c491aca --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/TopicsResponse.java @@ -0,0 +1,73 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.List; +import java.util.Objects; + +/** + * Simple api response data model for entity extraction + */ +public final class TopicsResponse extends Response { + + private final List keyphrases; + private final List concepts; + + /** + * Constructor for {@code TopicsResponse} + * @param keyphrases a list of extracted keyphrases + * @param concepts a list of extracted concepts + */ + public TopicsResponse(List keyphrases, List concepts) { + this.keyphrases = keyphrases; + this.concepts = concepts; + } + + /** + * get the list of extracted keyphrases + * @return the list of extracted keyphrases + */ + public List getKeyphrases() { + return keyphrases; + } + + /** + * get the list of extracted concepts + * @return the list of extracted concepts + */ + public List getConcepts() { + return concepts; + } + + @Override + public int hashCode() { + return Objects.hash(keyphrases, concepts); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopicsResponse that = (TopicsResponse) o; + return Objects.equals(keyphrases, that.keyphrases) + && Objects.equals(concepts, that.concepts); + } +} diff --git a/pom.xml b/pom.xml index 7d2df1591..03aaf1cd1 100644 --- a/pom.xml +++ b/pom.xml @@ -64,12 +64,12 @@ com.basistech adm-model - 2.2.1 + 2.3.0 com.basistech adm-json - 2.2.1 + 2.3.0 From 8ffec0fbf92716073e4147e9bd591e5303c01180 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Wed, 19 Jul 2017 14:45:12 -0400 Subject: [PATCH 068/735] RD-2002 topics example --- .../api/common/AbstractRosetteAPI.java | 1 + .../rosette/examples/TopicsExample.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java diff --git a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java index e0e2b8b1e..d7467c96f 100644 --- a/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java +++ b/common/src/main/java/com/basistech/rosette/api/common/AbstractRosetteAPI.java @@ -42,6 +42,7 @@ public abstract class AbstractRosetteAPI implements AutoCloseable { public static final String TEXT_EMBEDDING_SERVICE_PATH = "/text-embedding"; public static final String SYNTAX_DEPENDENCIES_SERVICE_PATH = "/syntax/dependencies"; public static final String TRANSLITERATION_SERVICE_PATH = "/transliteration"; + public static final String TOPICS_SERVICE_PATH = "/topics"; public static final String INFO_SERVICE_PATH = "/info"; public static final String PING_SERVICE_PATH = "/ping"; diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java new file mode 100644 index 000000000..606f7a191 --- /dev/null +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -0,0 +1,46 @@ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.examples; + +import com.basistech.rosette.api.HttpRosetteAPI; +import com.basistech.rosette.apimodel.DocumentRequest; +import com.basistech.rosette.apimodel.TopicsResponse; +import com.basistech.util.LanguageCode; + +public class TopicsExample extends ExampleBase { + public static void main(String[] args) { + try { + new TopicsExample().run(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void run() throws Exception { + String sampleData = "Bayonetta. Bayonetta. Bayonetta. Bayonetta. Bayonetta."; + HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() + .key(getApiKeyFromSystemProperty()) + .url(getAltUrlFromSystemProperty()) + .build(); + DocumentRequest request = new DocumentRequest.Builder() + .language(LanguageCode.ENGLISH) + .content(sampleData) + .build(); + TopicsResponse resp = rosetteApi.perform(HttpRosetteAPI.TOPICS_SERVICE_PATH, request, TopicsResponse.class); + System.out.println(responseToJson(resp)); + } +} From 1f5717c46adccbc000dc1760c3a61dc06aed797c Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Thu, 20 Jul 2017 15:09:35 -0400 Subject: [PATCH 069/735] RD-2002 reuse sentiment example for topics since it's meaningful text with keyphrases --- .../main/java/com/basistech/rosette/examples/TopicsExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java index 606f7a191..6214f0dcb 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -31,7 +31,7 @@ public static void main(String[] args) { } private void run() throws Exception { - String sampleData = "Bayonetta. Bayonetta. Bayonetta. Bayonetta. Bayonetta."; + String sampleData = "Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn’t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, “The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy."; HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) From 62ed79ea1edfb75be7ccc5def671f2d6e8cbbe1e Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Tue, 25 Jul 2017 14:08:29 -0400 Subject: [PATCH 070/735] RD-2002 oraclejdk7 -> openjdk7 to make travis happy --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cf70ea91f..5a39540f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java script: mvn verify jdk: - oraclejdk8 -- oraclejdk7 +- openjdk7 - openjdk8 # suggested by travis support. From 9fd0815dfb4e6362204327a74df3ef4ce4e3372d Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Tue, 25 Jul 2017 14:50:53 -0400 Subject: [PATCH 071/735] RD-2002 copyright year --- .../main/java/com/basistech/rosette/examples/TopicsExample.java | 2 +- .../com/basistech/rosette/apimodel/jackson/ConceptMixin.java | 2 +- .../com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java | 2 +- .../basistech/rosette/apimodel/jackson/TopicsResponseMixin.java | 2 +- model/src/main/java/com/basistech/rosette/apimodel/Concept.java | 2 +- .../src/main/java/com/basistech/rosette/apimodel/Keyphrase.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java index 6214f0dcb..875f5d288 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java index df9acfb38..3bb708124 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ConceptMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java index 6a2403ff6..9401ea93b 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/KeyphraseMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java index 423355644..21f18e2c3 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsResponseMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/model/src/main/java/com/basistech/rosette/apimodel/Concept.java b/model/src/main/java/com/basistech/rosette/apimodel/Concept.java index cd9177422..0b5529b94 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/Concept.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/Concept.java @@ -1,5 +1,5 @@ /* -* Copyright 2016 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java b/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java index 28a54b8fa..c5a66a579 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/Keyphrase.java @@ -1,5 +1,5 @@ /* -* Copyright 2016 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 78e5b0fe3691158d220798168a96f6db90ea1105 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Wed, 26 Jul 2017 11:10:26 -0400 Subject: [PATCH 072/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.4 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0c1daf0a7..b8aee50cf 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 35aa3dde4..c70f1ea55 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index e31adf0bd..69b47f74c 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index cdaf4b81f..b05f72e6f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 72360ac25..116666d76 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 03aaf1cd1..88c726155 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.4 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 92a5bfc88..98252cf3b 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4-SNAPSHOT + 1.7.4 com.basistech.rosette rosette-api-release From beee261386bfb17767bfe0ede05ede2fdb126461 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Wed, 26 Jul 2017 11:10:30 -0400 Subject: [PATCH 073/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b8aee50cf..4a516d813 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index c70f1ea55..134a2259b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 69b47f74c..3cdd3b6d7 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index b05f72e6f..d9515c2a3 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 116666d76..b81d1e78e 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 88c726155..8b6792251 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.4 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 98252cf3b..c8ee82852 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.4 + 1.7.5-SNAPSHOT com.basistech.rosette rosette-api-release From 42fcffd26c9233b5898c6edb2f3ca087e77e1ddc Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 3 Aug 2017 15:38:06 -0400 Subject: [PATCH 074/735] Add backend compatibility link --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3cf3303f..b5e3256fd 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,19 @@ If you use Maven, include this dependency in your `pom.xml`: com.basistech.rosette rosette-api - 1.7.1 + ${rosette.api.java.binding.version} ``` +where `${rosette.api.java.binding.version}` is the [latest version available from Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.basistech.rosette%22%20AND%20a%3A%22rosette-api%22). + The version will change as new versions of the binding are released. Note that versions of the form `x.y.Nxx`, where `N` is greater than 100, are internal testing versions; do not use them without consultation with Basis Technology Corp. +If the version you are using is not the latest from Maven Central. Please check for its +[**compatibilty with api.rosette.com**](https://developer.rosette.com/features-and-functions?java). +If you have an on-premise version of Rosette API server, please contact support for binding +compatibility with your installation. + The source code on the master branch is the current state of development; it is not recommended for general use. If you prefer to build from source, please use an appropriate release tag. From 6a3fc2ccee53d621c89746ee6f56338c8bf88dc1 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Mon, 28 Aug 2017 14:42:19 -0400 Subject: [PATCH 075/735] RAAP-388 Added Jenkinsfile --- Jenkinsfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..791d01cbb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,28 @@ +node { + def SOURCEDIR = pwd() + try { + stage("Clean up") { + step([$class: 'WsCleanup']) + } + stage("Checkout Code") { + checkout scm + } + stage("Test with Docker") { + withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { + sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosetteapi/docker-java" + } + } + slack(true) + } catch (e) { + currentBuild.result = "FAILED" + slack(false) + throw e + } +} + +def slack(boolean success) { + def color = success ? "#00FF00" : "#FF0000" + def status = success ? "SUCCESSFUL" : "FAILED" + def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" + slackSend(color: color, channel: "#rapid", message: message) +} \ No newline at end of file From ac5014521be9bc995028e2e626b82d7b5055ebaa Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 29 Aug 2017 11:06:12 -0400 Subject: [PATCH 076/735] Added Jenkinsfile.examples --- Jenkinsfile.examples | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Jenkinsfile.examples diff --git a/Jenkinsfile.examples b/Jenkinsfile.examples new file mode 100644 index 000000000..07b8f1817 --- /dev/null +++ b/Jenkinsfile.examples @@ -0,0 +1,35 @@ +node { + def SOURCEDIR = pwd() + def TEST_CONTAINER = 'examples/java-test' + def DOCKERFILE_DIR = './examples/docker' + try { + stage("Clean up") { + step([$class: 'WsCleanup']) + } + stage("Checkout Code") { + checkout scm + } + stage("Build Dockerfile") { + dir ("${DOCKERFILE_DIR}") { + docker.build("${TEST_CONTAINER}") + } + } + stage("Run Examples") { + withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { + sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}" + } + } + slack(true) + } catch (e) { + currentBuild.result = "FAILED" + slack(false) + throw e + } +} + +def slack(boolean success) { + def color = success ? "#00FF00" : "#FF0000" + def status = success ? "SUCCESSFUL" : "FAILED" + def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" + slackSend(color: color, channel: "#rapid", message: message) +} \ No newline at end of file From a261bf15883fe0bd6897f70e1d8dfd6fab24ea8c Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 29 Aug 2017 11:55:59 -0400 Subject: [PATCH 077/735] Java requires a version --- Jenkinsfile.examples | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile.examples b/Jenkinsfile.examples index 07b8f1817..36d7cb5a1 100644 --- a/Jenkinsfile.examples +++ b/Jenkinsfile.examples @@ -2,6 +2,7 @@ node { def SOURCEDIR = pwd() def TEST_CONTAINER = 'examples/java-test' def DOCKERFILE_DIR = './examples/docker' + def PUBLISHED_VERSION = '1.7.3 try { stage("Clean up") { step([$class: 'WsCleanup']) @@ -16,7 +17,7 @@ node { } stage("Run Examples") { withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { - sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}" + sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -e VERSION=${PUBLISHED_VERSION} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}" } } slack(true) From bb412ce26b9af7fc023bf5c2bc2e68e5b5e145de Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 29 Aug 2017 13:07:51 -0400 Subject: [PATCH 078/735] Missing closing apostrophe --- Jenkinsfile.examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.examples b/Jenkinsfile.examples index 36d7cb5a1..5b6632cdf 100644 --- a/Jenkinsfile.examples +++ b/Jenkinsfile.examples @@ -2,7 +2,7 @@ node { def SOURCEDIR = pwd() def TEST_CONTAINER = 'examples/java-test' def DOCKERFILE_DIR = './examples/docker' - def PUBLISHED_VERSION = '1.7.3 + def PUBLISHED_VERSION = '1.7.3' try { stage("Clean up") { step([$class: 'WsCleanup']) From 4f3dc8517f2529bd3cbb78ad4ae40c2eec1448f5 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Wed, 6 Sep 2017 12:27:42 -0400 Subject: [PATCH 079/735] RD-2024 update topics example for consistency with examples repo (#102) * RD-2024 update topics example for consistency with examples repo * RD-2024 sampleData -> topicsData --- .../java/com/basistech/rosette/examples/TopicsExample.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java index 875f5d288..2bac2a0c0 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -31,14 +31,14 @@ public static void main(String[] args) { } private void run() throws Exception { - String sampleData = "Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn’t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, “The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy."; + String topicsData = "Lily Collins is in talks to join Nicholas Hoult in Chernin Entertainment and Fox Searchlight's J.R.R. Tolkien biopic Tolkien. Anthony Boyle, known for playing Scorpius Malfoy in the British play Harry Potter and the Cursed Child, also has signed on for the film centered on the famed author. In Tolkien, Hoult will play the author of the Hobbit and Lord of the Rings book series that were later adapted into two Hollywood trilogies from Peter Jackson. Dome Karukoski is directing the project."; HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); DocumentRequest request = new DocumentRequest.Builder() .language(LanguageCode.ENGLISH) - .content(sampleData) + .content(topicsData) .build(); TopicsResponse resp = rosetteApi.perform(HttpRosetteAPI.TOPICS_SERVICE_PATH, request, TopicsResponse.class); System.out.println(responseToJson(resp)); From 645ac50d30a4144acd137d246658f6af278b4c12 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 6 Sep 2017 15:43:49 -0400 Subject: [PATCH 080/735] Added -b to mvn exec calls --- examples/docker/run_java.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/docker/run_java.sh b/examples/docker/run_java.sh index 96fd830c6..e6f881ed2 100644 --- a/examples/docker/run_java.sh +++ b/examples/docker/run_java.sh @@ -14,7 +14,7 @@ function checkAPI { if [ ! -z $match ]; then echo -e "\nInvalid Rosette API Key" exit 1 - fi + fi } function cleanURL() { @@ -34,22 +34,22 @@ function validateURL() { if [ "${match}" = "" ]; then echo -e "\n${ping_url} server not responding\n" exit 1 - fi + fi } function runExample() { echo -e "\n---------- ${1} start -------------\n" if [ ! -z ${ALT_URL} ]; then - result="$(mvn exec:java -Dexec.mainClass=com.basistech.rosette.examples.${1} -Drosette.api.key=${API_KEY} -Drosette.api.altUrl=${ALT_URL} 2>&1 )" + result="$(mvn exec:java -B -Dexec.mainClass=com.basistech.rosette.examples.${1} -Drosette.api.key=${API_KEY} -Drosette.api.altUrl=${ALT_URL} 2>&1 )" else - result="$(mvn exec:java -Dexec.mainClass=com.basistech.rosette.examples.${1} -Drosette.api.key=${API_KEY} 2&>1 )" + result="$(mvn exec:java -B -Dexec.mainClass=com.basistech.rosette.examples.${1} -Drosette.api.key=${API_KEY} 2&>1 )" fi if [[ $result == *"Exception"* ]]; then retcode=1 fi echo "${result}" echo -e "\n---------- ${1} end -------------\n" - for err in "${errors[@]}"; do + for err in "${errors[@]}"; do if [[ ${result} == *"${err}"* ]]; then retcode=1 fi @@ -100,7 +100,7 @@ assignVersion examples.pom.xml if [ ! -z ${API_KEY} ]; then checkAPI - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -pl examples -pl examples + mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -pl examples -pl examples cd /java/examples if [ ! -z ${FILENAME} ]; then runExample ${FILENAME} @@ -114,7 +114,7 @@ if [ ! -z ${API_KEY} ]; then runExample ${filename} done fi -else +else usage fi From c73d369fd027a2d20ed533c4a5f5d982fd104b55 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Thu, 7 Sep 2017 09:03:45 -0400 Subject: [PATCH 081/735] Added HttpClientSingleton to skip --- examples/docker/run_java.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/docker/run_java.sh b/examples/docker/run_java.sh index e6f881ed2..30575cdb9 100644 --- a/examples/docker/run_java.sh +++ b/examples/docker/run_java.sh @@ -108,7 +108,7 @@ if [ ! -z ${API_KEY} ]; then for file in /java/examples/src/main/java/com/basistech/rosette/examples/*.java; do filename=$(basename "$file") filename="${filename%.*}" - if [ "${filename}" = "ExampleBase" ]; then + if [ "${filename}" = "ExampleBase" -o "${filename}" = "HttpClientSingleton" ]; then continue fi runExample ${filename} From 362625f85066cbaa558674bb4987780e6074d0ba Mon Sep 17 00:00:00 2001 From: Chris Park Date: Thu, 7 Sep 2017 09:27:53 -0400 Subject: [PATCH 082/735] Added check for VERSION - must be provided --- examples/docker/run_java.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/docker/run_java.sh b/examples/docker/run_java.sh index 30575cdb9..569f7e824 100644 --- a/examples/docker/run_java.sh +++ b/examples/docker/run_java.sh @@ -58,6 +58,10 @@ function runExample() { # Updates the given pom files to use the publish version function assignVersion() { + if [ -z ${VERSION} ]; then + echo "VERSION must be specified" + usage + fi sed -i "s|\(\).*SNAPSHOT\(\)|\1${VERSION}\2|" ${1} } #------------------ Functions End ------------------------------------------------ @@ -94,7 +98,7 @@ cp -r -n /source/examples . cp /source/examples/docker/main/pom.xml . assignVersion pom.xml -assignVersion examples.pom.xml +assignVersion examples/pom.xml #Run the examples From f3ca6407733aaba1cf8f04357330d74e01652c93 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Tue, 12 Sep 2017 15:08:06 -0400 Subject: [PATCH 083/735] Work around jamesdbloom/mockserver#133 --- api/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 4a516d813..88389b7af 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -147,14 +147,14 @@ process-test-classes process-test-classes - start + runForked verify verify - stop + stopForked From 9eb8653f3119129ff5237d46fec0e21d0e37a961 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Wed, 6 Sep 2017 10:27:56 -0400 Subject: [PATCH 084/735] RLIJE-423: Add language region detection API --- .../apimodel/jackson/ApiModelMixinModule.java | 2 + .../jackson/LanguageOptionsMixin.java | 3 +- .../jackson/LanguageResponseMixin.java | 6 +- .../jackson/RegionDetectionResultMixin.java | 33 ++++++++ .../rosette/apimodel/LanguageOptions.java | 31 +++++-- .../rosette/apimodel/LanguageResponse.java | 39 +++++++-- .../apimodel/RegionDetectionResult.java | 81 +++++++++++++++++++ 7 files changed, 181 insertions(+), 14 deletions(-) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/RegionDetectionResultMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/RegionDetectionResult.java diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index cf7ef48b8..7fef5220a 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -47,6 +47,7 @@ import com.basistech.rosette.apimodel.NameTranslationResponse; import com.basistech.rosette.apimodel.Options; import com.basistech.rosette.apimodel.PingResponse; +import com.basistech.rosette.apimodel.RegionDetectionResult; import com.basistech.rosette.apimodel.Relationship; import com.basistech.rosette.apimodel.RelationshipsOptions; import com.basistech.rosette.apimodel.RelationshipsResponse; @@ -100,6 +101,7 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(InfoResponse.class, InfoResponseMixin.class); context.setMixInAnnotations(LanguageDetectionResult.class, LanguageDetectionResultMixin.class); context.setMixInAnnotations(LanguageOptions.class, LanguageOptionsMixin.class); + context.setMixInAnnotations(RegionDetectionResult.class, RegionDetectionResultMixin.class); context.setMixInAnnotations(LanguageResponse.class, LanguageResponseMixin.class); context.setMixInAnnotations(LanguageWeight.class, LanguageWeightMixin.class); context.setMixInAnnotations(com.basistech.rosette.apimodel.LinkedEntity.class, LinkedEntityMixin.class); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageOptionsMixin.java index b958586bb..6cf105333 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageOptionsMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageOptionsMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ public class LanguageOptionsMixin extends OptionsMixin { @JsonCreator protected LanguageOptionsMixin( + @JsonProperty("multilingual") Boolean multilingual, @JsonProperty("minValidChars") Integer minValidChars, @JsonProperty("profileDepth") Integer profileDepth, @JsonProperty("ambiguityThreshold") Double ambiguityThreshold, diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageResponseMixin.java index f3a678567..52fe6ed05 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageResponseMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/LanguageResponseMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package com.basistech.rosette.apimodel.jackson; import com.basistech.rosette.apimodel.LanguageDetectionResult; +import com.basistech.rosette.apimodel.RegionDetectionResult; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,7 +26,8 @@ public class LanguageResponseMixin extends BaseMixin { @JsonCreator public LanguageResponseMixin( - @JsonProperty("languageDetections") List languageDetections + @JsonProperty("languageDetections") List languageDetections, + @JsonProperty("regionalDetections") List regionalDetections ) { // } diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/RegionDetectionResultMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/RegionDetectionResultMixin.java new file mode 100644 index 000000000..fb7592494 --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/RegionDetectionResultMixin.java @@ -0,0 +1,33 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.basistech.rosette.apimodel.LanguageDetectionResult; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class RegionDetectionResultMixin extends BaseMixin { + @JsonCreator + public RegionDetectionResultMixin( + @JsonProperty("region") String region, + @JsonProperty("languages") List languages + ) { + // + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/LanguageOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/LanguageOptions.java index c1b646378..547d4e0e6 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/LanguageOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/LanguageOptions.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ */ public final class LanguageOptions extends Options { + private Boolean multilingual; @Min(1) private Integer minValidChars; @Min(1) @@ -55,9 +56,11 @@ public final class LanguageOptions extends Options { */ public LanguageOptions() { } - + /** - * constructor for {@code LanguageOptions} + * constructor for {@code LanguageOptions}, using the default value + * for whether to detect language regions and the specified value + * for everything else * @param minValidChars minimum number of valid characters required for identification * @param profileDepth number of n-grams to consider in detection * @param ambiguityThreshold number of n-gram distance ambiguity threshold @@ -90,6 +93,14 @@ public LanguageOptions( this.languageWeightAdjustments = languageWeightAdjustments; } + /** + * get whether to detect language regions + * @return whether to detect language regions + */ + public Boolean getMultilingual() { + return multilingual; + } + /** * get minimum number of valid characters needed for identification * @return minimum number of valid characters @@ -170,6 +181,14 @@ public Set getLanguageWeightAdjustments() { return languageWeightAdjustments; } + /** + * set whether to detect language regions + * @param multilingual + */ + public void setMultilingual(Boolean multilingual) { + this.multilingual = multilingual; + } + /** * set minimum number of valid characters needed for identification * @param minValidChars minimum number of valid characters @@ -268,7 +287,8 @@ public void setLanguageWeightAdjustments(Set languageWeightAdjus @Override public int hashCode() { - int result = minValidChars != null ? minValidChars.hashCode() : 0; + int result = multilingual != null ? multilingual.hashCode() : 0; + result = 31 * result + (minValidChars != null ? minValidChars.hashCode() : 0); result = 31 * result + (profileDepth != null ? profileDepth.hashCode() : 0); result = 31 * result + (ambiguityThreshold != null ? ambiguityThreshold.hashCode() : 0); result = 31 * result + (invalidityThreshold != null ? invalidityThreshold.hashCode() : 0); @@ -292,7 +312,8 @@ public boolean equals(Object o) { } LanguageOptions that = (LanguageOptions) o; - return minValidChars != null ? minValidChars.equals(that.getMinValidChars()) : that.minValidChars == null + return multilingual != null ? multilingual.equals(that.getMultilingual()) : that.multilingual == null + && minValidChars != null ? minValidChars.equals(that.getMinValidChars()) : that.minValidChars == null && profileDepth != null ? profileDepth.equals(that.getProfileDepth()) : that.profileDepth == null && ambiguityThreshold != null ? ambiguityThreshold.equals(that.getAmbiguityThreshold()) : that.ambiguityThreshold == null && invalidityThreshold != null ? invalidityThreshold.equals(that.getInvalidityThreshold()) : that.invalidityThreshold == null diff --git a/model/src/main/java/com/basistech/rosette/apimodel/LanguageResponse.java b/model/src/main/java/com/basistech/rosette/apimodel/LanguageResponse.java index 2fc1a1e13..c3062c239 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/LanguageResponse.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/LanguageResponse.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.basistech.rosette.apimodel; +import java.util.ArrayList; import java.util.List; /** @@ -24,26 +25,51 @@ public final class LanguageResponse extends Response { private final List languageDetections; + private final List regionalDetections; /** * constructor for {@code LanguageResponse} - * @param languageDetections list of detected languages + * @param languageDetections list of detected whole-document languages */ public LanguageResponse(List languageDetections) { + this(languageDetections, new ArrayList()); + } + + /** + * constructor for {@code LanguageResponse} + * @param languageDetections list of detected whole-document languages + * @param regionalDetections list of detected language regions + */ + public LanguageResponse( + List languageDetections, + List regionalDetections + ) { this.languageDetections = languageDetections; + this.regionalDetections = regionalDetections; } /** - * get the list of detected languages - * @return the list of detected languages + * get the list of detected whole-document languages + * @return the list of detected whole-document languages */ public List getLanguageDetections() { return languageDetections; } + /** + * get the list of detected language regions + * @return the list of detected language regions + */ + public List getRegionalDetections() { + return regionalDetections; + } + @Override public int hashCode() { - return languageDetections != null ? languageDetections.hashCode() : 0; + int result; + result = languageDetections != null ? languageDetections.hashCode() : 0; + result = 31 * result + (regionalDetections != null ? regionalDetections.hashCode() : 0); + return result; } /** @@ -58,6 +84,7 @@ public boolean equals(Object o) { } LanguageResponse that = (LanguageResponse) o; - return languageDetections != null ? languageDetections.equals(that.getLanguageDetections()) : that.languageDetections == null; + return languageDetections != null ? languageDetections.equals(that.getLanguageDetections()) : that.languageDetections == null + && regionalDetections != null ? regionalDetections.equals(that.getRegionalDetections()) : that.regionalDetections == null; } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/RegionDetectionResult.java b/model/src/main/java/com/basistech/rosette/apimodel/RegionDetectionResult.java new file mode 100644 index 000000000..21635c8a3 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/RegionDetectionResult.java @@ -0,0 +1,81 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import java.util.List; + +/** + * Language region detection result + */ +public final class RegionDetectionResult { + + private final String region; + private final List languages; + + /** + * Constructor for {@code LanguageRegionResult} + * @param region the text of the language region + * @param languages list of languages detected for this region + */ + public RegionDetectionResult( + String region, + List languages + ) { + this.region = region; + this.languages = languages; + } + + /** + * get the region text + * @return the confidence + */ + public String getRegion() { + return region; + } + + /** + * get the detected languages + * @return the language + */ + public List getLanguages() { + return languages; + } + + @Override + public int hashCode() { + int result; + result = region != null ? region.hashCode() : 0; + result = 31 * result + (languages != null ? languages.hashCode() : 0); + return result; + } + + /** + * if the param is a {@code LanguageRegionResult}, compare contents for equality + * @param o the object + * @return whether or not the param object is equal to this object + */ + @Override + public boolean equals(Object o) { + if (!(o instanceof RegionDetectionResult)) { + return false; + } + + RegionDetectionResult that = (RegionDetectionResult) o; + return region != null ? region.equals(that.getRegion()) : that.region == null + && languages != null ? languages.equals(that.getLanguages()) : that.languages == null; + } +} From 6d406716b29cc2844b90d6f85185ee212d256463 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 15 Sep 2017 13:05:05 -0400 Subject: [PATCH 085/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.5 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 88389b7af..e905a26c3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 134a2259b..d18d7d3be 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 3cdd3b6d7..7d6f67237 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d9515c2a3..638fe724e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index b81d1e78e..c07de67e4 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 8b6792251..bd80acc2e 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.5 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index c8ee82852..ff9f52706 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 com.basistech.rosette rosette-api-release From db40a49242801f9786704ea4167d94be4a32aae2 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 15 Sep 2017 13:05:10 -0400 Subject: [PATCH 086/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index e905a26c3..873e67e55 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index d18d7d3be..527b4b0d8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 7d6f67237..5698bed36 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 638fe724e..63d14bce0 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c07de67e4..f23581414 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index bd80acc2e..d954a8ce0 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.5 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index ff9f52706..dee3669b1 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT com.basistech.rosette rosette-api-release From 50182affc402f2afa86c72b6f09d760d7664b82b Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 15 Sep 2017 13:06:35 -0400 Subject: [PATCH 087/735] [maven-release-plugin] rollback the release of rosette-api-java-binding-1.7.5 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 873e67e55..88389b7af 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 527b4b0d8..134a2259b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 5698bed36..3cdd3b6d7 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 63d14bce0..d9515c2a3 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index f23581414..b81d1e78e 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index d954a8ce0..8b6792251 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index dee3669b1..c8ee82852 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.5-SNAPSHOT com.basistech.rosette rosette-api-release From c48a191ded5a836770ea5bb32a8554a23ed06624 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Fri, 15 Sep 2017 13:30:41 -0400 Subject: [PATCH 088/735] Rd 2012 java example (#104) * RD-2012 test javadoc necessity * RD-2012 useful javadoc comment --- .../java/com/basistech/rosette/examples/TopicsExample.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java index 2bac2a0c0..8e3646f6e 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -20,6 +20,9 @@ import com.basistech.rosette.apimodel.TopicsResponse; import com.basistech.util.LanguageCode; +/** + * Example which demonstrates the topics API. + */ public class TopicsExample extends ExampleBase { public static void main(String[] args) { try { From 17d2f2e3382a9f7a9a82f35e6582c037fd4a49d2 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Fri, 15 Sep 2017 15:11:01 -0400 Subject: [PATCH 089/735] No-Jira: backout internal-release profile (#100) * No-Jira: backout internal-release profile * No-Jira: fix checkstyle * No-Jira: misc checkstyle issues * No-Jira: more checkstyle --- .travis.yml | 2 +- api/pom.xml | 5 ++-- .../com/basistech/rosette/api/BasicTest.java | 4 +-- .../rosette/api/DevRosetteAPITest.java | 28 ++++++++++--------- .../rosette/api/InvalidErrorTest.java | 7 ++--- .../basistech/rosette/api/OldBasicTest.java | 4 +-- .../basistech/rosette/api/RosetteAPITest.java | 4 +-- common/pom.xml | 4 +-- examples/pom.xml | 4 +-- .../com/basistech/rosette/examples/README.md | 6 ++-- json/pom.xml | 4 +-- .../basistech/rosette/apimodel/ModelTest.java | 4 ++- model/pom.xml | 4 +-- pom.xml | 26 ++--------------- release/pom.xml | 4 +-- 15 files changed, 48 insertions(+), 62 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a39540f5..b5d122b8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -script: mvn verify +script: mvn clean verify javadoc:aggregate jdk: - oraclejdk8 - openjdk7 diff --git a/api/pom.xml b/api/pom.xml index 88389b7af..bc8b93b48 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 @@ -118,6 +118,7 @@ org.codehaus.mojo build-helper-maven-plugin + 3.0.0 reserve-network-port diff --git a/api/src/test/java/com/basistech/rosette/api/BasicTest.java b/api/src/test/java/com/basistech/rosette/api/BasicTest.java index 5bf5a6c41..748d39804 100644 --- a/api/src/test/java/com/basistech/rosette/api/BasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/BasicTest.java @@ -46,11 +46,11 @@ import static java.util.concurrent.TimeUnit.SECONDS; public class BasicTest extends AbstractTest { - private HttpRosetteAPI api; @Rule public MockServerRule mockServerRule = new MockServerRule(this, getFreePort()); private MockServerClient mockServer; + private HttpRosetteAPI api; private static int getFreePort() { try (ServerSocket socket = new ServerSocket(0)) { @@ -198,7 +198,7 @@ public void testExtendedInfo() throws Exception { private class ApiPinger extends Thread { HttpRosetteAPI api1; - public ApiPinger(HttpRosetteAPI api) throws IOException { + ApiPinger(HttpRosetteAPI api) throws IOException { this.api1 = api; } diff --git a/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java index e3215d7da..766303d8e 100644 --- a/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java @@ -1,16 +1,18 @@ -/****************************************************************************** - * * This data and information is proprietary to, and a valuable trade secret - * * of, Basis Technology Corp. It is given in confidence by Basis Technology - * * and may only be used as permitted under the license agreement under which - * * it has been distributed, and in no other way. - * * - * * Copyright (c) 2015 Basis Technology Corporation All rights reserved. - * * - * * The technical data and information provided herein are provided with - * * `limited rights', and the computer software provided herein is provided - * * with `restricted rights' as those terms are defined in DAR and ASPR - * * 7-104.9(a). - ******************************************************************************/ +/* +* Copyright 2014 Basis Technology Corp. +* +* 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.basistech.rosette.api; diff --git a/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java b/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java index 751622089..7c3bcec1f 100644 --- a/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java +++ b/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java @@ -36,10 +36,9 @@ public void notJsonError() throws Exception { mockServer.reset() .when(HttpRequest.request().withPath(".*/{2,}.*")) .respond(HttpResponse.response() - .withBody("Invalid path; '//'") - .withHeader("X-RosetteAPI-Concurrency", "5") - .withStatusCode(404) - ); + .withBody("Invalid path; '//'") + .withHeader("X-RosetteAPI-Concurrency", "5") + .withStatusCode(404)); mockServer.when(HttpRequest.request() .withMethod("GET") .withPath("/rest/v1/ping") diff --git a/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java b/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java index c8f26f82a..8999d32b0 100644 --- a/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java @@ -39,11 +39,11 @@ @SuppressWarnings("deprecation") public class OldBasicTest extends AbstractTest { - private RosetteAPI api; @Rule public MockServerRule mockServerRule = new MockServerRule(this, getFreePort()); private MockServerClient mockServer; + private RosetteAPI api; private static int getFreePort() { try (ServerSocket socket = new ServerSocket(0)) { @@ -166,7 +166,7 @@ public void testExtendedInfo() throws Exception { private class ApiPinger extends Thread { RosetteAPI api1; - public ApiPinger(RosetteAPI api) throws IOException, RosetteAPIException { + ApiPinger(RosetteAPI api) throws IOException, RosetteAPIException { this.api1 = api; } diff --git a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java index 8e958236f..a4f0ab58d 100644 --- a/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java @@ -154,7 +154,7 @@ public void testMatchName() throws IOException { private void verifyNameMatcher(NameSimilarityResponse response) throws IOException { NameSimilarityResponse goldResponse = mapper.readValue(responseStr, NameSimilarityResponse.class); - assertEquals(goldResponse.getScore(),response.getScore(), 0.0); + assertEquals(goldResponse.getScore(), response.getScore(), 0.0); } private NameSimilarityRequest readValueNameMatcher() throws IOException { @@ -482,7 +482,7 @@ public void testNameDeduplication() throws IOException { private void verifyNameDeduplication(NameDeduplicationResponse response) throws IOException { NameDeduplicationResponse goldResponse = mapper.readValue(responseStr, NameDeduplicationResponse.class); - assertEquals(goldResponse.getResults(),response.getResults()); + assertEquals(goldResponse.getResults(), response.getResults()); } private NameDeduplicationRequest readValueNameDeduplication() throws IOException { diff --git a/common/pom.xml b/common/pom.xml index 134a2259b..c932b0c21 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 diff --git a/examples/pom.xml b/examples/pom.xml index 3cdd3b6d7..4ea418312 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 diff --git a/examples/src/main/java/com/basistech/rosette/examples/README.md b/examples/src/main/java/com/basistech/rosette/examples/README.md index 240966581..b6321ed7f 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/README.md +++ b/examples/src/main/java/com/basistech/rosette/examples/README.md @@ -6,7 +6,7 @@ Each example class can be run independently. If you use Maven, everything should have been setup and you can start running the examples using `mvn exec:java`. Otherwise you can compile and run these examples by hand: -- make sure you have JRE 1.7, verify by `java -version` +- make sure you have JRE 1.7+, verify by `java -version` - download - `cd src/main/java/com/basistech/rosette/examples` - `javac -cp .: *.java` @@ -14,7 +14,6 @@ Otherwise you can compile and run these examples by hand: | File Name | Description | ------------- |------------- -| Base64InputExample.java | Entities using base64 encoded string | CategoriesExample.java | Gets the category of a document at a URL | EntitiesExample.java | Extracts entities | InfoExample.java | Gets information about Rosette API @@ -30,4 +29,7 @@ Otherwise you can compile and run these examples by hand: | PingExample.java | Pings the Rosette API to check for availability | SentencesExample.java | Gets the sentences | SentimentExample.java | Gets the sentiment of a local file +| SyntaxDependenciesExample.java | Gets syntactical dependencies | TokenExample.java | Gets the tokens +| TopicsExample.java | Gets topics +| TransliterationExample.java | Gets transliteration diff --git a/json/pom.xml b/json/pom.xml index d9515c2a3..0821de4fc 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 diff --git a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java index df5d18941..d144913d3 100644 --- a/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java +++ b/json/src/test/java/com/basistech/rosette/apimodel/ModelTest.java @@ -175,6 +175,7 @@ private Object createObject(Constructor ctor) { return o; } + //CHECKSTYLE:OFF private Object createObjectForType(Class type, Type genericParameterType) throws IllegalAccessException, InstantiationException, InvocationTargetException { Object o = null; @@ -216,7 +217,7 @@ private Object createObjectForType(Class type, Type genericParameterType) thr break; } case "String": - case "CharSequence":{ + case "CharSequence": { o = "foo"; break; } @@ -292,6 +293,7 @@ private Object createObjectForType(Class type, Type genericParameterType) thr } return o; } + //CHECKSTYLE:ON private boolean isListString(ParameterizedType parameterizedType) { return List.class.equals(parameterizedType.getRawType()) diff --git a/model/pom.xml b/model/pom.xml index b81d1e78e..9aa483b67 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 diff --git a/pom.xml b/pom.xml index 8b6792251..0502952d4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 com.basistech.rosette @@ -22,7 +22,7 @@ open-source-parent com.basistech - 0.1.2 + 1.1.4 pom @@ -179,24 +179,4 @@ - - - internal-release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-plugin-version} - true - - basistech.repo - http://nexus.basistech.net:8081/nexus/ - 1dd11ca8866422 - - - - - - diff --git a/release/pom.xml b/release/pom.xml index c8ee82852..e4b7149e5 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -1,6 +1,6 @@ +--> 4.0.0 From 300fc6f7d04743f67547e223997e6fd29500680e Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 15 Sep 2017 15:21:47 -0400 Subject: [PATCH 090/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.5 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index bc8b93b48..b4b79a185 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index c932b0c21..4f0a16e1d 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 4ea418312..c745a6afd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 0821de4fc..197162b6f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 9aa483b67..04ddc05ba 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 0502952d4..887d863b9 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.5 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index e4b7149e5..3be85a855 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5-SNAPSHOT + 1.7.5 com.basistech.rosette rosette-api-release From 750aff47e191870630f8b8c58920422ad728b775 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 15 Sep 2017 15:21:51 -0400 Subject: [PATCH 091/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b4b79a185..b66535366 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 4f0a16e1d..ce3b0d5a3 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index c745a6afd..f81ce4181 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 197162b6f..793eaa1c7 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 04ddc05ba..32d3b2ff2 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 887d863b9..e139a88cf 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.5 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 3be85a855..855b58eab 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.5 + 1.7.6-SNAPSHOT com.basistech.rosette rosette-api-release From 41a3823cb3a57c447f27432a3994a2c1e52473dc Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 12 Oct 2017 00:08:08 -0400 Subject: [PATCH 092/735] WS-1207: offsets in simple response --- .../apimodel/jackson/ApiModelMixinModule.java | 10 +- .../apimodel/jackson/EntityMentionMixin.java | 7 +- .../jackson/EntitySentimentMixin.java | 6 +- .../apimodel/jackson/MentionOffsetsMixin.java | 33 ++++ json/src/test/data/EntitiesResponse.json | 6 +- model/pom.xml | 6 + .../rosette/apimodel/EntityMention.java | 160 ++++++++---------- .../rosette/apimodel/EntitySentiment.java | 122 ++++--------- .../rosette/apimodel/MentionOffsets.java | 47 +++++ 9 files changed, 207 insertions(+), 190 deletions(-) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/MentionOffsetsMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 7fef5220a..f6756da3e 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -36,6 +36,9 @@ import com.basistech.rosette.apimodel.LanguageOptions; import com.basistech.rosette.apimodel.LanguageResponse; import com.basistech.rosette.apimodel.LanguageWeight; +import com.basistech.rosette.apimodel.LinkedEntitiesResponse; +import com.basistech.rosette.apimodel.LinkedEntity; +import com.basistech.rosette.apimodel.MentionOffsets; import com.basistech.rosette.apimodel.MorphologyOptions; import com.basistech.rosette.apimodel.MorphologyResponse; import com.basistech.rosette.apimodel.Name; @@ -95,17 +98,18 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(ConstantsResponse.class, ConstantsResponseMixin.class); context.setMixInAnnotations(EntitiesOptions.class, EntitiesOptionsMixin.class); context.setMixInAnnotations(EntitiesResponse.class, EntityResponseMixin.class); + context.setMixInAnnotations(EntityMention.class, EntityMentionMixin.class); context.setMixInAnnotations(EntitySentiment.class, EntitySentimentMixin.class); context.setMixInAnnotations(ErrorResponse.class, ErrorResponseMixin.class); - context.setMixInAnnotations(EntityMention.class, EntityMentionMixin.class); context.setMixInAnnotations(InfoResponse.class, InfoResponseMixin.class); context.setMixInAnnotations(LanguageDetectionResult.class, LanguageDetectionResultMixin.class); context.setMixInAnnotations(LanguageOptions.class, LanguageOptionsMixin.class); context.setMixInAnnotations(RegionDetectionResult.class, RegionDetectionResultMixin.class); context.setMixInAnnotations(LanguageResponse.class, LanguageResponseMixin.class); context.setMixInAnnotations(LanguageWeight.class, LanguageWeightMixin.class); - context.setMixInAnnotations(com.basistech.rosette.apimodel.LinkedEntity.class, LinkedEntityMixin.class); - context.setMixInAnnotations(com.basistech.rosette.apimodel.LinkedEntitiesResponse.class, LinkedEntityResponseMixin.class); + context.setMixInAnnotations(LinkedEntity.class, LinkedEntityMixin.class); + context.setMixInAnnotations(LinkedEntitiesResponse.class, LinkedEntityResponseMixin.class); + context.setMixInAnnotations(MentionOffsets.class, MentionOffsetsMixin.class); context.setMixInAnnotations(MorphologyOptions.class, MorphologyOptionsMixin.class); context.setMixInAnnotations(MorphologyResponse.class, MorphologyResponseMixin.class); context.setMixInAnnotations(Name.class, NameMixin.class); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java index a08f1b749..2cc5c4a13 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntityMentionMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,20 @@ package com.basistech.rosette.apimodel.jackson; +import com.basistech.rosette.apimodel.MentionOffsets; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + public class EntityMentionMixin extends BaseMixin { @JsonCreator public EntityMentionMixin( - @JsonProperty("indocChainId") Integer indocChainId, @JsonProperty("type") String type, @JsonProperty("mention") String mention, @JsonProperty("normalized") String normalized, @JsonProperty("count") Integer count, + @JsonProperty("mentionOffsets") List mentionOffsets, @JsonProperty("entityId") String entityId, @JsonProperty("confidence") Double confidence ) { diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java index 36877b0f9..2156ef1b3 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitySentimentMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2016 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,12 @@ package com.basistech.rosette.apimodel.jackson; import com.basistech.rosette.apimodel.Label; +import com.basistech.rosette.apimodel.MentionOffsets; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + /** * */ @@ -30,6 +33,7 @@ public EntitySentimentMixin( @JsonProperty("mention") String mention, @JsonProperty("normalized") String normalized, @JsonProperty("count") Integer count, + @JsonProperty("mentionOffsets") List mentionOffsets, @JsonProperty("entityId") String entityId, @JsonProperty("confidence") Double confidence, @JsonProperty("sentiment") Label sentiment) { diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/MentionOffsetsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/MentionOffsetsMixin.java new file mode 100644 index 000000000..2d998ef2d --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/MentionOffsetsMixin.java @@ -0,0 +1,33 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * + */ +public class MentionOffsetsMixin extends BaseMixin { + @JsonCreator + public MentionOffsetsMixin( + @JsonProperty("startOffset") Integer startOffset, + @JsonProperty("endOffset") Integer endOffset) { + // + } +} diff --git a/json/src/test/data/EntitiesResponse.json b/json/src/test/data/EntitiesResponse.json index 108999c61..2d52cbde0 100644 --- a/json/src/test/data/EntitiesResponse.json +++ b/json/src/test/data/EntitiesResponse.json @@ -5,7 +5,11 @@ "indocChainId": 0, "mention": "Samsung", "normalized": "Samsung", - "type": "ORGANIZATION" + "type": "ORGANIZATION", + "mentionOffsets": [ + {"startOffset": 15, "endOffset": 22}, + {"startOffset": 88, "endOffset": 95} + ] } ] } diff --git a/model/pom.xml b/model/pom.xml index 32d3b2ff2..47847f604 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -38,6 +38,12 @@ com.basistech adm-model + + org.projectlombok + lombok + 1.16.16 + provided + diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java index 37c2fbde7..72d2df544 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,60 @@ package com.basistech.rosette.apimodel; -import java.util.Objects; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +import java.util.List; /** * An entity mention found in a document. * The /entities endpoint returns a collection of entity mentions. */ -public final class EntityMention { +@Getter @EqualsAndHashCode +public class EntityMention { + /** + * in-document entity chain id + * @return the id + */ + @Deprecated private final Integer indocChainId; + + /** + * @return the entity type + */ private final String type; + + /** + * @return the entity mention text + */ private final String mention; + + /** + * @return the normalized entity mention text + */ private final String normalized; + + /** + * @return the entity mention count + */ private final Integer count; + + /** + * @return the list of offsets for all mentions + */ + private final List mentionOffsets; + + /** + * @return the ID of this entity. If this entity was linked to a knowledge base, + * the resulting string will begin with 'Q'. If it was not linked to a knowledge base, + * it will begin with a 'T'. 'T' identifiers represent intra-document co-references. + */ private final String entityId; + + /** + * @return the confidence score for the entity (0.0-1.0) + */ private final Double confidence; /** @@ -51,13 +91,7 @@ public EntityMention( String entityId, Double confidence ) { - this.indocChainId = indocChainId; - this.type = type; - this.mention = mention; - this.normalized = normalized; - this.count = count; - this.entityId = entityId; - this.confidence = confidence; + this(type, mention, normalized, count, null, entityId, confidence); } /** @@ -68,6 +102,7 @@ public EntityMention( * @param entityId if the entity was linked, the ID from the knowledge base. * @param count mention count */ + @Deprecated public EntityMention( String type, String mention, @@ -75,6 +110,28 @@ public EntityMention( String entityId, Integer count, Double confidence + ) { + this(type, mention, normalized, count, null, entityId, confidence); + } + + /** + * constructor for {@code EntityMention} + * @param type entity type + * @param mention mention text + * @param normalized normalized mention text + * @param entityId if the entity was linked, the ID from the knowledge base. + * @param count mention count + * @param mentionOffsets list of mention offsets + * @param confidence entity extraction confidence score + */ + public EntityMention( + String type, + String mention, + String normalized, + Integer count, + List mentionOffsets, + String entityId, + Double confidence ) { this.indocChainId = null; this.type = type; @@ -82,88 +139,7 @@ public EntityMention( this.normalized = normalized; this.entityId = entityId; this.count = count; + this.mentionOffsets = mentionOffsets; this.confidence = confidence; } - - /** - * get the in-document entity chain id - * @return the id - */ - @Deprecated - public Integer getIndocChainId() { - return indocChainId; - } - - /** - * get the entity type - * @return the entity type - */ - public String getType() { - return type; - } - - /** - * get the mention text - * @return the mention text - */ - public String getMention() { - return mention; - } - - /** - * get the normalized mention text - * @return the normalized mention text - */ - public String getNormalized() { - return normalized; - } - - /** - * get the mention count - * @return the mention count - */ - public Integer getCount() { - return count; - } - - /** - * get the entity knowledge base ID. - * @return the ID of this entity. If this entity was linked to a knowledge base, - * the resulting string will begin with 'Q'. If it was not linked to a knowledge base, - * it will begin with a 'T'. 'T' identifiers represent intra-document co-references. - */ - public String getEntityId() { - return entityId; - } - - /** - * get the confidence score for the entity. - * @return the confidence score (0.0-1.0) - */ - public Double getConfidence() { - return confidence; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EntityMention that = (EntityMention) o; - return Objects.equals(indocChainId, that.indocChainId) - && Objects.equals(type, that.type) - && Objects.equals(mention, that.mention) - && Objects.equals(normalized, that.normalized) - && Objects.equals(count, that.count) - && Objects.equals(entityId, that.entityId) - && Objects.equals(confidence, that.confidence); - } - - @Override - public int hashCode() { - return Objects.hash(indocChainId, type, mention, normalized, count, entityId, confidence); - } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java index f7cebcaa0..5347c736b 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java @@ -17,18 +17,20 @@ package com.basistech.rosette.apimodel; -import java.util.Objects; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +import java.util.List; /** * Per-entity sentiment info. */ -public final class EntitySentiment { - private final String type; - private final String mention; - private final String normalized; - private final Integer count; - private final String entityId; - private final Double confidence; +@Getter @EqualsAndHashCode +public final class EntitySentiment extends EntityMention { + + /** + * @return the sentiment information. + */ private final Label sentiment; /** @@ -41,6 +43,7 @@ public final class EntitySentiment { * @param confidence entity confidence. * @param sentiment the sentiment information. */ + @Deprecated public EntitySentiment(String type, String mention, String normalized, @@ -48,92 +51,29 @@ public EntitySentiment(String type, String entityId, Double confidence, Label sentiment) { - this.type = type; - this.mention = mention; - this.normalized = normalized; - this.count = count; - this.entityId = entityId; - this.confidence = confidence; - this.sentiment = sentiment; - } - - /** - * get the entity type - * @return the entity type - */ - public String getType() { - return type; - } - - /** - * get the mention text - * @return the mention text - */ - public String getMention() { - return mention; - } - - /** - * get the normalized mention text - * @return the normalized mention text - */ - public String getNormalized() { - return normalized; - } - - /** - * get the mention count - * @return the mention count - */ - public Integer getCount() { - return count; - } - - /** - * get the entity knowledge base ID. - * @return the ID of this entity. If this entity was linked to a knowledge base, - * the resulting string will begin with 'Q'. If it was not linked to a knowledge base, - * it will begin with a 'T'. 'T' identifiers represent intra-document co-references. - */ - public String getEntityId() { - return entityId; + this(type, mention, normalized, count, null, entityId, confidence, sentiment); } /** - * get the entity confidence - * @return the entity confidence - */ - public Double getConfidence() { - return confidence; - } - - /** - * @return the sentiment information. + * constructor for {@code EntitySentiment} + * @param type entity type + * @param mention mention text + * @param normalized normalized mention text + * @param count mention count + * @param mentionOffsets mention offsets + * @param entityId if the entity was linked, the ID from the knowledge base. + * @param confidence entity confidence. + * @param sentiment the sentiment information. */ - public Label getSentiment() { - return sentiment; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EntitySentiment that = (EntitySentiment) o; - return Objects.equals(type, that.type) - && Objects.equals(mention, that.mention) - && Objects.equals(normalized, that.normalized) - && Objects.equals(count, that.count) - && Objects.equals(entityId, that.entityId) - && Objects.equals(confidence, that.confidence) - && Objects.equals(sentiment, that.sentiment); - } - - @Override - public int hashCode() { - return Objects.hash(type, mention, normalized, count, entityId, confidence, sentiment); + public EntitySentiment(String type, + String mention, + String normalized, + Integer count, + List mentionOffsets, + String entityId, + Double confidence, + Label sentiment) { + super(type, mention, normalized, count, mentionOffsets, entityId, confidence); + this.sentiment = sentiment; } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java b/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java new file mode 100644 index 000000000..d6a396206 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java @@ -0,0 +1,47 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import lombok.EqualsAndHashCode; +import lombok.Getter; + +/** + * The start and end offset/index for a given mention in a string of text + */ +@Getter @EqualsAndHashCode +public class MentionOffsets { + + /** + * @returns the offset for the first character of a mention, based on UTF-16 code page + */ + private Integer startOffset; + + /** + * @returns the offset for the last character of a mention, based on UTF-16 code page + */ + private Integer endOffset; + + /** + * constructor for {@code MentionOffsets} + * @param startOffset offset for the first character of a mention + * @param endOffset offset for the last character of a mention + */ + public MentionOffsets(Integer startOffset, Integer endOffset) { + this.startOffset = startOffset; + this.endOffset = endOffset; + } +} From f327293cbb410ba1b800a920d00e2609d4bef471 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 12 Oct 2017 02:25:31 -0400 Subject: [PATCH 093/735] WS-1207: silence PMD --- .../main/java/com/basistech/rosette/apimodel/EntityMention.java | 1 + .../java/com/basistech/rosette/apimodel/EntitySentiment.java | 1 + .../main/java/com/basistech/rosette/apimodel/MentionOffsets.java | 1 + 3 files changed, 3 insertions(+) diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java index 72d2df544..9e22e2a10 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java @@ -25,6 +25,7 @@ * An entity mention found in a document. * The /entities endpoint returns a collection of entity mentions. */ +@SuppressWarnings("PMD") @Getter @EqualsAndHashCode public class EntityMention { diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java index 5347c736b..ed2d5abc6 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java @@ -25,6 +25,7 @@ /** * Per-entity sentiment info. */ +@SuppressWarnings("PMD") @Getter @EqualsAndHashCode public final class EntitySentiment extends EntityMention { diff --git a/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java b/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java index d6a396206..a4619860c 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/MentionOffsets.java @@ -22,6 +22,7 @@ /** * The start and end offset/index for a given mention in a string of text */ +@SuppressWarnings("PMD") @Getter @EqualsAndHashCode public class MentionOffsets { From 7d5ac92d4075c749bf37d9d9da26d7b6052170e1 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 12 Oct 2017 15:21:19 -0400 Subject: [PATCH 094/735] No-Jira: version bump for 1.9 dev --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b66535366..28cf13fa0 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index ce3b0d5a3..765d65946 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index f81ce4181..471f63139 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 793eaa1c7..d3e6cca20 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 47847f604..c0e640e77 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index e139a88cf..15769d725 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 855b58eab..38317803c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.8.100-SNAPSHOT com.basistech.rosette rosette-api-release From a3e6b961f3cbf1695d60f1a1d4be563b7cf50590 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 12 Oct 2017 16:45:37 -0400 Subject: [PATCH 095/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.8.100 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 28cf13fa0..0b9d53849 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 765d65946..f89979a2c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 471f63139..78ac793bc 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index d3e6cca20..fc5b59fb3 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c0e640e77..cda31ba13 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 15769d725..9050aa821 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.8.100 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 38317803c..ebbb198e1 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100-SNAPSHOT + 1.8.100 com.basistech.rosette rosette-api-release From 77d4652e16b22ea4237ce89a6e4633bc41413930 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Thu, 12 Oct 2017 16:45:42 -0400 Subject: [PATCH 096/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0b9d53849..823c42a18 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index f89979a2c..d6e699f0c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 78ac793bc..39a51ced9 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index fc5b59fb3..73cbf97f1 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index cda31ba13..6320b975e 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 9050aa821..e236df2d2 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.8.100 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index ebbb198e1..06f391556 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.100 + 1.8.101-SNAPSHOT com.basistech.rosette rosette-api-release From 7dea4c7fb3cb48bbc91840636bc0cd708ba35f76 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Fri, 13 Oct 2017 23:30:10 -0400 Subject: [PATCH 097/735] WS-1220: add salience option (#107) * WS-1220: add salience option * WS-1220: checkstyle * WS-1220: checkstyle again --- .../jackson/EntitiesOptionsMixin.java | 1 + .../jackson/SentimentOptionsMixin.java | 3 +- .../rosette/apimodel/EntitiesOptions.java | 32 +++++++++++-- .../rosette/apimodel/EntityMention.java | 47 ++++++++++++++++++- .../rosette/apimodel/EntitySentiment.java | 35 +++++++++++++- .../rosette/apimodel/SentimentOptions.java | 32 +++++++++++-- 6 files changed, 136 insertions(+), 14 deletions(-) diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java index 72aa2180f..c373f10b9 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/EntitiesOptionsMixin.java @@ -25,6 +25,7 @@ public final class EntitiesOptionsMixin extends OptionsMixin { @JsonCreator private EntitiesOptionsMixin( @JsonProperty("calculateConfidence") Boolean calculateConfidence, + @JsonProperty("calculateSalience") Boolean calculateSalience, @JsonProperty("linkEntities") Boolean linkEntities ) { // diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java index 440e3c601..6d72b1d21 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/SentimentOptionsMixin.java @@ -24,7 +24,8 @@ public abstract class SentimentOptionsMixin extends OptionsMixin { @JsonCreator protected SentimentOptionsMixin( - @JsonProperty("calculateEntityConfidence") Boolean calculateEntityConfidence + @JsonProperty("calculateEntityConfidence") Boolean calculateEntityConfidence, + @JsonProperty("calculateEntitySalience") Boolean calculateEntitySalience ) { // } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java index 0d608e03b..ba60f1ee5 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java @@ -23,8 +23,9 @@ */ public final class EntitiesOptions extends Options { - public static final EntitiesOptions DEFAULT_OPTIONS = new EntitiesOptions(false, true); + public static final EntitiesOptions DEFAULT_OPTIONS = new EntitiesOptions(false, false, true); private Boolean calculateConfidence; + private Boolean calculateSalience; private Boolean linkEntities; /** @@ -33,8 +34,9 @@ public final class EntitiesOptions extends Options { * @param calculateConfidence return confidence score for the extraction. * @param linkEntities perform entity linking in addition to extraction. */ - protected EntitiesOptions(Boolean calculateConfidence, Boolean linkEntities) { + protected EntitiesOptions(Boolean calculateConfidence, Boolean calculateSalience, Boolean linkEntities) { this.calculateConfidence = calculateConfidence; + this.calculateSalience = calculateSalience; this.linkEntities = linkEntities; } @@ -52,6 +54,13 @@ public Boolean getCalculateConfidence() { return calculateConfidence; } + /** + * @return the calculateSalience flag. + */ + public Boolean getCalculateSalience() { + return calculateSalience; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -62,16 +71,18 @@ public boolean equals(Object o) { } EntitiesOptions that = (EntitiesOptions) o; return Objects.equals(linkEntities, that.linkEntities) - && Objects.equals(calculateConfidence, that.calculateConfidence); + && Objects.equals(calculateConfidence, that.calculateConfidence) + && Objects.equals(calculateSalience, that.calculateSalience); } @Override public int hashCode() { - return Objects.hash(calculateConfidence, linkEntities); + return Objects.hash(calculateConfidence, calculateSalience, linkEntities); } public static class Builder { private Boolean calculateConfidence; + private Boolean calculateSalience; private Boolean linkEntities; public Builder() { @@ -89,6 +100,17 @@ public Builder calculateConfidence(Boolean calculateConfidence) { return this; } + /** + * DocumentRequest calculate salience score. If the value is {@code true}, then the endpoint will + * return salience scores. If {@code false} or {@code null}, not. + * @param calculateSalience whether to get salience score. + * @return this. + */ + public Builder calculateSalience(Boolean calculateSalience) { + this.calculateSalience = calculateSalience; + return this; + } + /** * DocumentRequest entity linking. If the value is {@code true}, then the the endpoint will link entities to the * knowledge base. If {@code false}, not. If {@code null}, the endpoint will perform default processing. @@ -101,7 +123,7 @@ public Builder linkEntities(Boolean linkEntities) { } public EntitiesOptions build() { - return new EntitiesOptions(calculateConfidence, linkEntities); + return new EntitiesOptions(calculateConfidence, calculateSalience, linkEntities); } } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java index 37c2fbde7..06db9d938 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntityMention.java @@ -31,6 +31,7 @@ public final class EntityMention { private final Integer count; private final String entityId; private final Double confidence; + private final Double salience; /** * constructor for {@code EntityMention} @@ -40,6 +41,7 @@ public final class EntityMention { * @param normalized normalized mention text * @param count mention count * @param entityId if the entity was linked, the ID from the knowledge base. + * @param confidence entity confidence */ @Deprecated public EntityMention( @@ -58,6 +60,7 @@ public EntityMention( this.count = count; this.entityId = entityId; this.confidence = confidence; + this.salience = null; } /** @@ -67,6 +70,7 @@ public EntityMention( * @param normalized normalized mention text * @param entityId if the entity was linked, the ID from the knowledge base. * @param count mention count + * @param confidence entity confidence */ public EntityMention( String type, @@ -83,6 +87,36 @@ public EntityMention( this.entityId = entityId; this.count = count; this.confidence = confidence; + this.salience = null; + } + + /** + * constructor for {@code EntityMention} + * @param type entity type + * @param mention mention text + * @param normalized normalized mention text + * @param entityId if the entity was linked, the ID from the knowledge base. + * @param count mention count + * @param confidence entity confidence + * @param salience entity salience + */ + public EntityMention( + String type, + String mention, + String normalized, + String entityId, + Integer count, + Double confidence, + Double salience + ) { + this.indocChainId = null; + this.type = type; + this.mention = mention; + this.normalized = normalized; + this.entityId = entityId; + this.count = count; + this.confidence = confidence; + this.salience = salience; } /** @@ -144,6 +178,14 @@ public Double getConfidence() { return confidence; } + /** + * get the salience score for the entity. + * @return the salience score (0.0-1.0) + */ + public Double getSalience() { + return salience; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -159,11 +201,12 @@ public boolean equals(Object o) { && Objects.equals(normalized, that.normalized) && Objects.equals(count, that.count) && Objects.equals(entityId, that.entityId) - && Objects.equals(confidence, that.confidence); + && Objects.equals(confidence, that.confidence) + && Objects.equals(salience, that.salience); } @Override public int hashCode() { - return Objects.hash(indocChainId, type, mention, normalized, count, entityId, confidence); + return Objects.hash(indocChainId, type, mention, normalized, count, entityId, confidence, salience); } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java index f7cebcaa0..12aead6ee 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/EntitySentiment.java @@ -29,6 +29,7 @@ public final class EntitySentiment { private final Integer count; private final String entityId; private final Double confidence; + private final Double salience; private final Label sentiment; /** @@ -48,12 +49,35 @@ public EntitySentiment(String type, String entityId, Double confidence, Label sentiment) { + this(type, mention, normalized, count, entityId, confidence, null, sentiment); + } + + /** + * constructor for {@code EntitySentiment} + * @param type entity type + * @param mention mention text + * @param normalized normalized mention text + * @param count mention count + * @param entityId if the entity was linked, the ID from the knowledge base. + * @param confidence entity confidence. + * @param salience entity salience. + * @param sentiment the sentiment information. + */ + public EntitySentiment(String type, + String mention, + String normalized, + Integer count, + String entityId, + Double confidence, + Double salience, + Label sentiment) { this.type = type; this.mention = mention; this.normalized = normalized; this.count = count; this.entityId = entityId; this.confidence = confidence; + this.salience = salience; this.sentiment = sentiment; } @@ -107,6 +131,14 @@ public Double getConfidence() { return confidence; } + /** + * get the entity salience + * @return the entity salience + */ + public Double getSalience() { + return salience; + } + /** * @return the sentiment information. */ @@ -129,11 +161,12 @@ public boolean equals(Object o) { && Objects.equals(count, that.count) && Objects.equals(entityId, that.entityId) && Objects.equals(confidence, that.confidence) + && Objects.equals(salience, that.salience) && Objects.equals(sentiment, that.sentiment); } @Override public int hashCode() { - return Objects.hash(type, mention, normalized, count, entityId, confidence, sentiment); + return Objects.hash(type, mention, normalized, count, entityId, confidence, salience, sentiment); } } diff --git a/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java index 269787d35..bf5dbd749 100644 --- a/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java +++ b/model/src/main/java/com/basistech/rosette/apimodel/SentimentOptions.java @@ -22,16 +22,18 @@ * Sentiment options. */ public final class SentimentOptions extends Options { - public static final SentimentOptions DEGAULT_OPTIONS = new SentimentOptions(false); + public static final SentimentOptions DEGAULT_OPTIONS = new SentimentOptions(false, false); private Boolean calculateEntityConfidence; + private Boolean calculateEntitySalience; /** * Constructor for {@code SentimentOptions} * * @param calculateEntityConfidence return confidence score for the entities. */ - protected SentimentOptions(Boolean calculateEntityConfidence) { + protected SentimentOptions(Boolean calculateEntityConfidence, Boolean calculateEntitySalience) { this.calculateEntityConfidence = calculateEntityConfidence; + this.calculateEntitySalience = calculateEntitySalience; } /** @@ -41,6 +43,13 @@ public Boolean getCalculateEntityConfidence() { return calculateEntityConfidence; } + /** + * @return the calculateEntitySalience flag. + */ + public Boolean getCalculateEntitySalience() { + return calculateEntitySalience; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -50,16 +59,18 @@ public boolean equals(Object o) { return false; } SentimentOptions that = (SentimentOptions)o; - return Objects.equals(this.calculateEntityConfidence, that.calculateEntityConfidence); + return Objects.equals(this.calculateEntityConfidence, that.calculateEntityConfidence) + && Objects.equals(this.calculateEntitySalience, that.calculateEntitySalience); } @Override public int hashCode() { - return Objects.hash(calculateEntityConfidence); + return Objects.hash(calculateEntityConfidence, calculateEntitySalience); } public static class Builder { private Boolean calculateEntityConfidence; + private Boolean calculateEntitySalience; /** * DocumentRequest calculate entity confidence score. If the value is {@code true}, then the endpoint will @@ -72,8 +83,19 @@ public Builder calculateEntityConfidence(Boolean calculateEntityConfidence) { return this; } + /** + * DocumentRequest calculate entity salience score. If the value is {@code true}, then the endpoint will + * return salience scores. If {@code false} or {@code null}, not. + * @param calculateEntitySalience whether to get entity salience score. + * @return this. + */ + public Builder calculateEntitySalience(Boolean calculateEntitySalience) { + this.calculateEntitySalience = calculateEntitySalience; + return this; + } + public SentimentOptions build() { - return new SentimentOptions(calculateEntityConfidence); + return new SentimentOptions(calculateEntityConfidence, calculateEntitySalience); } } } From c821069776680efec226d99eac6f28553dc88a64 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Fri, 13 Oct 2017 23:33:34 -0400 Subject: [PATCH 098/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.7.6 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b66535366..0af04d7fe 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index ce3b0d5a3..c03d0ec61 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index f81ce4181..3df353740 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 793eaa1c7..0616f38b7 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 32d3b2ff2..6a6279911 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index e139a88cf..34845d77c 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.7.6 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 855b58eab..396906486 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6-SNAPSHOT + 1.7.6 com.basistech.rosette rosette-api-release From 99513e0857cce8a67d5d6eeb505e584b459991c6 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Fri, 13 Oct 2017 23:33:38 -0400 Subject: [PATCH 099/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 0af04d7fe..2cbbe7ea3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index c03d0ec61..a7850acb2 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 3df353740..8ef40af85 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 0616f38b7..04eb14ad5 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 6a6279911..f578db4a5 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 34845d77c..a5967199a 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.7.6 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 396906486..885e54096 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.7.6 + 1.7.7-SNAPSHOT com.basistech.rosette rosette-api-release From 6286fe1438a1e2ab8934a000532bb175f7184075 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Mon, 16 Oct 2017 21:15:37 -0400 Subject: [PATCH 100/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.8.101 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 823c42a18..646a5fc86 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index d6e699f0c..c98d958e7 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 39a51ced9..6c58fbe3d 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 73cbf97f1..15e60a700 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 6320b975e..53ddc6cbd 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index e236df2d2..0759d06cf 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.8.101 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 06f391556..78aea1c1f 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101-SNAPSHOT + 1.8.101 com.basistech.rosette rosette-api-release From 16c2518fa27e403f7d6a53a6ea5719ffc0fc20d1 Mon Sep 17 00:00:00 2001 From: Li Xu Date: Mon, 16 Oct 2017 21:15:42 -0400 Subject: [PATCH 101/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 646a5fc86..98cccd810 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index c98d958e7..b237424e4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 6c58fbe3d..912c71493 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 15e60a700..1334f2f98 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 53ddc6cbd..b15be8cec 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 0759d06cf..f644661c8 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.8.101 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 78aea1c1f..d75305de0 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.101 + 1.8.102-SNAPSHOT com.basistech.rosette rosette-api-release From ca55857480754b01d7c6176d49be2411afe9ac08 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Thu, 19 Oct 2017 13:01:30 -0400 Subject: [PATCH 102/735] RD-2101 expose salience threshold option for topics (#105) * RD-2101 expose salience threshold option for topics * RD-2101 correct file header * RD-2101 typo --- .../apimodel/jackson/ApiModelMixinModule.java | 2 + .../apimodel/jackson/TopicsOptionsMixin.java | 27 ++++++ .../rosette/apimodel/TopicsOptions.java | 84 +++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsOptionsMixin.java create mode 100644 model/src/main/java/com/basistech/rosette/apimodel/TopicsOptions.java diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index f6756da3e..cd0f3cf52 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -62,6 +62,7 @@ import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; import com.basistech.rosette.apimodel.TextEmbeddingResponse; import com.basistech.rosette.apimodel.TokensResponse; +import com.basistech.rosette.apimodel.TopicsOptions; import com.basistech.rosette.apimodel.TopicsResponse; import com.basistech.rosette.apimodel.TransliterationOptions; import com.basistech.rosette.apimodel.TransliterationResponse; @@ -132,6 +133,7 @@ public void setupModule(Module.SetupContext context) { context.setMixInAnnotations(Options.class, OptionsMixin.class); context.setMixInAnnotations(TransliterationOptions.class, TransliterationOptionsMixin.class); context.setMixInAnnotations(TransliterationResponse.class, TransliterationResponseMixin.class); + context.setMixInAnnotations(TopicsOptions.class, TopicsOptionsMixin.class); context.setMixInAnnotations(TopicsResponse.class, TopicsResponseMixin.class); context.setMixInAnnotations(Keyphrase.class, KeyphraseMixin.class); context.setMixInAnnotations(Concept.class, ConceptMixin.class); diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsOptionsMixin.java new file mode 100644 index 000000000..46b5215be --- /dev/null +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/TopicsOptionsMixin.java @@ -0,0 +1,27 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel.jackson; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class TopicsOptionsMixin extends BaseMixin { + @JsonCreator + protected TopicsOptionsMixin(@JsonProperty("conceptSalienceThreshold") final Double conceptSalienceThreshold, + @JsonProperty("keyphraseSalienceThreshold") final Double keyphraseSalienceThreshold) { + // + } +} diff --git a/model/src/main/java/com/basistech/rosette/apimodel/TopicsOptions.java b/model/src/main/java/com/basistech/rosette/apimodel/TopicsOptions.java new file mode 100644 index 000000000..42fa0f578 --- /dev/null +++ b/model/src/main/java/com/basistech/rosette/apimodel/TopicsOptions.java @@ -0,0 +1,84 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.apimodel; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import java.util.Objects; + +public final class TopicsOptions extends Options { + @DecimalMin("0.0") + @DecimalMax("1.0") + private Double conceptSalienceThreshold; + @DecimalMin("0.0") + @DecimalMax("1.0") + private Double keyphraseSalienceThreshold; + + public TopicsOptions(Double conceptSalienceThreshold, Double keyphraseSalienceThreshold) { + this.conceptSalienceThreshold = conceptSalienceThreshold; + this.keyphraseSalienceThreshold = keyphraseSalienceThreshold; + } + + public Double getconceptSalienceThreshold() { + return conceptSalienceThreshold; + } + + public Double getkeyphraseSalienceThreshold() { + return keyphraseSalienceThreshold; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } else if (obj == null || getClass() != obj.getClass()) { + return false; + } + final TopicsOptions that = (TopicsOptions) obj; + return Objects.equals(conceptSalienceThreshold, that.conceptSalienceThreshold) + && Objects.equals(keyphraseSalienceThreshold, that.keyphraseSalienceThreshold); + } + + @Override + public int hashCode() { + return Objects.hash(conceptSalienceThreshold, keyphraseSalienceThreshold); + } + + public static class Builder { + private Double conceptSalienceThreshold; + private Double keyphraseSalienceThreshold; + + public Builder() { + // + } + + public Builder conceptSalienceThreshold(Double conceptSalienceThreshold) { + this.conceptSalienceThreshold = conceptSalienceThreshold; + return this; + } + + + public Builder keyphraseSalienceThreshold(Double keyphraseSalienceThreshold) { + this.keyphraseSalienceThreshold = keyphraseSalienceThreshold; + return this; + } + + public TopicsOptions build() { + return new TopicsOptions(conceptSalienceThreshold, keyphraseSalienceThreshold); + } + } + +} From 59b22a666ec862433b5af43629a63e7913025a38 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Fri, 20 Oct 2017 17:44:18 -0400 Subject: [PATCH 103/735] Rd 2101 internal release (#108) * [maven-release-plugin] prepare release rosette-api-java-binding-1.8.102 * [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 98cccd810..6a5b6c92f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index b237424e4..6a02d687d 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 912c71493..baae79a7b 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 1334f2f98..704df2f74 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index b15be8cec..4c1e149fc 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index f644661c8..24d65f6bc 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index d75305de0..501ec3222 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.102-SNAPSHOT + 1.8.103-SNAPSHOT com.basistech.rosette rosette-api-release From 9392d0edc23217272c9f68bc442a688728204c63 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 24 Oct 2017 10:55:54 -0400 Subject: [PATCH 104/735] Preparing release. Version set to 1.8.0-SNAPSHOT --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 2 +- release/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6a5b6c92f..b920bfb38 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 6a02d687d..1e98f40cc 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index baae79a7b..21933f13e 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 704df2f74..43d4ecd53 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 4c1e149fc..c2b421680 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 24d65f6bc..2e4869b30 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT open-source-parent com.basistech diff --git a/release/pom.xml b/release/pom.xml index 501ec3222..b58ee20c1 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.103-SNAPSHOT + 1.8.0-SNAPSHOT com.basistech.rosette rosette-api-release From 8b934248e097d41ed715c019a076aa47196f54f0 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 24 Oct 2017 11:00:09 -0400 Subject: [PATCH 105/735] [maven-release-plugin] prepare release rosette-api-java-binding-1.8.0 --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b920bfb38..2035b94ab 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 1e98f40cc..16d7d7d9f 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 21933f13e..41bed0f94 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index 43d4ecd53..c6ef8f17f 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index c2b421680..234a2881b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 2e4869b30..577b51db7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - HEAD + rosette-api-java-binding-1.8.0 This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index b58ee20c1..91b2f6c5c 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0-SNAPSHOT + 1.8.0 com.basistech.rosette rosette-api-release From 67e86999bef23e4faace827dc65727e1318fe573 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 24 Oct 2017 11:00:17 -0400 Subject: [PATCH 106/735] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- json/pom.xml | 2 +- model/pom.xml | 2 +- pom.xml | 4 ++-- release/pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 2035b94ab..646704349 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT rosette-api rosette-api diff --git a/common/pom.xml b/common/pom.xml index 16d7d7d9f..f33eb6024 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT rosette-api-common rosette-api-common diff --git a/examples/pom.xml b/examples/pom.xml index 41bed0f94..ae1135bab 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT com.basistech.rosette rosette-api-examples diff --git a/json/pom.xml b/json/pom.xml index c6ef8f17f..5c7715031 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -20,7 +20,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT rosette-api-json rosette-api-json diff --git a/model/pom.xml b/model/pom.xml index 234a2881b..120f720c8 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT rosette-api-model rosette-api-model diff --git a/pom.xml b/pom.xml index 577b51db7..0ee8a966e 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT open-source-parent com.basistech @@ -31,7 +31,7 @@ scm:git:git@github.com:rosette-api/java.git scm:git:git@github.com:rosette-api/java.git - rosette-api-java-binding-1.8.0 + HEAD This is the Java binding for the Rosette API. The classes in diff --git a/release/pom.xml b/release/pom.xml index 91b2f6c5c..03ac3ade7 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -19,7 +19,7 @@ com.basistech.rosette rosette-api-java-binding - 1.8.0 + 1.8.1-SNAPSHOT com.basistech.rosette rosette-api-release From 200eb3b62fb1e2a27c932b9827a755f6be54e50d Mon Sep 17 00:00:00 2001 From: Chris Park Date: Fri, 27 Oct 2017 11:02:03 -0400 Subject: [PATCH 107/735] --no-cache Jenkinsfile.examples --- Jenkinsfile.examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.examples b/Jenkinsfile.examples index 5b6632cdf..96e381eaa 100644 --- a/Jenkinsfile.examples +++ b/Jenkinsfile.examples @@ -12,7 +12,7 @@ node { } stage("Build Dockerfile") { dir ("${DOCKERFILE_DIR}") { - docker.build("${TEST_CONTAINER}") + sh "docker build --no-cache -t ${TEST_CONTAINER} ." } } stage("Run Examples") { From 49a9e8e0f8900c48f3bd3ccb27aa97326f193e64 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Fri, 27 Oct 2017 14:10:07 -0400 Subject: [PATCH 108/735] Jenkinsfiles - updated to look for upstream ALT_URL --- Jenkinsfile | 4 +++- Jenkinsfile.examples | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 791d01cbb..885cb9696 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,9 @@ node { checkout scm } stage("Test with Docker") { - withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { + echo "${env.ALT_URL}" + def useUrl = ("${env.ALT_URL}" == "null") ? "${env.BINDING_TEST_URL}" : "${env.ALT_URL}" + withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${useUrl}"]) { sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosetteapi/docker-java" } } diff --git a/Jenkinsfile.examples b/Jenkinsfile.examples index 96e381eaa..d0b8d4246 100644 --- a/Jenkinsfile.examples +++ b/Jenkinsfile.examples @@ -16,7 +16,9 @@ node { } } stage("Run Examples") { - withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { + echo "${env.ALT_URL}" + def useUrl = ("${env.ALT_URL}" == "null") ? "${env.BINDING_TEST_URL}" : "${env.ALT_URL}" + withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${useUrl}"]) { sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -e VERSION=${PUBLISHED_VERSION} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}" } } From 92ee9c54708cebdf52d833f294ea5a15b878ced5 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Mon, 4 Dec 2017 10:27:06 -0500 Subject: [PATCH 109/735] WS-1236 Updated site.xml - Bumped skin to 1.5 in order to resolve "missing" site decoration template Just a major.minor - 1.5 not 1.5.0 Change to place version in parent pom --- pom.xml | 7 ++++--- src/site/site.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 0ee8a966e..98cf41f64 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,13 @@ + + 4.0.0 + + com.basistech.rosette + rosette-api-java-binding + 1.8.106-SNAPSHOT + + rosette-api-annotations + rosette-api-annotations + Rosette API Annotations + + + com.fasterxml.jackson.core + jackson-annotations + provided + + + com.fasterxml.jackson.core + jackson-databind + provided + + + com.squareup + javapoet + 1.9.0 + provided + + + org.projectlombok + lombok + 1.16.18 + provided + + + + + + biz.aQute.bnd + bnd-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + -proc:none + + + + org.apache.maven.plugins + maven-jar-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + + diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java b/annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixin.java similarity index 63% rename from json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java rename to annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixin.java index 5466ff90f..c52b96a3d 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/TransliterationOptionsMixin.java +++ b/annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixin.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package com.basistech.rosette.apimodel.jackson; +package com.basistech.rosette.annotations; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; -public class TransliterationOptionsMixin extends BaseMixin { - @JsonCreator - protected TransliterationOptionsMixin(@JsonProperty("reversed") final Boolean reversed) { - // - } -} +@Retention(RetentionPolicy.SOURCE) +@Target(ElementType.TYPE) +public @interface JacksonMixin { +} \ No newline at end of file diff --git a/annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixinProcessor.java b/annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixinProcessor.java new file mode 100644 index 000000000..aaf10e684 --- /dev/null +++ b/annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixinProcessor.java @@ -0,0 +1,145 @@ +/* +* Copyright 2017 Basis Technology Corp. +* +* 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.basistech.rosette.annotations; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.squareup.javapoet.AnnotationSpec; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeSpec; +import lombok.Builder; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.ProcessingEnvironment; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class JacksonMixinProcessor extends AbstractProcessor { + + private static final String PACKAGE_NAME = "com.basistech.rosette.apimodel.jackson"; + + private ProcessingEnvironment processingEnvironment; + + @Override + public synchronized void init(ProcessingEnvironment processingEnvironment) { + super.init(processingEnvironment); + this.processingEnvironment = processingEnvironment; + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnvironment) { + if (roundEnvironment.getElementsAnnotatedWith(JacksonMixin.class).isEmpty()) { + return true; + } + Map addMixinCode = new HashMap<>(); + for (Element element : roundEnvironment.getElementsAnnotatedWith(JacksonMixin.class)) { + if (element.getKind() != ElementKind.CLASS) { + processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "Annotation only available to Class"); + continue; + } + TypeElement typeElement = (TypeElement) element; + String elementQualifiedName = typeElement.getQualifiedName().toString(); + String elementSimpleName = typeElement.getSimpleName().toString(); + if (typeElement.getAnnotation(Builder.class) != null) { + TypeSpec.Builder mixinClassBuilder = TypeSpec + .classBuilder(typeElement.getSimpleName().toString() + "Mixin") + .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) + .addAnnotation(AnnotationSpec.builder(JsonTypeName.class) + .addMember("value", "$S", typeElement.getSimpleName()) + .build()) + .addAnnotation(AnnotationSpec.builder(JsonDeserialize.class) + .addMember("builder", CodeBlock.builder() + .add(elementQualifiedName + "." + elementSimpleName + "Builder.class").build()) + .build()) + .addAnnotation(AnnotationSpec.builder(JsonInclude.class) + .addMember("value", CodeBlock.builder() + .add("JsonInclude.Include.NON_NULL").build()) + .build()) + .addType(TypeSpec + .classBuilder(typeElement.getSimpleName().toString() + "MixinBuilder") + .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) + .addAnnotation(AnnotationSpec.builder(JsonPOJOBuilder.class) + .addMember("withPrefix", "$S", "") + .build()).build()); + try { + String packageName = elementQualifiedName.substring(0, elementQualifiedName.lastIndexOf(".")) + + ".jackson"; + JavaFile.builder(packageName, mixinClassBuilder.build()) + .build() + .writeTo(processingEnvironment.getFiler()); + addMixinCode.put(elementQualifiedName + ".class", + packageName + "." + typeElement.getSimpleName().toString() + "Mixin" + ".class"); + addMixinCode.put(elementQualifiedName + "." + elementSimpleName + "Builder.class", + packageName + "." + typeElement.getSimpleName().toString() + + "Mixin." + typeElement.getSimpleName().toString() + "MixinBuilder.class"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + MethodSpec.Builder methodSpecBuilder = MethodSpec.methodBuilder("addMixins") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) + .addParameter(Module.SetupContext.class, "context"); + for (String key : addMixinCode.keySet()) { + methodSpecBuilder.addStatement(" context.setMixInAnnotations($L, $L)", key, addMixinCode.get(key)); + } + TypeSpec.Builder mixinUtilClassBuilder = TypeSpec + .classBuilder("MixinUtil") + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addAnnotation(AnnotationSpec.builder(SuppressWarnings.class) + .addMember("value", "$S", "PMD") + .build()) + .addMethod(methodSpecBuilder.build()); + try { + JavaFile.builder(PACKAGE_NAME, mixinUtilClassBuilder.build()) + .build() + .writeTo(processingEnvironment.getFiler()); + } catch (IOException e) { + e.printStackTrace(); + } + + return true; + } + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(JacksonMixin.class.getCanonicalName()))); + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } +} diff --git a/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor new file mode 100644 index 000000000..491672f9d --- /dev/null +++ b/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor @@ -0,0 +1 @@ +com.basistech.rosette.annotations.JacksonMixinProcessor diff --git a/api/pom.xml b/api/pom.xml index 5d3761c91..8679239da 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -160,6 +160,13 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + -Xmx1024m -XX:MaxPermSize=256m + + diff --git a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java index 55ce64b35..05c9d08e3 100644 --- a/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java +++ b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java @@ -1,5 +1,5 @@ /* -* Copyright 2016 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -374,9 +374,9 @@ private void responseHeadersToExtendedInformation(T resp, H currentSetValue = new HashSet<>(Collections.singletonList(resp.getExtendedInformation().get(header.getName()))); } currentSetValue.add(header.getValue()); - resp.setExtendedInformation(header.getName(), currentSetValue); + resp.addExtendedInformation(header.getName(), currentSetValue); } else { - resp.setExtendedInformation(header.getName(), header.getValue()); + resp.addExtendedInformation(header.getName(), header.getValue()); } } } @@ -529,7 +529,8 @@ private T getResponse(HttpResponse httpResponse, Class cla errorContent = "(no body)"; } // something not from us at all - throw new HttpRosetteAPIException("Invalid error response (not json)", new ErrorResponse("invalidErrorResponse", errorContent), status); + throw new HttpRosetteAPIException("Invalid error response (not json)", + ErrorResponse.builder().code("invalidErrorResponse").message(errorContent).build(), status); } } else { return mapper.readValue(inputStream, clazz); diff --git a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java b/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java deleted file mode 100644 index 19ac68255..000000000 --- a/api/src/main/java/com/basistech/rosette/api/RosetteAPI.java +++ /dev/null @@ -1,2045 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.api; - -import com.basistech.rosette.apimodel.CategoriesOptions; -import com.basistech.rosette.apimodel.CategoriesResponse; -import com.basistech.rosette.apimodel.DocumentRequest; -import com.basistech.rosette.apimodel.EntitiesOptions; -import com.basistech.rosette.apimodel.EntitiesResponse; -import com.basistech.rosette.apimodel.ErrorResponse; -import com.basistech.rosette.apimodel.InfoResponse; -import com.basistech.rosette.apimodel.LanguageOptions; -import com.basistech.rosette.apimodel.LanguageResponse; -import com.basistech.rosette.apimodel.MorphologyOptions; -import com.basistech.rosette.apimodel.MorphologyResponse; -import com.basistech.rosette.apimodel.Name; -import com.basistech.rosette.apimodel.NameDeduplicationRequest; -import com.basistech.rosette.apimodel.NameDeduplicationResponse; -import com.basistech.rosette.apimodel.NameSimilarityRequest; -import com.basistech.rosette.apimodel.NameSimilarityResponse; -import com.basistech.rosette.apimodel.NameTranslationRequest; -import com.basistech.rosette.apimodel.NameTranslationResponse; -import com.basistech.rosette.apimodel.Options; -import com.basistech.rosette.apimodel.PingResponse; -import com.basistech.rosette.apimodel.RelationshipsOptions; -import com.basistech.rosette.apimodel.RelationshipsResponse; -import com.basistech.rosette.apimodel.Request; -import com.basistech.rosette.apimodel.Response; -import com.basistech.rosette.apimodel.SentencesResponse; -import com.basistech.rosette.apimodel.SentimentOptions; -import com.basistech.rosette.apimodel.SentimentResponse; -import com.basistech.rosette.apimodel.TextEmbeddingResponse; -import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; -import com.basistech.rosette.apimodel.TokensResponse; -import com.basistech.rosette.apimodel.jackson.ApiModelMixinModule; -import com.basistech.rosette.apimodel.jackson.DocumentRequestMixin; -import com.basistech.util.LanguageCode; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.google.common.io.ByteStreams; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHeaders; -import org.apache.http.HttpResponse; -import org.apache.http.annotation.Immutable; -import org.apache.http.annotation.ThreadSafe; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.AbstractHttpEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.mime.FormBodyPartBuilder; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MIME; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.AbstractContentBody; -import org.apache.http.entity.mime.content.InputStreamBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.message.BasicHeader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Properties; -import java.util.Set; -import java.util.zip.GZIPInputStream; - -import static java.net.HttpURLConnection.HTTP_OK; - -/** - * You can use the RosetteAPI to access Rosette API endpoints. - * RosetteAPI is thread-safe and immutable. - * @deprecated this class has been replaced by {@link HttpRosetteAPI}. - */ -@Immutable -@ThreadSafe -@Deprecated -@SuppressWarnings({"deprecation", "unchecked"}) -public class RosetteAPI implements Closeable { - - public static final String DEFAULT_URL_BASE = "https://api.rosette.com/rest/v1"; - public static final String SERVICE_NAME = "RosetteAPI"; - public static final String BINDING_VERSION = getVersion(); - public static final String USER_AGENT_STR = SERVICE_NAME + "-Java/" + BINDING_VERSION; - - public static final String LANGUAGE_SERVICE_PATH = "/language"; - public static final String MORPHOLOGY_SERVICE_PATH = "/morphology"; - public static final String ENTITIES_SERVICE_PATH = "/entities"; - /** - * @deprecated merged into the {@link #ENTITIES_SERVICE_PATH}. - */ - @Deprecated - public static final String ENTITIES_LINKED_SERVICE_PATH = "/entities/linked"; - public static final String CATEGORIES_SERVICE_PATH = "/categories"; - public static final String RELATIONSHIPS_SERVICE_PATH = "/relationships"; - public static final String SENTIMENT_SERVICE_PATH = "/sentiment"; - public static final String NAME_DEDUPLICATION_SERVICE_PATH = "/name-deduplication"; - public static final String NAME_TRANSLATION_SERVICE_PATH = "/name-translation"; - public static final String NAME_SIMILARITY_SERVICE_PATH = "/name-similarity"; - public static final String TOKENS_SERVICE_PATH = "/tokens"; - public static final String SENTENCES_SERVICE_PATH = "/sentences"; - public static final String TEXT_EMBEDDING_SERVICE_PATH = "/text-embedding"; - public static final String SYNTAX_DEPENDENCIES_PATH = "/syntax/dependencies"; - public static final String INFO_SERVICE_PATH = "/info"; - public static final String PING_SERVICE_PATH = "/ping"; - - private static final Logger LOG = LoggerFactory.getLogger(RosetteAPI.class); - - private String urlBase = DEFAULT_URL_BASE; - private int failureRetries; - private LanguageCode language; - private Options options; - private String genre; - private ObjectMapper mapper; - private HttpClient httpClient; - private List
additionalHeaders; - private int connectionConcurrency = 2; - private boolean closeClientOnClose = true; - - /** - * Constructs a Rosette API instance using an API key. - * - * @param key Rosette API key - * @throws RosetteAPIException If the service is not compatible with the version of the binding. - * @throws IOException General IO exception - * - * @deprecated use RosetteAPI.Builder class - */ - @Deprecated - public RosetteAPI(String key) throws IOException, RosetteAPIException { - this(key, DEFAULT_URL_BASE); - } - - /** - * Constructs a Rosette API instance using an API key and accepts an - * alternate URL for testing purposes. - * - * @param key Rosette API key - * @param alternateUrl Alternate Rosette API URL - * @throws RosetteAPIException If the service is not compatible with the version of the binding. - * @throws IOException General IO exception - * - * @deprecated use RosetteAPI.Builder class - */ - @Deprecated - public RosetteAPI(String key, String alternateUrl) throws IOException, RosetteAPIException { - Objects.requireNonNull(alternateUrl, "alternateUrl cannot be null"); - urlBase = alternateUrl; - if (urlBase.endsWith("/")) { - urlBase = urlBase.substring(0, urlBase.length() - 1); - } - this.failureRetries = 1; - mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); - initClient(key, null); - } - - /** - * Constructs a Rosette API instance using the builder syntax. - * - * @param key Rosette API key - * @param urlToCall Alternate Rosette API URL - * @param failureRetries Number of times to retry in case of failure; default 1 - * @param language source language - * @param genre genre (ex "social-media") - * @param options options for the request - * @throws IOException General IO exception - * @throws RosetteAPIException Problem with the API request - */ - private RosetteAPI(String key, String urlToCall, int failureRetries, - LanguageCode language, String genre, Options options, - HttpClient httpClient, List
additionalHeaders, - int connectionConcurrency) - throws IOException, RosetteAPIException { - this.language = language; - this.genre = genre; - this.options = options; - urlBase = urlToCall.trim().replaceAll("/+$", ""); - this.failureRetries = failureRetries; - mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper()); - mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); - this.connectionConcurrency = connectionConcurrency; - - if (httpClient == null) { - initClient(key, additionalHeaders); - } else { - this.httpClient = httpClient; - initHeaders(key, additionalHeaders); - closeClientOnClose = false; - } - } - - // make a client just to grab the concurrent connections header - private void initClient(String key, List
additionalHeaders) { - HttpClientBuilder builder = HttpClients.custom(); - PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(connectionConcurrency); - builder.setConnectionManager(cm); - - initHeaders(key, additionalHeaders); - builder.setDefaultHeaders(this.additionalHeaders); - - httpClient = builder.build(); - this.additionalHeaders = new ArrayList<>(); - } - - private void initHeaders(String key, List
additionalHeaders) { - this.additionalHeaders = new ArrayList<>(); - this.additionalHeaders.add(new BasicHeader(HttpHeaders.USER_AGENT, USER_AGENT_STR)); - this.additionalHeaders.add(new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "gzip")); - if (key != null) { - this.additionalHeaders.add(new BasicHeader("X-RosetteAPI-Key", key)); - this.additionalHeaders.add(new BasicHeader("X-RosetteAPI-Binding", "java")); - this.additionalHeaders.add(new BasicHeader("X-RosetteAPI-Binding-Version", BINDING_VERSION)); - } - if (additionalHeaders != null) { - this.additionalHeaders.addAll(additionalHeaders); - } - } - - /** - * Returns the version of the binding. - * - * @return version of the binding - */ - private static String getVersion() { - Properties properties = new Properties(); - try (InputStream ins = RosetteAPI.class.getClassLoader().getResourceAsStream("version.properties")) { - properties.load(ins); - } catch (IOException e) { - // should not happen - } - return properties.getProperty("version", "undefined"); - } - - /** - * Return failure retries. - * - * @return failure retries - */ - public int getFailureRetries() { - return failureRetries; - } - - /** - * Return language code. - * - * @return source language - */ - public LanguageCode getLanguageCode() { - return language; - } - - /** - * Returns the genre. - * - * @return genre if being used by API - */ - public String getGenre() { - return genre; - } - - /** - * Returns options used by API. - * - * @return options - */ - public Options getOptions() { - return options; - } - - /** - * Gets information about the Rosette API, returns name, version, build number and build time. - * - * @return InfoResponse - * @throws RosetteAPIException Rosette specific exception - * @throws IOException General IO exception - */ - public InfoResponse info() throws IOException, RosetteAPIException { - return sendGetRequest(urlBase + INFO_SERVICE_PATH, InfoResponse.class); - } - - /** - * Pings the Rosette API for a response indicting that the service is available. - * - * @return PingResponse - * @throws RosetteAPIException Rosette specific exception - * @throws IOException General IO exception - */ - public PingResponse ping() throws IOException, RosetteAPIException { - return sendGetRequest(urlBase + PING_SERVICE_PATH, PingResponse.class); - } - - /** - * Matches 2 names and returns a score in NameMatchingResponse. - * - * @param request request - * @return response - * @throws RosetteAPIException Rosette specific exception - * @throws IOException General IO exception - * - * @deprecated replaced by {@link #getNameSimilarity(Name, Name) getNameSimilarity} - */ - @Deprecated - public NameSimilarityResponse getNameSimilarity(NameSimilarityRequest request) throws RosetteAPIException, IOException { - return getNameSimilarity(request.getName1(), request.getName2()); - } - - /** - * Matches 2 names and returns a score in NameMatchingResponse. - * - * @param nameOne first name - * @param nameTwo second name - * @return response - * @throws RosetteAPIException Rosette specific exception - * @throws IOException General IO exception - */ - public NameSimilarityResponse getNameSimilarity(Name nameOne, Name nameTwo) throws RosetteAPIException, IOException { - NameSimilarityRequest request = new NameSimilarityRequest(nameOne, nameTwo); - return sendPostRequest(request, urlBase + NAME_SIMILARITY_SERVICE_PATH, NameSimilarityResponse.class); - } - - /** - * Translates a name into the target language specified in NameTranslationRequest. - * - * @param request NameTranslationRequest contains the name to be translated and the target language. - * @return the response. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public NameTranslationResponse getNameTranslation(NameTranslationRequest request) - throws RosetteAPIException, IOException { - return sendPostRequest(request, urlBase + NAME_TRANSLATION_SERVICE_PATH, NameTranslationResponse.class); - } - - /** - * Returns a list of cluster IDs to be used in deduplication from a list of names specified in - * NameDeduplicationRequest. - * - * @param request NameDeduplication contains the names to be deduplicated and the score threshold. - * @return the response. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public NameDeduplicationResponse getNameDeduplication(NameDeduplicationRequest request) - throws RosetteAPIException, IOException { - return sendPostRequest(request, urlBase + NAME_DEDUPLICATION_SERVICE_PATH, NameDeduplicationResponse.class); - } - - /** - * Performs language identification on data read from an InputStream. Return a list of languages. - * - * @param inputStream Input stream of file. - * @param contentType the content type (e.g. text/html) - * @param options Options to Language API. - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Replaced by {@link #getLanguage(InputStream, String) getLanguage} - */ - @Deprecated - public LanguageResponse getLanguage(InputStream inputStream, String contentType, LanguageOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder().contentBytes(bytes, contentType) - .options(options).build(); - return sendPostRequest(request, urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Performs language identification on data from an InputSteam. Builds request object from API, not parameters. - * Returns a list of languages. - * - * @param inputStream Input stream of file - * @param contentType the content type (e.g. text/html) - * - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - There's a problem with the Rosette API request - * @throws IOException - There's a problem with communication or JSON serialization/deserialization - */ - public LanguageResponse getLanguage(InputStream inputStream, String contentType) throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Performs language identification on data read from an URL. Return a list of languages. - * - * @param url URL for language detection. - * @param options Options to Language API. - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Replaced by {@link #getLanguage(URL) getLanguage} - */ - @Deprecated - public LanguageResponse getLanguage(URL url, LanguageOptions options) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Performs language identification on data read from an URL. Builds request object from API, not parameters. - * Returns a list of languages. - * - * @param url URL for language detection - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public LanguageResponse getLanguage(URL url) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Performs language identification on data read from a string. Return a list of languages. - * - * @param content String content for language detection. - * @param options Options to Language API. - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Replaced by {@link #getLanguage(String) getLanguage} - */ - @Deprecated - public LanguageResponse getLanguage(String content, LanguageOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder().content(content) - .options(options).build(); - return sendPostRequest(request, urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Performs language identification on data read from a string. Builds request object from API not parameters. - * Returns a list of languages. - * - * @param content String content for language detection. - * - * @return An ordered list of detected languages, including language and detection confidence, sorted by - * descending confidence. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public LanguageResponse getLanguage(String content) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + LANGUAGE_SERVICE_PATH, LanguageResponse.class); - } - - /** - * Returns morphological analysis of the input file. - * The response may include lemmas, part of speech tags, compound word components, and Han readings. - * Support for specific return types depends on language. - * - * @param morphologicalFeature Type of morphological analysis to perform. - * @param inputStream Input stream of file. - * @param contentType the content type (e.g. text/html) - * @param language Language of input if known (see {@link LanguageCode}), or null - * @param options Linguistics options - * @return MorphologyResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getMorphology(MorphologicalFeature, InputStream, String) getMorphology} - */ - @Deprecated - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, - InputStream inputStream, - String contentType, - LanguageCode language, MorphologyOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .options(options) - .build(); - return sendPostRequest(request, urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - /** - * Returns morphological analysis of the input file. The response may include lemmas, part of speech tags, - * compound word components, and Han readings. Builds request object from API rather than from parameters. - * Support for specific return types depends on language. - * - * @param inputStream Input stream of file - * @param contentType The content type (e.g. text/html) - * @return MorphologyResponse - * @throws RosetteAPIException - * @throws IOException - */ - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, - InputStream inputStream, - String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - /** - * Returns morphological analysis of the URL content. - * The response may include lemmas, part of speech tags, compound word components, and Han readings. - * Support for specific return types depends on language. - * - * @param morphologicalFeature Type of morphological analysis to perform. - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null - * @param options Linguistics options - * @return MorphologyResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getMorphology(MorphologicalFeature, URL) getMorphology} - */ - @Deprecated - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, URL url, - LanguageCode language, - MorphologyOptions options) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - /** - * Returns morphological analysis of the URL content. The response may include lemmas, part of speech tags, compound - * word components, and Han readings. Builds request object from API, rather than from parameters. Support for - * specific return types depends on language. - * - * @param url URL containing the data - * @return MorphologyResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization. - */ - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, URL url) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - /** - * Returns morphological analysis of a string. - * The response may include lemmas, part of speech tags, compound word components, and Han readings. - * Support for specific return types depends on language. - * - * @param morphologicalFeature Type of morphological analysis to perform. - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null - * @param options Linguistics options - * @return MorphologyResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getMorphology(MorphologicalFeature, String) getMorphology} - */ - @Deprecated - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, String content, - LanguageCode language, MorphologyOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .options(options) - .build(); - return sendPostRequest(request, urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - /** - * Returns morphological analysis of a string. The response may include lemmas, part of speech tags, compound word - * components, and Han reading. Constructs request object from API information rather than from parameters. Support - * for specific return types depends on language. - * - * @param content String containing the data. - * @return MorphologyResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public MorphologyResponse getMorphology(MorphologicalFeature morphologicalFeature, String content) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + MORPHOLOGY_SERVICE_PATH + "/" + morphologicalFeature.toString(), - MorphologyResponse.class); - } - - - /** - * Returns entities extracted from the input file. - *

- * The response is a list of extracted entities. - * Each entity includes chain ID (all instances of the same entity share a chain id), - * mention (entity text in the input), normalized text (the most complete form of this entity that appears in - * the input), count (how many times this entity appears in the input), and the confidence associated with the - * extraction. - * - * @param inputStream Input stream of file. - * @param contentType the content type of the data (e.g. text/html) - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options EntityMention options. - * @return EntitiesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaces by {@link #getEntities(InputStream, String) getEntities} - */ - @Deprecated - public EntitiesResponse getEntities(InputStream inputStream, - String contentType, - LanguageCode language, EntitiesOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .options(options) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - /** - * Returns entities extracted from the input file. Builds request object from API fields not from parameters. - *

- * The response is a list of extracted entities. Each entity includes chain ID (all instances of the same - * entity share a chain id), mention (entity text in the input), normalized text (the most complete form - * of this entity that appears in the input), count (how many times this entity appears in the input), and the - * confidence associated with the extraction. - * - * @param inputStream Input stream of file. - * @param contentType The content type of the data (e.g. text/html) - * @return EntitiesResponse - * @throws RosetteAPIException - * @throws IOException - */ - public EntitiesResponse getEntities(InputStream inputStream, String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - - /** - * Returns entities extracted from the URL content. - *

- * The response is a list of extracted entities. - * Each entity includes chain ID (all instances of the same entity share a chain id), - * mention (entity text in the input), normalized text (the most complete form of this entity that appears in - * the input), count (how many times this entity appears in the input), and the confidence associated with the - * extraction. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options EntityMention options. - * @return EntitiesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getEntities(URL) getEntities} - */ - @Deprecated - public EntitiesResponse getEntities(URL url, LanguageCode language, EntitiesOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - /** - *Returns entities extracted from the URL content. Request object built through API rather than parameters. - *

- * The response is a list of extracted entities. - * Each entity includes chain ID (all instances of the same entity share a chain id), - * mention (entity text in the input), normalized text (the most complete form of this entity that appears in - * the input), count (how many times this entity appears in the input), and the confidence associated with the - * extraction. - * - * @param url URL containing the data. - * @return EntitiesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public EntitiesResponse getEntities(URL url) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - /** - * Returns entities extracted from a string. - *

- * The response is a list of extracted entities. - * Each entity includes chain ID (all instances of the same entity share a chain id), - * mention (entity text in the input), normalized text (the most complete form of this entity that appears in - * the input), count (how many times this entity appears in the input), and the confidence associated with the - * extraction. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options EntityMention options. - * @return EntitiesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getEntities(String) getEntities} - */ - @Deprecated - public EntitiesResponse getEntities(String content, LanguageCode language, EntitiesOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .options(options) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - /** - *Returns entities extracted from a string. Request object built from API rather than from parameters. - *

- * The response is a list of extracted entities. - * Each entity includes chain ID (all instances of the same entity share a chain id), - * mention (entity text in the input), normalized text (the most complete form of this entity that appears in - * the input), count (how many times this entity appears in the input), and the confidence associated with the - * extraction. - * - * @param content String containing the data. - * @return EntitiesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public EntitiesResponse getEntities(String content) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + ENTITIES_SERVICE_PATH, EntitiesResponse.class); - } - - /** - * Links entities in the input file to entities in the knowledge base (Wikidata). - * The response identifies the entities in the input that have been linked to entities in the knowledge base. - * Each entity includes an entity id (from the knowledge base), a chain id (all instances of the same entity - * share a chain id), the mention (entity text from the input), and confidence associated with the linking. - * - * @param inputStream Input stream of file. - * @param contentType the content type for the file (e.g. text/html). - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return LinkedEntityResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Merged into {@link #getEntities(String, LanguageCode, EntitiesOptions)}. - */ - @Deprecated - public com.basistech.rosette.apimodel.LinkedEntitiesResponse getLinkedEntities(InputStream inputStream, - String contentType, - LanguageCode language) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_LINKED_SERVICE_PATH, com.basistech.rosette.apimodel.LinkedEntitiesResponse.class); - } - - /** - * Links entities in the URL content to entities in the knowledge base (Wikidata). - * The response identifies the entities in the input that have been linked to entities in the knowledge base. - * Each entity includes an entity id (from the knowledge base), a chain id (all instances of the same entity - * share a chain id), the mention (entity text from the input), and confidence associated with the linking. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return LinkedEntityResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Merged into {@link #getEntities(InputStream, String, LanguageCode, EntitiesOptions)} - */ - @Deprecated - public com.basistech.rosette.apimodel.LinkedEntitiesResponse getLinkedEntities(URL url, LanguageCode language) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_LINKED_SERVICE_PATH, com.basistech.rosette.apimodel.LinkedEntitiesResponse.class); - } - - /** - * Links entities in a string to entities in the knowledge base (Wikidata). - * The response identifies the entities in the input that have been linked to entities in the knowledge base. - * Each entity includes an entity id (from the knowledge base), a chain id (all instances of the same entity - * share a chain id), the mention (entity text from the input), and confidence associated with the linking. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return LinkedEntityResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - @SuppressWarnings("deprecation") - public com.basistech.rosette.apimodel.LinkedEntitiesResponse getLinkedEntities(String content, LanguageCode language) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .build(); - return sendPostRequest(request, urlBase + ENTITIES_LINKED_SERVICE_PATH, com.basistech.rosette.apimodel.LinkedEntitiesResponse.class); - } - - /** - * Returns an ordered list of categories identified in the input file. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - *

- * The response is the contextual categories identified in the input. - * - * @param inputStream Input stream of file. - * @param contentType the contentType of the file (e.g. text/html). - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options CategoriesOptions. - * @return CategoriesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getCategories(InputStream, String) getCategories} - */ - @Deprecated - public CategoriesResponse getCategories(InputStream inputStream, - String contentType, - LanguageCode language, CategoriesOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .options(options) - .build(); - return sendPostRequest(request, urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns an ordered list of categories identified in the input file. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - * The request object is built from the API object rather than from the parameters. - *

- * The response is the contextual categories identified in the input. - * @param inputStream Input stream of file. - * @param contentType The contentType of the file (e.g. text/html) - * @return CategoriesResponse - * @throws RosetteAPIException - * @throws IOException - */ - public CategoriesResponse getCategories(InputStream inputStream, - String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns an ordered list of categories identified in the URL content. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - *

- * The response is the contextual categories identified in the input. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options CategoriesOptions. - * @return CategoriesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated Replaced by {@link #getCategories(URL) getCategories} - */ - @Deprecated - public CategoriesResponse getCategories(URL url, LanguageCode language, CategoriesOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns an ordered list of categories identified in the input file. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - * The request object is built from the API object rather than from the parameters. - *

- * The response is the contextual categories identified in the input. - * - * @param url URL containing the data. - * @return CategoriesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public CategoriesResponse getCategories(URL url) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns an ordered list of categories identified in a string. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - *

- * The response is the contextual categories identified in the input. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options CategoriesOptions. - * @return CategoriesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getCategories(String) getCategories} - */ - @Deprecated - public CategoriesResponse getCategories(String content, LanguageCode language, CategoriesOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .options(options) - .build(); - return sendPostRequest(request, urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns an ordered list of categories identified in the input file. The categories are Tier 1 contextual - * categories defined in the QAG Taxonomy. - * The request object is built from the API object rather than from the parameters. - *

- * The response is the contextual categories identified in the input. - * - * @param content String containing the data. - * @return CategoriesResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization. - */ - public CategoriesResponse getCategories(String content) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + CATEGORIES_SERVICE_PATH, CategoriesResponse.class); - } - - /** - * Returns each relationship extracted from the input. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * - * @param content, String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options RelationshipOptions - * @return RelationshipsResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getRelationships(String) getRelationships} - */ - @Deprecated - public RelationshipsResponse getRelationships(String content, LanguageCode language, RelationshipsOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .options(options) - .build(); - return sendPostRequest(request, urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Returns each relationship extracted from the input. Request object uses API attributes rather than parameters. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * @param content String containing the data. - * @return RelationshipsResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public RelationshipsResponse getRelationships(String content) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Returns each relationship extracted from the input. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * - * @param inputStream Input stream of file. - * @param contentType the content type of the file. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options RelationshipOptions - * @return RelationshipsResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request - * @throws IOException - If there is a communication or JSON serialization/deserialization error - * - * @deprecated Replaced by {@link #getRelationships(InputStream, String) getRelationships} - */ - @Deprecated - public RelationshipsResponse getRelationships(InputStream inputStream, - String contentType, - LanguageCode language, RelationshipsOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .options(options) - .build(); - return sendPostRequest(request, urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Returns each relationship extracted from the input. Request object uses API attributes rather than parameters. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * @param inputStream Input stream of file. - * @param contentType The content type of the file. - * @return RelationshipsResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public RelationshipsResponse getRelationships(InputStream inputStream, - String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Returns each relationship extracted from the input. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options RelationshipOptions - * @return RelationshipsResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request - * @throws IOException - If there is a communication or JSON serialization/deserialization error - * - * @deprecated replaced {@link #getRelationships(URL) getRelationships} - */ - @Deprecated - public RelationshipsResponse getRelationships(URL url, LanguageCode language, RelationshipsOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Returns each relationship extracted from the input. - *

- * The response is a list of extracted relationships. A relationship contains - *

- * predicate - usually the main verb, property or action that is expressed by the text - * arg1 - usually the subject, agent or main actor of the relationship - * arg2 [optional] - complements the predicate and is usually the object, theme or patient of the relationship - * arg3 [optional] - usually an additional object in ditransitive verbs - * adjuncts [optional] - contain all optional parts of a relationship which are not temporal or locative expressions - * locatives [optional] - usually express the locations the action expressed by the relationship took place - * temporals [ optional] - usually express the time in which the action expressed by the relationship took place - * confidence - a measure of quality of relationship extraction, between 0 - 1 - * - * @param url URL containing the data. - * @return RelationshipOptions - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization. - */ - public RelationshipsResponse getRelationships(URL url) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + RELATIONSHIPS_SERVICE_PATH, RelationshipsResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. - *

- * The response contains sentiment analysis results. - * - * @param inputStream Input stream of file. - * @param contentType the content type of the file (e.g. text/html) - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options SentimentOptions. - * @return SentimentResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentiment(InputStream, String) getSentiment} - */ - @Deprecated - public SentimentResponse getSentiment(InputStream inputStream, - String contentType, - LanguageCode language, SentimentOptions options) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .options(options) - .build(); - return sendPostRequest(request, urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. Request object built from API rather than - * from individual request. - *

- * The response contains sentiment analysis results. - * - * @param inputStream Input stream of file. - * @param contentType The content type of the file (e.g. text/html) - * @return SentimentResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public SentimentResponse getSentiment(InputStream inputStream, - String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. - *

- * The response contains sentiment analysis results. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options SentimentOptions. - * @return SentimentResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentiment(URL) getSentiment} - */ - @Deprecated - public SentimentResponse getSentiment(URL url, LanguageCode language, SentimentOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .options(options) - .build(); - return sendPostRequest(request, urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. Request object built from API rather than - * from individual request. - *

- * The response contains sentiment analysis results. - * - * @param url URL containing the data. - * @return SentimentOptions - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public SentimentResponse getSentiment(URL url) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. - *

- * The response contains sentiment analysis results. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @param options SentimentOptions. - * @return SentimentResponse - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentiment(String) getSentiment} - */ - @Deprecated - public SentimentResponse getSentiment(String content, LanguageCode language, SentimentOptions options) - throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .options(options) - .build(); - return sendPostRequest(request, urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Analyzes the positive and negative sentiment expressed by the input. Request object uses API object rather than - * parameters. - *

- * The response contains sentiment analysis results. - * - * @param content String containing the data. - * @return SentimentOptions - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public SentimentResponse getSentiment(String content) - throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + SENTIMENT_SERVICE_PATH, SentimentResponse.class); - } - - /** - * Divides the input into tokens. - * - * @param inputStream Input stream of file. - * @param contentType the content type of the file (e.g. text/html) - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getTokens(InputStream, String) getTokens} - */ - @Deprecated - public TokensResponse getTokens(InputStream inputStream, String contentType, LanguageCode language) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .build(); - return sendPostRequest(request, urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into tokens. Request object built through API calls rather than from parameters. - * - * @param inputStream Input stream of file. - * @param contentType The content type of the file (e.g. text/html) - * - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization - */ - public TokensResponse getTokens(InputStream inputStream, String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into tokens. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getTokens(URL) getTokens} - */ - @Deprecated - public TokensResponse getTokens(URL url, LanguageCode language) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .build(); - return sendPostRequest(request, urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into tokens. Request object uses API fields rather than call parameters. - * - * @param url URL containing the data. - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public TokensResponse getTokens(URL url) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into tokens. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getTokens(String) getTokens} - */ - @Deprecated - public TokensResponse getTokens(String content, LanguageCode language) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .build(); - return sendPostRequest(request, urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into tokens. Request object is built from the API object rather than from parameters. - * - * @param content String containing the data. - * @return The response contains a list of tokens. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public TokensResponse getTokens(String content) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + TOKENS_SERVICE_PATH, TokensResponse.class); - } - - /** - * Divides the input into sentences. - * - * @param inputStream Input stream of file. - * @param contentType the content type of the file (e.g. text/html). - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentences(InputStream, String) getSentences} - */ - @Deprecated - public SentencesResponse getSentences(InputStream inputStream, - String contentType, - LanguageCode language) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - Request request = new DocumentRequest.Builder() - .language(language) - .contentBytes(bytes, contentType) - .build(); - return sendPostRequest(request, urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Divides the input into sentences. Request object is built from the API object rather than from parameters. - * - * @param inputStream Input stream of file. - * @param contentType The content type of the file (e.g. text/html). - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization. - */ - public SentencesResponse getSentences(InputStream inputStream, String contentType) throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Divides the input into sentences. - * - * @param url URL containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentences(URL) getSentences} - */ - @Deprecated - public SentencesResponse getSentences(URL url, LanguageCode language) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .contentUri(url.toString()) - .build(); - return sendPostRequest(request, urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Divides the input into sentences. Request object is built from the API object rather than from parameters. - * - * @param url URL containing the data. - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication of JSON serialization/deserialization error. - */ - public SentencesResponse getSentences(URL url) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Divides the input into sentences. - * - * @param content String containing the data. - * @param language Language of input if known (see {@link LanguageCode}), or null. - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - * - * @deprecated replaced by {@link #getSentences(String) getSentences} - */ - @Deprecated - public SentencesResponse getSentences(String content, LanguageCode language) throws RosetteAPIException, IOException { - Request request = new DocumentRequest.Builder() - .language(language) - .content(content) - .build(); - return sendPostRequest(request, urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Divides the input into sentences. Request object is built from the API object rather than from parameters. - * - * @param content String containing the data. - * @return The response contains a list of sentences. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public SentencesResponse getSentences(String content) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + SENTENCES_SERVICE_PATH, SentencesResponse.class); - } - - /** - * Returns the average text embedding for the input - * - * @param url URL containing the data. - * @return The response contains the embedding. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public TextEmbeddingResponse getTextEmbedding(URL url) throws IOException, RosetteAPIException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + TEXT_EMBEDDING_SERVICE_PATH, TextEmbeddingResponse.class); - } - - /** - * Returns the average text embedding for the input - * - * @param content String containing the data. - * @return The response contains the embedding. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public TextEmbeddingResponse getTextEmbedding(String content) throws IOException, RosetteAPIException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + TEXT_EMBEDDING_SERVICE_PATH, TextEmbeddingResponse.class); - } - - /** - * Identifies syntactic dependencies. Request object is built from the API object rather than from parameters. - * - * @param inputStream Input stream of file. - * @param contentType The content type of the file (e.g. text/html). - * @return The response contains a list of syntactic dependencies. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a problem with communication or JSON serialization/deserialization. - */ - public SyntaxDependenciesResponse getSyntaxDependencies(InputStream inputStream, String contentType) - throws RosetteAPIException, IOException { - byte[] bytes = getBytes(inputStream); - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentBytes(bytes, contentType).build(), urlBase + SYNTAX_DEPENDENCIES_PATH, SyntaxDependenciesResponse.class); - } - - /** - * Identifies syntactic dependencies. Request object is built from the API object rather than from parameters. - * - * @param url URL containing the data. - * @return The response contains a list of syntactic dependencies. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication of JSON serialization/deserialization error. - */ - public SyntaxDependenciesResponse getSyntaxDependencies(URL url) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.contentUri(url.toString()).build(), urlBase + SYNTAX_DEPENDENCIES_PATH, SyntaxDependenciesResponse.class); - } - - /** - * Identifies syntactic dependencies. Request object is built from the API object rather than from parameters. - * - * @param content String containing the data. - * @return The response contains a list of syntactic dependencies. - * @throws RosetteAPIException - If there is a problem with the Rosette API request. - * @throws IOException - If there is a communication or JSON serialization/deserialization error. - */ - public SyntaxDependenciesResponse getSyntaxDependencies(String content) throws RosetteAPIException, IOException { - DocumentRequest.BaseBuilder documentRequestBuilder = getDocumentRequestBuilder(); - return sendPostRequest(documentRequestBuilder.content(content).build(), urlBase + SYNTAX_DEPENDENCIES_PATH, SyntaxDependenciesResponse.class); - } - - /** - * Provides information on Rosette API - * - * @return {@link com.basistech.rosette.apimodel.InfoResponse InfoResponse} - * @throws RosetteAPIException Rosette specific exception - * @throws IOException General IO exception - */ - public InfoResponse getInfo() throws RosetteAPIException, IOException { - return sendGetRequest(urlBase + INFO_SERVICE_PATH, InfoResponse.class); - } - - /** - * Send a request to the API, return a response (or throw an exception). - * Use this method for request parameter combinations that are not covered - * by the specific endpoint methods. - * @param endpoint The endpoint, for example, '/entities'. - * @param request The request object. - * @param responseClass The class of the response object corresponding to the request object. - * @param the request type. - * @param the response type. - * @return the response. - * @throws IOException for errors in communications. - * @throws RosetteAPIException for errors returned by the API. - */ - public Res doRequest(String endpoint, Req request, Class responseClass) - throws IOException, RosetteAPIException { - return sendPostRequest(request, urlBase + endpoint, responseClass); - } - - /** - * Sends a GET request to Rosette API. - *

- * Returns a Response. - * - * @param urlStr Rosette API end point. - * @param clazz Response class - * @return Response - * @throws IOException - * @throws RosetteAPIException - */ - private T sendGetRequest(String urlStr, Class clazz) throws IOException, RosetteAPIException { - HttpGet get = new HttpGet(urlStr); - for (Header header : additionalHeaders) { - get.addHeader(header); - } - HttpResponse httpResponse = httpClient.execute(get); - T resp = getResponse(httpResponse, clazz); - responseHeadersToExtendedInformation(resp, httpResponse); - return resp; - } - - /** - * Sends a POST request to Rosette API. - *

- * Returns a Response. - * - * @param urlStr Rosette API end point. - * @param clazz Response class - * @return Response - * @throws RosetteAPIException - * @throws IOException - */ - private T sendPostRequest(Object request, String urlStr, Class clazz) - throws RosetteAPIException, IOException { - ObjectWriter writer = mapper.writer().without(JsonGenerator.Feature.AUTO_CLOSE_TARGET); - boolean notPlainText = false; - if (request instanceof DocumentRequest) { - Object rawContent = ((DocumentRequest) request).getRawContent(); - if (rawContent instanceof String) { - writer = writer.withView(DocumentRequestMixin.Views.Content.class); - } else if (rawContent != null) { - notPlainText = true; - } - } - final ObjectWriter finalWriter = writer; - - HttpPost post = new HttpPost(urlStr); - for (Header header : additionalHeaders) { - post.addHeader(header); - } - //TODO: add compression! - if (notPlainText) { - setupMultipartRequest((DocumentRequest) request, finalWriter, post); - } else { - setupPlainRequest(request, finalWriter, post); - } - - RosetteAPIException lastException = null; - int numRetries = this.failureRetries; - while (numRetries-- > 0) { - HttpResponse response = null; - try { - response = httpClient.execute(post); - - T resp = getResponse(response, clazz); - Header ridHeader = response.getFirstHeader("X-RosetteAPI-DocumentRequest-Id"); - if (ridHeader != null && ridHeader.getValue() != null) { - LOG.debug("DocumentRequest ID " + ridHeader.getValue()); - } - responseHeadersToExtendedInformation(resp, response); - return resp; - } catch (RosetteAPIException e) { - // only 5xx errors are worthy retrying, others throw right away - if (e.getHttpStatusCode() < 500) { - throw e; - } else { - lastException = e; - } - } finally { - if (response != null) { - if (response instanceof CloseableHttpResponse) { - ((CloseableHttpResponse)response).close(); - } - } - } - } - throw lastException; - } - - @SuppressWarnings("unchecked") - private void responseHeadersToExtendedInformation(T resp, HttpResponse response) { - for (Header header : response.getAllHeaders()) { - if (resp.getExtendedInformation() != null - && resp.getExtendedInformation().containsKey(header.getName())) { - Set currentSetValue; - if (resp.getExtendedInformation().get(header.getName()) instanceof Set) { - currentSetValue = (Set) resp.getExtendedInformation().get(header.getName()); - } else { - currentSetValue = new HashSet<>(Collections.singletonList(resp.getExtendedInformation().get(header.getName()))); - } - currentSetValue.add(header.getValue()); - resp.setExtendedInformation(header.getName(), currentSetValue); - } else { - resp.setExtendedInformation(header.getName(), header.getValue()); - } - } - } - - private void setupPlainRequest(final Object request, final ObjectWriter finalWriter, HttpPost post) { - // just posting json. - post.addHeader("Content-Type", ContentType.APPLICATION_JSON.getMimeType()); - post.setEntity(new AbstractHttpEntity() { - @Override - public boolean isRepeatable() { - return false; - } - - @Override - public long getContentLength() { - return -1; - } - - @Override - public InputStream getContent() throws IOException, UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - @Override - public void writeTo(OutputStream outstream) throws IOException { - finalWriter.writeValue(outstream, request); - } - - @Override - public boolean isStreaming() { - return false; - } - }); - } - - private void setupMultipartRequest(final DocumentRequest request, final ObjectWriter finalWriter, HttpPost post) { - - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); - builder.setMimeSubtype("mixed"); - builder.setMode(HttpMultipartMode.STRICT); - - FormBodyPartBuilder partBuilder = FormBodyPartBuilder.create("request", - // Make sure we're not mislead by someone who puts a charset into the mime type. - new AbstractContentBody(ContentType.parse(ContentType.APPLICATION_JSON.getMimeType())) { - @Override - public String getFilename() { - return null; - } - - @Override - public void writeTo(OutputStream out) throws IOException { - finalWriter.writeValue(out, request); - } - - @Override - public String getTransferEncoding() { - return MIME.ENC_BINARY; - } - - @Override - public long getContentLength() { - return -1; - } - }); - - // Either one of 'name=' or 'Content-ID' would be enough. - partBuilder.setField(MIME.CONTENT_DISPOSITION, "inline;name=\"request\""); - partBuilder.setField("Content-ID", "request"); - - builder.addPart(partBuilder.build()); - - partBuilder = FormBodyPartBuilder.create("content", new InputStreamBody(request.getContentBytes(), ContentType.parse(request.getContentType()))); - partBuilder.setField(MIME.CONTENT_DISPOSITION, "inline;name=\"content\""); - partBuilder.setField("Content-ID", "content"); - builder.addPart(partBuilder.build()); - builder.setCharset(StandardCharsets.UTF_8); - - HttpEntity entity = builder.build(); - post.setEntity(entity); - } - - private String headerValueOrNull(Header header) { - if (header == null) { - return null; - } else { - return header.getValue(); - } - } - - /** - * Gets response from HTTP connection, according to the specified response class; - * throws for an error response. - * - * @param httpResponse the response object - * @param clazz Response class - * @return Response - * @throws IOException - * @throws RosetteAPIException if the status is not 200. - */ - private T getResponse(HttpResponse httpResponse, Class clazz) - throws IOException, RosetteAPIException { - int status = httpResponse.getStatusLine().getStatusCode(); - String encoding = headerValueOrNull(httpResponse.getFirstHeader(HttpHeaders.CONTENT_ENCODING)); - - try ( - InputStream stream = httpResponse.getEntity().getContent(); - InputStream inputStream = "gzip".equalsIgnoreCase(encoding) ? new GZIPInputStream(stream) : stream) { - String ridHeader = headerValueOrNull(httpResponse.getFirstHeader("X-RosetteAPI-DocumentRequest-Id")); - if (HTTP_OK != status) { - String ecHeader = headerValueOrNull(httpResponse.getFirstHeader("X-RosetteAPI-Status-Code")); - String emHeader = headerValueOrNull(httpResponse.getFirstHeader("X-RosetteAPI-Status-Message")); - String responseContentType = headerValueOrNull(httpResponse.getFirstHeader(HttpHeaders.CONTENT_TYPE)); - if ("application/json".equals(responseContentType)) { - ErrorResponse errorResponse = mapper.readValue(inputStream, ErrorResponse.class); - if (ridHeader != null) { - LOG.debug("DocumentRequest ID " + ridHeader); - } - if (ecHeader != null) { - errorResponse.setCode(ecHeader); - } - if (429 == status) { - String concurrencyMessage = "You have exceeded your plan's limit on concurrent calls. " - + "This could be caused by multiple processes or threads making Rosette API calls in parallel, " - + "or if your httpClient is configured with higher concurrency than your plan allows."; - if (emHeader == null) { - emHeader = concurrencyMessage; - } else { - emHeader = concurrencyMessage + System.lineSeparator() + emHeader; - } - } - if (emHeader != null) { - errorResponse.setMessage(emHeader); - } - throw new RosetteAPIException(status, errorResponse); - } else { - String errorContent; - if (inputStream != null) { - byte[] content = getBytes(inputStream); - errorContent = new String(content, "utf-8"); - } else { - errorContent = "(no body)"; - } - // something not from us at all - throw new RosetteAPIException(status, new ErrorResponse("invalidErrorResponse", errorContent)); - } - } else { - return mapper.readValue(inputStream, clazz); - } - } - } - - /** - * Returns a byte array from InputStream. - * - * @param is InputStream - * @return byte array - * @throws IOException - */ - private static byte[] getBytes(InputStream is) throws IOException { - return ByteStreams.toByteArray(is); - } - - @Override - public void close() throws IOException { - if (closeClientOnClose - && httpClient instanceof CloseableHttpClient) { - ((CloseableHttpClient)httpClient).close(); - } - } - - private DocumentRequest.BaseBuilder getDocumentRequestBuilder() throws IOException { - return new DocumentRequest.Builder() - .language(language) - .genre(genre) - .options(options); - } - - /** - * Builder class for the RosetteAPI object. - */ - public static class Builder { - protected LanguageCode language; - protected String genre; - protected Options options; - protected String key; - protected String urlBase = DEFAULT_URL_BASE; - protected int failureRetries = 1; - protected int connectionConcurrency = 2; - protected HttpClient httpClient; - private List
customHeaders = new ArrayList<>(); - - protected Builder getThis() { - return this; - } - - /** - * Set the language of the input. - * @param language the language. - * @return this - */ - public Builder language(LanguageCode language) { - this.language = language; - return getThis(); - } - - /** - * Set the options for this request. - * @param options the options. - * @return this - */ - public Builder options(Options options) { - this.options = options; - return getThis(); - } - - /** - * Set the genre of the request. - * @param genre genre (ex: social-media) - * @return this - */ - public Builder genre(String genre) { - this.genre = genre; - return getThis(); - } - - /** - * Set the apiKey for the requests - * @param key apiKey - * @return this - */ - public Builder apiKey(String key) { - this.key = key; - return getThis(); - } - - /** - * Sets an alternative url for testing purposes - * @param url alternative url - * @return this - */ - public Builder alternateUrl(String url) { - if (url != null) { - this.urlBase = url; - } - return getThis(); - } - - /** - * Set failure retries, default 1 - * @param retries number of retries - * @return this - */ - public Builder failureRetries(int retries) { - this.failureRetries = retries; - return getThis(); - } - - /** - * User can provide their own http client. - * - * @param client CloseableHttpClient - * @return this - */ - public Builder httpClient(HttpClient client) { - this.httpClient = client; - return getThis(); - } - - /** - * Add a custom HTTP header to pass to Rosette API. - * This option will be ignored if the user provides an HttpClient object. - * - * @param name header name - * @param value header value - * @return this - */ - public Builder withCustomHeader(String name, String value) { - customHeaders.add(new BasicHeader(name, value)); - return getThis(); - } - - /** - * Add a custom HTTP header to pass to Rosette API. - * This option will be ignored if the user provides an HttpClient object. - * - * @param header header - * @return this - */ - public Builder withCustomHeader(Header header) { - customHeaders.add(header); - return getThis(); - } - - /** - * Set the maximum number of concurrent connections for a RosetteAPI object. - * - * @param connectionConcurrency - * @return this - */ - public Builder connectionConcurrency(int connectionConcurrency) { - this.connectionConcurrency = connectionConcurrency; - return getThis(); - } - - /** - * Construct the api object. - * - * @throws IOException - * @throws RosetteAPIException - * @return the api object. - */ - public RosetteAPI build() throws IOException, RosetteAPIException { - return new RosetteAPI(key, urlBase, failureRetries, language, genre, options, httpClient, customHeaders, connectionConcurrency); - } - } -} diff --git a/api/src/main/java/com/basistech/rosette/api/RosetteAPIException.java b/api/src/main/java/com/basistech/rosette/api/RosetteAPIException.java deleted file mode 100644 index 7fdb1d925..000000000 --- a/api/src/main/java/com/basistech/rosette/api/RosetteAPIException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.api; - -import com.basistech.rosette.apimodel.ErrorResponse; - -import com.google.common.base.Objects; - -/** - * Exception thrown by the obsolete {@link RosetteAPI}. - */ -@Deprecated -public class RosetteAPIException extends Exception { - - private final int httpStatusCode; - private final String code; - private final String message; - - public RosetteAPIException(int httpStatusCode, ErrorResponse response) { - this.httpStatusCode = httpStatusCode; - code = response.getCode(); - message = response.getMessage(); - } - - public String getCode() { - return code; - } - - @Override - public String getMessage() { - return message; - } - - public String toString() { - return Objects.toStringHelper(this).add("http status code", httpStatusCode) - .add("code", code) - .add("message", message) - .toString(); - } - - public int getHttpStatusCode() { - return httpStatusCode; - } -} diff --git a/api/src/test/java/com/basistech/rosette/api/BasicTest.java b/api/src/test/java/com/basistech/rosette/api/BasicTest.java index 748d39804..174c0ea82 100644 --- a/api/src/test/java/com/basistech/rosette/api/BasicTest.java +++ b/api/src/test/java/com/basistech/rosette/api/BasicTest.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -167,7 +167,8 @@ public void testAdm() throws Exception { .build(); AnnotatedText testData = ApiModelMixinModule.setupObjectMapper( new ObjectMapper()).readValue(reqIns, AnnotatedText.class); - AnnotatedText resp = api.perform(HttpRosetteAPI.ENTITIES_SERVICE_PATH, new AdmRequest<>(testData, null, null, null)); + AnnotatedText resp = api.perform(HttpRosetteAPI.ENTITIES_SERVICE_PATH, + AdmRequest.builder().text(testData).build()); assertEquals("Q100", resp.getEntities().get(0).getEntityId()); } } diff --git a/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java b/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java index 766303d8e..ee9ad2a5a 100644 --- a/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java +++ b/api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,10 +56,9 @@ public void after() throws IOException { @Test public void multipart() throws Exception { // this assumes that the server has the mock version of the components. - Request morphologyRequest = new DocumentRequest.Builder<>() - .language(LanguageCode.ENGLISH) - .options(new MorphologyOptions(false, false, PartOfSpeechTagSet.upt16)) - .contentBytes("This is the cereal shot from 1 gun .".getBytes(Charsets.UTF_8), "text/plain;charset=utf-8") + Request morphologyRequest = DocumentRequest.builder().language(LanguageCode.ENGLISH) + .options(MorphologyOptions.builder().partOfSpeechTagSet(PartOfSpeechTagSet.upt16).build()) + .content("This is the cereal shot from 1 gun .".getBytes(Charsets.UTF_8), "text/plain;charset=utf-8") .build(); TokensResponse response = api.perform(AbstractRosetteAPI.TOKENS_SERVICE_PATH, morphologyRequest, TokensResponse.class); assertEquals(9, response.getTokens().size()); @@ -69,9 +68,8 @@ public void multipart() throws Exception { @Test public void simple() throws Exception { // this assumes that the server has the mock version of the components. - Request morphologyRequest = new DocumentRequest.Builder<>() - .language(LanguageCode.ENGLISH) - .options(new MorphologyOptions(false, false, PartOfSpeechTagSet.upt16)) + Request morphologyRequest = DocumentRequest.builder().language(LanguageCode.ENGLISH) + .options(MorphologyOptions.builder().partOfSpeechTagSet(PartOfSpeechTagSet.upt16).build()) .content("This is the cereal shot from 1 gun .") .build(); TokensResponse response = api.perform(AbstractRosetteAPI.TOKENS_SERVICE_PATH, morphologyRequest, TokensResponse.class); diff --git a/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java b/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java index 7c3bcec1f..3c57bcd75 100644 --- a/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java +++ b/api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public void notJsonError() throws Exception { boolean exceptional = false; try { HttpRosetteAPI api = new HttpRosetteAPI.Builder().key("my-key-123").url(mockServiceUrl).build(); - api.perform(AbstractRosetteAPI.LANGUAGE_SERVICE_PATH, new DocumentRequest.Builder<>().content("sample text").build(), LanguageResponse.class); + api.perform(AbstractRosetteAPI.LANGUAGE_SERVICE_PATH, DocumentRequest.builder().content("sample text").build(), LanguageResponse.class); } catch (HttpRosetteAPIException e) { exceptional = true; assertEquals("invalidErrorResponse", e.getErrorResponse().getCode()); diff --git a/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java b/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java deleted file mode 100644 index 8999d32b0..000000000 --- a/api/src/test/java/com/basistech/rosette/api/OldBasicTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.api; - -import com.basistech.rosette.apimodel.Response; -import org.apache.http.HttpHeaders; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockserver.client.server.MockServerClient; -import org.mockserver.junit.MockServerRule; -import org.mockserver.model.Delay; -import org.mockserver.model.HttpRequest; -import org.mockserver.model.HttpResponse; - -import java.io.IOException; -import java.net.ServerSocket; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Set; - -import static java.util.concurrent.TimeUnit.SECONDS; - -@SuppressWarnings("deprecation") -public class OldBasicTest extends AbstractTest { - - @Rule - public MockServerRule mockServerRule = new MockServerRule(this, getFreePort()); - private MockServerClient mockServer; - private RosetteAPI api; - - private static int getFreePort() { - try (ServerSocket socket = new ServerSocket(0)) { - serverPort = socket.getLocalPort(); - } catch (IOException e) { - fail("Failed to allocate a port"); - } - assertNotEquals(0, serverPort); - return serverPort; - } - - @Before - public void setup() { - mockServer.reset(); - // for version check call - } - - // an indirect way to show that connection pooling works - // with concurrent connections = 1, the time to complete requests becomes serial - // so: run several requests in threads, assert that they're executed serially - // then set concurrent connections = 5, - // run several requests again, showing they're executed in parallel - @Test - public void testMultipleConnections() throws IOException, RosetteAPIException, InterruptedException { - int delayTime = 3; - int numConnections = 5; - - mockServer.when(HttpRequest.request() - .withMethod("GET") - .withPath("/rest/v1/info") - .withHeader(HttpHeaders.USER_AGENT, RosetteAPI.USER_AGENT_STR)) - .respond(HttpResponse.response() - .withHeader("Content-Type", "application/json") - .withBody("{\"message\":\"Rosette API at your service\",\"time\":1461788498633}", StandardCharsets.UTF_8) - .withStatusCode(200) - .withDelay(new Delay(SECONDS, delayTime))); - - // "before" case - send off (numConnections) requests, expect them to run serially - api = new RosetteAPI.Builder().connectionConcurrency(1) - .alternateUrl(String.format("http://localhost:%d/rest/v1", serverPort)).build(); - - Date d1 = new Date(); - - List pingers = new ArrayList<>(); - for (int i = 0; i < numConnections; i++) { - pingers.add(new ApiPinger(api)); - pingers.get(i).start(); - } - - for (int i = 0; i < numConnections; i++) { - pingers.get(i).join(); - } - - Date d2 = new Date(); - - assert d2.getTime() - d1.getTime() > delayTime * numConnections * 1000; // at least as long as the delay in the request - - api = new RosetteAPI.Builder().connectionConcurrency(numConnections) - .alternateUrl(String.format("http://localhost:%d/rest/v1", serverPort)) - .build(); - d1 = new Date(); - - pingers = new ArrayList<>(); - for (int i = 0; i < numConnections; i++) { - pingers.add(new ApiPinger(api)); - pingers.get(i).start(); - } - - for (int i = 0; i < numConnections; i++) { - pingers.get(i).join(); - } - - d2 = new Date(); - - assert d2.getTime() - d1.getTime() < delayTime * numConnections * 1000; // less than (numConnections) serial requests - assert d2.getTime() - d1.getTime() > delayTime * 1000; // but at least as long as one - } - - @Test - public void testHeaders() throws Exception { - mockServer.when(HttpRequest.request() - .withMethod("GET") - .withPath("/rest/v1/ping") - .withHeader("X-Foo", "Bar") - .withHeader(HttpHeaders.USER_AGENT, RosetteAPI.USER_AGENT_STR)) - .respond(HttpResponse.response() - .withHeader("Content-Type", "application/json") - .withHeader("X-RosetteAPI-Concurrency", "5") - .withStatusCode(200) - .withBody("{\"message\":\"Rosette API at your service\",\"time\":1461788498633}", StandardCharsets.UTF_8)); - - api = new RosetteAPI.Builder() - .apiKey("foo-key") - .alternateUrl(String.format("http://localhost:%d/rest/v1", serverPort)) - .withCustomHeader("X-Foo", "Bar") - .build(); - api.ping(); - } - - @Test - public void testExtendedInfo() throws Exception { - mockServer.when(HttpRequest.request() - .withMethod("GET") - .withPath("/rest/v1/ping")) - .respond(HttpResponse.response() - .withStatusCode(200) - .withHeader("Content-Type", "application/json") - .withHeader("X-Foo", "Bar") - .withHeader("X-FooMulti", "Bar1", "Bar2") - .withHeader("X-RosetteAPI-Concurrency", "5") - .withBody("{\"message\":\"Rosette API at your service\",\"time\":1461788498633}", StandardCharsets.UTF_8)); - api = new RosetteAPI("foo-key", String.format("http://localhost:%d/rest/v1", serverPort)); - Response resp = api.ping(); - assertEquals("Bar", resp.getExtendedInformation().get("X-Foo")); - Set foos = (Set)resp.getExtendedInformation().get("X-FooMulti"); - assertTrue(foos.contains("Bar1")); - assertTrue(foos.contains("Bar2")); - } - - private class ApiPinger extends Thread { - RosetteAPI api1; - - ApiPinger(RosetteAPI api) throws IOException, RosetteAPIException { - this.api1 = api; - } - - @Override - public void run() { - try { - api1.info(); - } catch (IOException e) { - e.printStackTrace(); - } catch (RosetteAPIException e) { - e.printStackTrace(); - } - } - } -} diff --git a/examples/src/main/java/com/basistech/rosette/examples/CategoriesExample.java b/examples/src/main/java/com/basistech/rosette/examples/CategoriesExample.java index 63f8bcb21..4ac8d2c21 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/CategoriesExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/CategoriesExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder().contentUri(categoriesUrlData).build(); + DocumentRequest request = DocumentRequest.builder().contentUri(categoriesUrlData).build(); CategoriesResponse response = rosetteApi.perform(HttpRosetteAPI.CATEGORIES_SERVICE_PATH, request, CategoriesResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/EntitiesExample.java b/examples/src/main/java/com/basistech/rosette/examples/EntitiesExample.java index 8c14567f4..72cfeb04d 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/EntitiesExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/EntitiesExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,9 @@ private void run() throws IOException { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder().content(entitiesTextData).build(); + DocumentRequest request = DocumentRequest.builder() + .content(entitiesTextData) + .build(); EntitiesResponse response = rosetteApi.perform(HttpRosetteAPI.ENTITIES_SERVICE_PATH, request, EntitiesResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java b/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java index 918f4336d..981fb7455 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java +++ b/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; /** - * Provides examples on how to use the {@link com.basistech.rosette.api.RosetteAPI RosetteAPI} + * Provides examples on how to use the {@link com.basistech.rosette.api.HttpRosetteAPI HttpRosetteAPI} */ public abstract class ExampleBase { private static final String KEY_PROP_NAME = "rosette.api.key"; @@ -32,7 +32,7 @@ public abstract class ExampleBase { + "-D" + KEY_PROP_NAME + "= " + "-D" + URL_PROP_NAME + "= "; /** - * @return api key using system property {@value #KEY_PROP_NAME} + * @return api key using system property {@value com.basistech.rosette.examples.ExampleBase#KEY_PROP_NAME} */ protected String getApiKeyFromSystemProperty() { String apiKeyStr = System.getProperty(KEY_PROP_NAME); @@ -44,7 +44,7 @@ protected String getApiKeyFromSystemProperty() { } /** - * @return alternate url using system property {@value #URL_PROP_NAME} + * @return alternate url using system property {@value com.basistech.rosette.examples.ExampleBase#URL_PROP_NAME} */ protected String getAltUrlFromSystemProperty() { String altUrlStr = System.getProperty(URL_PROP_NAME); diff --git a/examples/src/main/java/com/basistech/rosette/examples/InfoExample.java b/examples/src/main/java/com/basistech/rosette/examples/InfoExample.java index 4b193984a..30c3fd5db 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/InfoExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/InfoExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/src/main/java/com/basistech/rosette/examples/LanguageExample.java b/examples/src/main/java/com/basistech/rosette/examples/LanguageExample.java index e2390bfda..4a5ecb81c 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/LanguageExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/LanguageExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder().content(languageData).build(); + DocumentRequest request = DocumentRequest.builder().content(languageData).build(); LanguageResponse response = rosetteApi.perform(HttpRosetteAPI.LANGUAGE_SERVICE_PATH, request, LanguageResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompleteExample.java b/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompleteExample.java index 88024993c..ccaab26d6 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompleteExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompleteExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ private void run() throws IOException { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder().content(morphologyCompleteData).build(); + DocumentRequest request = DocumentRequest.builder().content(morphologyCompleteData).build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) MorphologyResponse response = rosetteApi.perform(HttpRosetteAPI.MORPHOLOGY_SERVICE_PATH + "/" + MorphologicalFeature.COMPLETE, request, MorphologyResponse.class); diff --git a/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompoundComponentsExample.java b/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompoundComponentsExample.java index 786226f9f..7dfaac954 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompoundComponentsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/MorphologyCompoundComponentsExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder().content(morphologyCompoundComponentsData) + DocumentRequest request = DocumentRequest.builder().content(morphologyCompoundComponentsData) .language(LanguageCode.GERMAN) // example of specifying the language. .build(); MorphologyResponse response = rosetteApi.perform(HttpRosetteAPI.MORPHOLOGY_SERVICE_PATH + "/" + MorphologicalFeature.COMPOUND_COMPONENTS, diff --git a/examples/src/main/java/com/basistech/rosette/examples/MorphologyHanReadingsExample.java b/examples/src/main/java/com/basistech/rosette/examples/MorphologyHanReadingsExample.java index b62d55c6b..772335a3b 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/MorphologyHanReadingsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/MorphologyHanReadingsExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ private void run() throws IOException { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder().content(morphologyHanReadingsData) + DocumentRequest request = DocumentRequest.builder().content(morphologyHanReadingsData) .build(); MorphologyResponse response = rosetteApi.perform(HttpRosetteAPI.MORPHOLOGY_SERVICE_PATH + "/" + MorphologicalFeature.HAN_READINGS, request, MorphologyResponse.class); diff --git a/examples/src/main/java/com/basistech/rosette/examples/MorphologyLemmasExample.java b/examples/src/main/java/com/basistech/rosette/examples/MorphologyLemmasExample.java index 9a71db162..48ce41b64 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/MorphologyLemmasExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/MorphologyLemmasExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ private void run() throws IOException { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder().content(morphologyLemmasData) + DocumentRequest request = DocumentRequest.builder().content(morphologyLemmasData) .build(); MorphologyResponse response = rosetteApi.perform(HttpRosetteAPI.MORPHOLOGY_SERVICE_PATH + "/" + MorphologicalFeature.LEMMAS, request, MorphologyResponse.class); diff --git a/examples/src/main/java/com/basistech/rosette/examples/MorphologyPartsOfSpeechExample.java b/examples/src/main/java/com/basistech/rosette/examples/MorphologyPartsOfSpeechExample.java index c29be7dc7..978ff499d 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/MorphologyPartsOfSpeechExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/MorphologyPartsOfSpeechExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ private void run() throws IOException { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder().content(morphologyPartsOfSpeechData) + DocumentRequest request = DocumentRequest.builder().content(morphologyPartsOfSpeechData) .build(); MorphologyResponse response = rosetteApi.perform(HttpRosetteAPI.MORPHOLOGY_SERVICE_PATH + "/" + MorphologicalFeature.PARTS_OF_SPEECH, request, MorphologyResponse.class); diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java index c1b048f60..96de487e1 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/NameDeduplicationExample.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; /** * Example which demonstrates name deduplication. @@ -39,10 +40,11 @@ public static void main(String[] args) { private void run() throws IOException { String nameDedupeData = "John Smith,Johnathon Smith,Fred Jones"; + List listOfNames = new ArrayList(Arrays.asList(nameDedupeData.split(","))); ArrayList names = new ArrayList<>(); - for (String name: new ArrayList(Arrays.asList(nameDedupeData.split(",")))) { - names.add(new Name(name)); + for (String name: listOfNames) { + names.add(Name.builder().text(name).build()); } double threshold = 0.75; @@ -52,7 +54,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - NameDeduplicationRequest request = new NameDeduplicationRequest(names, threshold); + NameDeduplicationRequest request = NameDeduplicationRequest.builder().names(names).threshold(threshold).build(); NameDeduplicationResponse response = rosetteApi.perform(HttpRosetteAPI.NAME_DEDUPLICATION_SERVICE_PATH, request, NameDeduplicationResponse.class); System.out.println(responseToJson(response)); diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameSimilarityExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameSimilarityExample.java index 7cca346a2..a260ec6f3 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/NameSimilarityExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/NameSimilarityExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,15 +40,19 @@ public static void main(String[] args) { private void run() throws IOException { String matchedNameData1 = "Michael Jackson"; String matchedNameData2 = "迈克尔·杰克逊"; - Name name1 = new Name(matchedNameData1, "PERSON", ISO15924.Zyyy, LanguageCode.ENGLISH); - Name name2 = new Name(matchedNameData2); + Name name1 = Name.builder().text(matchedNameData1) + .entityType("PERSON") + .script(ISO15924.Zyyy) + .language(LanguageCode.ENGLISH) + .build(); + Name name2 = Name.builder().text(matchedNameData2).build(); HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - NameSimilarityRequest request = new NameSimilarityRequest(name1, name2); + NameSimilarityRequest request = NameSimilarityRequest.builder().name1(name1).name2(name2).build(); NameSimilarityResponse response = rosetteApi.perform(HttpRosetteAPI.NAME_SIMILARITY_SERVICE_PATH, request, NameSimilarityResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/NameTranslationExample.java b/examples/src/main/java/com/basistech/rosette/examples/NameTranslationExample.java index 3c56576c4..d8b8e7b3b 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/NameTranslationExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/NameTranslationExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,9 @@ public static void main(String[] args) { private void run() throws IOException { String translatedNameData = "معمر محمد أبو منيار القذاف"; - NameTranslationRequest request = new NameTranslationRequest.Builder(translatedNameData, LanguageCode.ENGLISH) + NameTranslationRequest request = NameTranslationRequest.builder() + .name(translatedNameData) + .targetLanguage(LanguageCode.ENGLISH) .build(); HttpRosetteAPI rosetteApi = new HttpRosetteAPI.Builder() diff --git a/examples/src/main/java/com/basistech/rosette/examples/PingExample.java b/examples/src/main/java/com/basistech/rosette/examples/PingExample.java index 919174f88..1731174f9 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/PingExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/PingExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/src/main/java/com/basistech/rosette/examples/RelationshipsExample.java b/examples/src/main/java/com/basistech/rosette/examples/RelationshipsExample.java index 381daaeff..a18df2d18 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/RelationshipsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/RelationshipsExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,13 @@ import com.basistech.rosette.api.HttpRosetteAPI; import com.basistech.rosette.apimodel.DocumentRequest; -import com.basistech.rosette.apimodel.LanguageOptions; +import com.basistech.rosette.apimodel.RelationshipsOptions; import com.basistech.rosette.apimodel.RelationshipsResponse; import java.io.IOException; /** - * Example which demonstrates the entity extraction api. + * Example which demonstrates the relationships extraction api. */ public final class RelationshipsExample extends ExampleBase { public static void main(String[] args) { @@ -44,7 +44,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder().content(relationshipsTextData).build(); + DocumentRequest request = DocumentRequest.builder().content(relationshipsTextData).build(); RelationshipsResponse response = rosetteApi.perform(HttpRosetteAPI.RELATIONSHIPS_SERVICE_PATH, request, RelationshipsResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/SentencesExample.java b/examples/src/main/java/com/basistech/rosette/examples/SentencesExample.java index 3367d2c89..e7d74d236 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/SentencesExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/SentencesExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ private void run() throws IOException { //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) // When no options, use . - DocumentRequest request = new DocumentRequest.Builder<>().content(sentencesData).build(); + DocumentRequest request = DocumentRequest.builder().content(sentencesData).build(); SentencesResponse response = rosetteApi.perform(HttpRosetteAPI.SENTENCES_SERVICE_PATH, request, SentencesResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/SentimentExample.java b/examples/src/main/java/com/basistech/rosette/examples/SentimentExample.java index 0d5262550..2344f99e3 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/SentimentExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/SentimentExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ private void run() throws IOException { //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) // When no options, use . - DocumentRequest request = new DocumentRequest.Builder().contentBytes(inputStream, "text/html").build(); + DocumentRequest request = DocumentRequest.builder().content(inputStream, "text/html").build(); SentimentResponse response = rosetteApi.perform(HttpRosetteAPI.SENTIMENT_SERVICE_PATH, request, SentimentResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/SyntaxDependenciesExample.java b/examples/src/main/java/com/basistech/rosette/examples/SyntaxDependenciesExample.java index 1eb40a35e..0e7f0c2d3 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/SyntaxDependenciesExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/SyntaxDependenciesExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ private void run() throws IOException { .build(); //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder<>().content(syntaxDependenciesData).build(); + DocumentRequest request = DocumentRequest.builder().content(syntaxDependenciesData).build(); SyntaxDependenciesResponse response = rosetteApi.perform(HttpRosetteAPI.SYNTAX_DEPENDENCIES_SERVICE_PATH, request, SyntaxDependenciesResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/TextEmbeddingExample.java b/examples/src/main/java/com/basistech/rosette/examples/TextEmbeddingExample.java index 1e75ab573..e36688128 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TextEmbeddingExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TextEmbeddingExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ private void run() throws IOException { //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) // When no options, use . - DocumentRequest request = new DocumentRequest.Builder<>().content(embeddingsData).build(); + DocumentRequest request = DocumentRequest.builder().content(embeddingsData).build(); TextEmbeddingResponse response = rosetteApi.perform(HttpRosetteAPI.TEXT_EMBEDDING_SERVICE_PATH, request, TextEmbeddingResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/TokensExample.java b/examples/src/main/java/com/basistech/rosette/examples/TokensExample.java index 8d0818367..c649d7a53 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TokensExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TokensExample.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ private void run() throws IOException { //The api object creates an http client, but to provide your own: //api.httpClient(CloseableHttpClient) // When no options, use . - DocumentRequest request = new DocumentRequest.Builder<>().content(tokensData).build(); + DocumentRequest request = DocumentRequest.builder().content(tokensData).build(); TokensResponse response = rosetteApi.perform(HttpRosetteAPI.TOKENS_SERVICE_PATH, request, TokensResponse.class); System.out.println(responseToJson(response)); } diff --git a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java index 8e3646f6e..7296e96e8 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TopicsExample.java @@ -17,6 +17,7 @@ import com.basistech.rosette.api.HttpRosetteAPI; import com.basistech.rosette.apimodel.DocumentRequest; +import com.basistech.rosette.apimodel.TopicsOptions; import com.basistech.rosette.apimodel.TopicsResponse; import com.basistech.util.LanguageCode; @@ -39,7 +40,7 @@ private void run() throws Exception { .key(getApiKeyFromSystemProperty()) .url(getAltUrlFromSystemProperty()) .build(); - DocumentRequest request = new DocumentRequest.Builder() + DocumentRequest request = DocumentRequest.builder() .language(LanguageCode.ENGLISH) .content(topicsData) .build(); diff --git a/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java b/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java index 235fd4905..4b3f250f7 100644 --- a/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java +++ b/examples/src/main/java/com/basistech/rosette/examples/TransliterationExample.java @@ -45,7 +45,7 @@ private void run() throws IOException { .build(); // The API object creates an HTTP client, but to provide your own: // HttpRosetteAPI.Builder#httpClient(CloseableHttpClient) - DocumentRequest request = new DocumentRequest.Builder() + DocumentRequest request = DocumentRequest.builder() .content(transliterationData) .language(LanguageCode.ARABIC) .build(); diff --git a/json/pom.xml b/json/pom.xml index 51dcfa069..1f6e550dc 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -54,7 +54,7 @@ org.reflections reflections - 0.9.10 + 0.9.10 test @@ -78,6 +78,25 @@ + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + ../model/target/generated-sources/annotations + + + + + diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/AccuracyModeMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AccuracyModeMixin.java index d19232b9f..0b095c7e0 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/AccuracyModeMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AccuracyModeMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,12 @@ package com.basistech.rosette.apimodel.jackson; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize(using = AccuracyModeSerializer.class, keyUsing = AccuracyModeSerializer.class) @JsonDeserialize(using = AccuracyModeDeserializer.class) -public class AccuracyModeMixin extends BaseMixin { +@JsonInclude(JsonInclude.Include.NON_NULL) +abstract class AccuracyModeMixin { } diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java index a018db638..8ebbd1d1a 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java @@ -1,5 +1,5 @@ /* -* Copyright 2014 Basis Technology Corp. +* Copyright 2017 Basis Technology Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,30 @@ import com.basistech.rosette.apimodel.Options; import com.basistech.rosette.dm.AnnotatedText; import com.basistech.util.LanguageCode; -import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; //CHECKSTYLE:OFF @JsonTypeName("AdmRequest") -public abstract class AdmRequestMixin extends BaseMixin { +@JsonInclude(JsonInclude.Include.NON_NULL) +public abstract class AdmRequestMixin { + // unable to use builder due to https://github.com/FasterXML/jackson-databind/issues/921 @JsonCreator protected AdmRequestMixin( - @JsonProperty("text") AnnotatedText text, - @JsonProperty("options") Options options, - @JsonProperty("genre") String genre, - @JsonProperty("language") LanguageCode language - ) { + @JsonProperty("profileId") String profileId, + @JsonProperty("text") AnnotatedText text, + @JsonProperty("options") Options options, + @JsonProperty("genre") String genre, + @JsonProperty("language") LanguageCode language + ) { // } + + @JsonPOJOBuilder(withPrefix = "") + abstract class AdmRequestBuilderMixin { + } } diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java index 6fac268e1..0c1809b2b 100644 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java +++ b/json/src/main/java/com/basistech/rosette/apimodel/jackson/ApiModelMixinModule.java @@ -18,63 +18,12 @@ import com.basistech.rosette.apimodel.AccuracyMode; import com.basistech.rosette.apimodel.AdmRequest; -import com.basistech.rosette.apimodel.CategoriesOptions; -import com.basistech.rosette.apimodel.CategoriesResponse; -import com.basistech.rosette.apimodel.Concept; -import com.basistech.rosette.apimodel.ConstantsResponse; -import com.basistech.rosette.apimodel.Dependency; import com.basistech.rosette.apimodel.DocumentRequest; -import com.basistech.rosette.apimodel.EntitiesOptions; -import com.basistech.rosette.apimodel.EntitiesResponse; -import com.basistech.rosette.apimodel.EntityMention; -import com.basistech.rosette.apimodel.EntitySentiment; -import com.basistech.rosette.apimodel.ErrorResponse; -import com.basistech.rosette.apimodel.InfoResponse; -import com.basistech.rosette.apimodel.Keyphrase; -import com.basistech.rosette.apimodel.Label; -import com.basistech.rosette.apimodel.LanguageDetectionResult; -import com.basistech.rosette.apimodel.LanguageOptions; -import com.basistech.rosette.apimodel.LanguageResponse; -import com.basistech.rosette.apimodel.LanguageWeight; -import com.basistech.rosette.apimodel.LinkedEntitiesResponse; -import com.basistech.rosette.apimodel.LinkedEntity; -import com.basistech.rosette.apimodel.MentionOffsets; -import com.basistech.rosette.apimodel.MorphologyOptions; -import com.basistech.rosette.apimodel.MorphologyResponse; import com.basistech.rosette.apimodel.Name; import com.basistech.rosette.apimodel.NameDeduplicationRequest; -import com.basistech.rosette.apimodel.NameDeduplicationResponse; import com.basistech.rosette.apimodel.NameSimilarityRequest; -import com.basistech.rosette.apimodel.NameSimilarityResponse; import com.basistech.rosette.apimodel.NameTranslationRequest; -import com.basistech.rosette.apimodel.NameTranslationResponse; -import com.basistech.rosette.apimodel.Options; -import com.basistech.rosette.apimodel.PingResponse; -import com.basistech.rosette.apimodel.RegionDetectionResult; -import com.basistech.rosette.apimodel.Relationship; -import com.basistech.rosette.apimodel.RelationshipsOptions; -import com.basistech.rosette.apimodel.RelationshipsResponse; -import com.basistech.rosette.apimodel.Response; -import com.basistech.rosette.apimodel.SentenceWithDependencies; -import com.basistech.rosette.apimodel.SentencesResponse; import com.basistech.rosette.apimodel.SentimentModelType; -import com.basistech.rosette.apimodel.SentimentOptions; -import com.basistech.rosette.apimodel.SentimentResponse; -import com.basistech.rosette.apimodel.SyntaxDependenciesResponse; -import com.basistech.rosette.apimodel.TextEmbeddingResponse; -import com.basistech.rosette.apimodel.TokensResponse; -import com.basistech.rosette.apimodel.TopicsOptions; -import com.basistech.rosette.apimodel.TopicsResponse; -import com.basistech.rosette.apimodel.TransliterationOptions; -import com.basistech.rosette.apimodel.TransliterationResponse; -import com.basistech.rosette.apimodel.batch.BatchRequest; -import com.basistech.rosette.apimodel.batch.BatchRequestItem; -import com.basistech.rosette.apimodel.batch.BatchResponse; -import com.basistech.rosette.apimodel.batch.BatchStatusResponse; -import com.basistech.rosette.apimodel.jackson.batch.BatchRequestItemMixin; -import com.basistech.rosette.apimodel.jackson.batch.BatchRequestMixin; -import com.basistech.rosette.apimodel.jackson.batch.BatchResponseMixin; -import com.basistech.rosette.apimodel.jackson.batch.BatchStatusResponseMixin; import com.basistech.rosette.dm.jackson.AnnotatedDataModelModule; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; @@ -92,71 +41,35 @@ public ApiModelMixinModule() { } public void setupModule(Module.SetupContext context) { + super.setupModule(context); - context.setMixInAnnotations(Response.class, ResponseMixin.class); - context.setMixInAnnotations(Label.class, LabelMixin.class); - context.setMixInAnnotations(CategoriesOptions.class, CategoriesOptionsMixin.class); - context.setMixInAnnotations(CategoriesResponse.class, CategoriesResponseMixin.class); - context.setMixInAnnotations(ConstantsResponse.class, ConstantsResponseMixin.class); - context.setMixInAnnotations(EntitiesOptions.class, EntitiesOptionsMixin.class); - context.setMixInAnnotations(EntitiesResponse.class, EntityResponseMixin.class); - context.setMixInAnnotations(EntityMention.class, EntityMentionMixin.class); - context.setMixInAnnotations(EntitySentiment.class, EntitySentimentMixin.class); - context.setMixInAnnotations(ErrorResponse.class, ErrorResponseMixin.class); - context.setMixInAnnotations(EntityMention.class, EntityMentionMixin.class); - context.setMixInAnnotations(InfoResponse.class, InfoResponseMixin.class); - context.setMixInAnnotations(LanguageDetectionResult.class, LanguageDetectionResultMixin.class); - context.setMixInAnnotations(LanguageOptions.class, LanguageOptionsMixin.class); - context.setMixInAnnotations(RegionDetectionResult.class, RegionDetectionResultMixin.class); - context.setMixInAnnotations(LanguageResponse.class, LanguageResponseMixin.class); - context.setMixInAnnotations(LanguageWeight.class, LanguageWeightMixin.class); - context.setMixInAnnotations(LinkedEntity.class, LinkedEntityMixin.class); - context.setMixInAnnotations(LinkedEntitiesResponse.class, LinkedEntityResponseMixin.class); - context.setMixInAnnotations(MentionOffsets.class, MentionOffsetsMixin.class); - context.setMixInAnnotations(MorphologyOptions.class, MorphologyOptionsMixin.class); - context.setMixInAnnotations(MorphologyResponse.class, MorphologyResponseMixin.class); + + MixinUtil.addMixins(context); + + context.setMixInAnnotations(DocumentRequest.class, DocumentRequestMixin.class); + context.setMixInAnnotations(DocumentRequest.DocumentRequestBuilder.class, DocumentRequestMixin.DocumentRequestBuilderMixin.class); + context.setMixInAnnotations(AdmRequest.class, AdmRequestMixin.class); + context.setMixInAnnotations(AdmRequest.AdmRequestBuilder.class, AdmRequestMixin.AdmRequestBuilderMixin.class); + context.setMixInAnnotations(Name.class, NameMixin.class); - context.setMixInAnnotations(NameDeduplicationRequest.class, NameDeduplicationRequestMixin.class); - context.setMixInAnnotations(NameDeduplicationResponse.class, NameDeduplicationResponseMixin.class); + context.setMixInAnnotations(Name.NameBuilder.class, NameMixin.NameBuilderMixin.class); context.setMixInAnnotations(NameSimilarityRequest.class, NameSimilarityRequestMixin.class); - context.setMixInAnnotations(NameSimilarityResponse.class, NameSimilarityResponseMixin.class); + context.setMixInAnnotations(NameSimilarityRequest.NameSimilarityRequestBuilder.class, NameSimilarityRequestMixin.NameSimilarityRequestBuilderMixin.class); context.setMixInAnnotations(NameTranslationRequest.class, NameTranslationRequestMixin.class); - context.setMixInAnnotations(NameTranslationResponse.class, NameTranslationResponseMixin.class); - context.setMixInAnnotations(PingResponse.class, PingResponseMixin.class); - context.setMixInAnnotations(DocumentRequest.class, DocumentRequestMixin.class); - context.setMixInAnnotations(AdmRequest.class, AdmRequestMixin.class); - context.setMixInAnnotations(SentencesResponse.class, SentencesResponseMixin.class); - context.setMixInAnnotations(SentimentOptions.class, SentimentOptionsMixin.class); - context.setMixInAnnotations(SentimentResponse.class, SentimentResponseMixin.class); - context.setMixInAnnotations(TokensResponse.class, TokenResponseMixin.class); - context.setMixInAnnotations(RelationshipsResponse.class, RelationshipsResponseMixin.class); - context.setMixInAnnotations(Relationship.class, RelationshipsMixin.class); - context.setMixInAnnotations(RelationshipsOptions.class, RelationshipsOptionsMixin.class); - context.setMixInAnnotations(Options.class, OptionsMixin.class); - context.setMixInAnnotations(TransliterationOptions.class, TransliterationOptionsMixin.class); - context.setMixInAnnotations(TransliterationResponse.class, TransliterationResponseMixin.class); - context.setMixInAnnotations(TopicsOptions.class, TopicsOptionsMixin.class); - context.setMixInAnnotations(TopicsResponse.class, TopicsResponseMixin.class); - context.setMixInAnnotations(Keyphrase.class, KeyphraseMixin.class); - context.setMixInAnnotations(Concept.class, ConceptMixin.class); + context.setMixInAnnotations(NameTranslationRequest.NameTranslationRequestBuilder.class, NameTranslationRequestMixin.NameTranslationRequestBuilderMixin.class); + context.setMixInAnnotations(NameDeduplicationRequest.class, NameDeduplicationRequestMixin.class); + context.setMixInAnnotations(NameDeduplicationRequest.NameDeduplicationRequestBuilder.class, NameDeduplicationRequestMixin.NameDeduplicationRequestBuilderMixin.class); + // TODO: see if there's something similar that can be used to generalize enum handling context.setMixInAnnotations(AccuracyMode.class, AccuracyModeMixin.class); - context.setMixInAnnotations(SentimentModelType.class, SentimentModelTypeMixin.class); SimpleSerializers keySerializers = new SimpleSerializers(); keySerializers.addSerializer(new AccuracyModeSerializer()); - keySerializers.addSerializer(new SentimentModelTypeSerializer()); context.addKeySerializers(keySerializers); - context.setMixInAnnotations(BatchRequest.class, BatchRequestMixin.class); - context.setMixInAnnotations(BatchRequestItem.class, BatchRequestItemMixin.class); - context.setMixInAnnotations(BatchResponse.class, BatchResponseMixin.class); - - context.setMixInAnnotations(BatchStatusResponse.class, BatchStatusResponseMixin.class); - context.setMixInAnnotations(TextEmbeddingResponse.class, TextEmbeddingResponseMixin.class); - - context.setMixInAnnotations(SyntaxDependenciesResponse.class, SyntaxDependenciesResponseMixin.class); - context.setMixInAnnotations(SentenceWithDependencies.class, SentenceWithDependenciesMixin.class); - context.setMixInAnnotations(Dependency.class, DependencyMixin.class); + context.setMixInAnnotations(SentimentModelType.class, SentimentModelTypeMixin.class); + keySerializers = new SimpleSerializers(); + keySerializers.addSerializer(new SentimentModelTypeSerializer()); + context.addKeySerializers(keySerializers); } /** diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/BaseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/BaseMixin.java deleted file mode 100644 index cf96320c5..000000000 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/BaseMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.apimodel.jackson; - -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public abstract class BaseMixin { -} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesOptionsMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesOptionsMixin.java deleted file mode 100644 index 0373d014b..000000000 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesOptionsMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.apimodel.jackson; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeName; - -@JsonTypeName("CategoriesOptions") -public abstract class CategoriesOptionsMixin extends OptionsMixin { - @JsonCreator - private CategoriesOptionsMixin( - @JsonProperty("numCategories") Integer numCategories - ) { - // - } -} diff --git a/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesResponseMixin.java b/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesResponseMixin.java deleted file mode 100644 index 980cb4392..000000000 --- a/json/src/main/java/com/basistech/rosette/apimodel/jackson/CategoriesResponseMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Copyright 2014 Basis Technology Corp. -* -* 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.basistech.rosette.apimodel.jackson; - -import com.basistech.rosette.apimodel.Label; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -public class CategoriesResponseMixin extends BaseMixin { - @JsonCreator - public CategoriesResponseMixin(@JsonProperty("categories") List