/** Test get corpus. */
 @Test
 public void testGetCorpus() {
   Corpus corpus = service.getCorpus(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpus);
   corpus = service.getCorpus(Corpus.TED_TALKS);
   Assert.assertNotNull(corpus);
 }
  /** Test get corpora by account. */
  @Test
  public void testGetCorporaByAccount() {
    Corpora corpora = service.listCorpora(PUBLIC);
    Assert.assertNotNull(corpora);
    Assert.assertFalse(corpora.getCorpora().isEmpty());

    corpora = service.listCorpora();
    Assert.assertNotNull(corpora);
    Assert.assertFalse(corpora.getCorpora().isEmpty());
  }
 /*
  * (non-Javadoc)
  *
  * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp()
  */
 @Override
 @Before
 public void setUp() throws Exception {
   super.setUp();
   service = new ConceptInsights();
   service.setUsernameAndPassword(
       getValidProperty("concept_insights.username"),
       getValidProperty("concept_insights.password"));
   service.setEndPoint(getValidProperty("concept_insights.url"));
 }
 /** Test get corpus relation scores. */
 @Test
 public void testGetCorpusRelationScores() {
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   Scores scores = service.getCorpusRelationScores(Corpus.IBM_RESEARCHERS, concepts);
   Assert.assertNotNull(scores);
 }
 /** Test get graphs related scores. */
 @Test
 public void testGetGraphsRelatedScores() {
   List<String> concepts = new ArrayList<String>();
   concepts.add(EXAMPLE_CONCEPT.getId());
   Scores scores = service.getGraphRelationScores(EXAMPLE_CONCEPT, concepts);
   Assert.assertNotNull(scores);
 }
 /** Test annotate text. */
 @Test
 public void testAnnotateText() {
   Annotations annotations =
       service.annotateText(
           Graph.WIKIPEDIA, "Nizar Magboul Alseddeg is currently living in Austin Texas");
   Assert.assertNotNull(annotations);
 }
 /** Test get graphs. */
 @Test
 public void testGetGraphs() {
   Graphs graphs = service.listGraphs();
   Assert.assertNotNull(graphs);
   Assert.assertNotNull(graphs.getGraphs());
   Assert.assertFalse(graphs.getGraphs().isEmpty());
 }
 /** Test get document relation scores. */
 @Test
 public void testGetDocumentRelationScores() {
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   Scores scores = service.getDocumentRelationScores(EXAMPLE_DOCUMENT, concepts);
   Assert.assertNotNull(scores);
 }
 /** Test get documnet related concepts. */
 @Test
 public void testGetDocumnetRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LEVEL, "1");
   params.put(ConceptInsights.LIMIT, 10);
   Concepts concepts = service.getDocumentRelatedConcepts(EXAMPLE_DOCUMENT, params);
   Assert.assertNotNull(concepts);
 }
Beispiel #10
0
 /** Test get corpus related concept. */
 @Test
 public void testGetCorpusRelatedConcept() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.PREFIX, false);
   Concepts concepts = service.getCorpusRelatedConcepts(Corpus.IBM_RESEARCHERS, params);
   Assert.assertNotNull(concepts);
 }
Beispiel #11
0
  /** Test list documents. */
  @Test
  public void testListDocuments() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(ConceptInsights.CURSOR, 0);
    params.put(ConceptInsights.LIMIT, 20);

    Documents documents = service.listDocuments(Corpus.TED_TALKS, params);
    Assert.assertNotNull(documents);
  }
Beispiel #12
0
 /** Test get corpus label search. */
 @Test
 public void testGetCorpusLabelSearch() {
   Map<String, Object> query = new HashMap<String, Object>();
   query.put(ConceptInsights.QUERY, "IBM");
   query.put(ConceptInsights.LIMIT, 10);
   query.put(ConceptInsights.PREFIX, false);
   Matches matches = service.searchCorpusByLabel(Corpus.IBM_RESEARCHERS, query);
   Assert.assertNotNull(matches);
 }
Beispiel #13
0
 /** Test conceptual search. */
 @Test
 public void testConceptualSearch() {
   Map<String, Object> params = new HashMap<String, Object>();
   List<String> ids = new ArrayList<String>();
   ids.add(EXAMPLE_CONCEPT.getId());
   params.put(ConceptInsights.IDS, ids);
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.CURSOR, 0);
   QueryConcepts cp = service.conceptualSearch(Corpus.TED_TALKS, params);
   Assert.assertNotNull(cp);
 }
Beispiel #14
0
 /** Test get concept related concepts. */
 @Test
 public void testGetConceptRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.LEVEL, 1);
   RequestedFields fs = new RequestedFields();
   fs.include("abstract");
   params.put("concept_fields", fs);
   Concepts concepts = service.getConceptRelatedConcepts(EXAMPLE_CONCEPT, params);
   Assert.assertNotNull(concepts);
 }
Beispiel #15
0
 /** Test get graph related concepts. */
 @Test
 public void testGetGraphRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.LEVEL, 1);
   RequestedFields fs = new RequestedFields();
   fs.include("abstract");
   params.put("concept_fields", fs);
   Concepts conceptResults = service.getGraphRelatedConcepts(Graph.WIKIPEDIA, concepts, params);
   Assert.assertNotNull(conceptResults);
 }
Beispiel #16
0
  /** Test get graphs label search. */
  @Test
  public void testGetGraphsLabelSearch() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(ConceptInsights.QUERY, "cognitv");
    params.put(ConceptInsights.LIMIT, 10);
    params.put(ConceptInsights.PREFIX, false);

    RequestedFields fs = new RequestedFields();
    fs.include("abstract");
    params.put("concept_fields", fs);

    Matches matches = service.searchGraphsConceptByLabel(Graph.WIKIPEDIA, params);
    Assert.assertNotNull(matches);
    Assert.assertFalse(matches.getMatches().isEmpty());
  }
Beispiel #17
0
 /** Test get concept. */
 @Test
 public void testGetConcept() {
   ConceptMetadata conceptMetaData = service.getConcept(EXAMPLE_CONCEPT);
   Assert.assertNotNull(conceptMetaData);
 }
Beispiel #18
0
 /** Test document annotations. */
 @Test
 public void testDocumentAnnotations() {
   DocumentAnnotations annotations = service.getDocumentAnnotations(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(annotations);
 }
Beispiel #19
0
 /** Testlist corpora. */
 @Test
 public void testlistCorpora() {
   Corpora corpora = service.listCorpora();
   Assert.assertNotNull(corpora);
   Assert.assertFalse(corpora.getCorpora().isEmpty());
 }
Beispiel #20
0
 /** Test get accounts. */
 @Test
 public void testGetAccounts() {
   Accounts accounts = service.getAccountsInfo();
   Assert.assertNotNull(accounts);
   Assert.assertFalse(accounts.getAccounts().isEmpty());
 }
Beispiel #21
0
 /** Test get document processing state. */
 @Test
 public void testGetDocumentProcessingState() {
   DocumentProcessingStatus documentProcessingState =
       service.getDocumentProcessingState(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(documentProcessingState);
 }
Beispiel #22
0
 /** Test get corpus processing state. */
 @Test
 public void testGetCorpusProcessingState() {
   CorpusProcessingState corpusProcessingState =
       service.getCorpusProcessingState(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpusProcessingState);
 }
Beispiel #23
0
 /** Test get corpus stats. */
 @Test
 public void testGetCorpusStats() {
   CorpusStats corpusStats = service.getCorpusStats(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpusStats);
 }
Beispiel #24
0
 /** Test get document. */
 @Test
 public void testGetDocument() {
   Document document = service.getDocument(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(document);
 }