watson-developer-cloud / java-sdk

:1st_place_medal: Java SDK to use the IBM Watson services.
http://watson-developer-cloud.github.io/java-sdk/
Apache License 2.0
593 stars 532 forks source link

[Alchemy-Concepts]- Concepts does not return Knowledge Grapg details #569

Closed Puttappaiahm closed 7 years ago

Puttappaiahm commented 7 years ago

When we access Alchemy Language Concepts API, we do not get the Knowledge Graph details. When I look at the model object Concept, it does not contain any info about Knowledge Graph. Here is the difference between directly accessing the API and accessing the API using Java SDK.

A. When I use the Java SDK. I get the following JSON, which does not contain Knowledge Graph attribute. When I looked at the Concept model object, it does not contain Knowledge graph attribute.

AlchemyLanguage service = new AlchemyLanguage();
Map<String,Object> params = new HashMap<String, Object>();
service.setApiKey(apiKey);
params.put(AlchemyLanguage.TEXT,content);
params.put(AlchemyLanguage.KNOWLEDGE_GRAPH,1);
Concepts docConcepts = service.getConcepts(params).execute();

 {
  "concepts": [
    {
      "dbpedia": "http://dbpedia.org/resource/Road",
      "freebase": "http://rdf.freebase.com/ns/m.06gfj",
      "opencyc": "http://sw.opencyc.org/concept/Mx4rvyNjbZwpEbGdrcN5Y29ycA",
      "relevance": 0.939472,
      "text": "Road"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/Traffic",
      "freebase": "http://rdf.freebase.com/ns/m.0btp2",
      "opencyc": "http://sw.opencyc.org/concept/Mx4rwP1OwZwpEbGdrcN5Y29ycA",
      "relevance": 0.931,
      "text": "Traffic"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/Transport",
      "freebase": "http://rdf.freebase.com/ns/m.07bsy",
      "opencyc": "http://sw.opencyc.org/concept/Mx4rvwe2sJwpEbGdrcN5Y29ycA",
      "relevance": 0.839984,
      "text": "Transport"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/Freeway",
      "opencyc": "http://sw.opencyc.org/concept/Mx4rP9jwioz1QdmCq5ObWNPUIA",
      "relevance": 0.813496,
      "text": "Freeway"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/Motorway",
      "relevance": 0.750144,
      "text": "Motorway"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/All-way_stop",
      "freebase": "http://rdf.freebase.com/ns/m.02z6bxb",
      "relevance": 0.644981,
      "text": "All-way stop",
      "yago": "http://yago-knowledge.org/resource/All-way_stop"
    },
    {
      "dbpedia": "http://dbpedia.org/resource/Pedestrian_crossing",
      "freebase": "http://rdf.freebase.com/ns/m.014xcs",
      "relevance": 0.6156,
      "text": "Pedestrian crossing"
    }
  ],
  "language": "english",
  "url": "https://watson-api-explorer.mybluemix.net/alchemy-api/calls/text/TextGetRankedConcepts",
  "totalTransactions": 2
}

B. As per the API explorer when we test the API :  /text/TextGetRankedConcepts we see the result json object as follows:
{
 "status": "OK",
 "usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html",
 "totalTransactions": "2",
 "language": "english",
 "concepts": [
   {
     "text": "Road",
     "relevance": "0.939472",
     "dbpedia": "http://dbpedia.org/resource/Road",
     "freebase": "http://rdf.freebase.com/ns/m.06gfj",
     "opencyc": "http://sw.opencyc.org/concept/Mx4rvyNjbZwpEbGdrcN5Y29ycA"
   },
   {
     "text": "Traffic",
     "relevance": "0.931",
     "knowledgeGraph": {
       "typeHierarchy": "/issues/traffic"
     },
     "dbpedia": "http://dbpedia.org/resource/Traffic",
     "freebase": "http://rdf.freebase.com/ns/m.0btp2",
     "opencyc": "http://sw.opencyc.org/concept/Mx4rwP1OwZwpEbGdrcN5Y29ycA"
   },
   {
     "text": "Transport",
     "relevance": "0.839984",
     "knowledgeGraph": {
       "typeHierarchy": "/activities/services/transport"
     },
     "dbpedia": "http://dbpedia.org/resource/Transport",
     "freebase": "http://rdf.freebase.com/ns/m.07bsy",
     "opencyc": "http://sw.opencyc.org/concept/Mx4rvwe2sJwpEbGdrcN5Y29ycA"
   },
   {
     "text": "Freeway",
     "relevance": "0.813496",
     "knowledgeGraph": {
       "typeHierarchy": "/projects/roads/freeway"
     },
     "dbpedia": "http://dbpedia.org/resource/Freeway",
     "opencyc": "http://sw.opencyc.org/concept/Mx4rP9jwioz1QdmCq5ObWNPUIA"
   },
   {
     "text": "Motorway",
     "relevance": "0.750144",
     "knowledgeGraph": {
       "typeHierarchy": "/projects/roads/motorway"
     },
     "dbpedia": "http://dbpedia.org/resource/Motorway"
   },
   {
     "text": "All-way stop",
     "relevance": "0.644981",
     "dbpedia": "http://dbpedia.org/resource/All-way_stop",
     "freebase": "http://rdf.freebase.com/ns/m.02z6bxb",
     "yago": "http://yago-knowledge.org/resource/All-way_stop"
   },
   {
     "text": "Pedestrian crossing",
     "relevance": "0.6156",
     "knowledgeGraph": {
       "typeHierarchy": "/locations/pedestrian crossing"
     },
     "dbpedia": "http://dbpedia.org/resource/Pedestrian_crossing",
     "freebase": "http://rdf.freebase.com/ns/m.014xcs"
   }
 ]
}```
Puttappaiahm commented 7 years ago

We are doing a POC at customer site. Quick resolution is highly appreciated.

Puttappaiahm commented 7 years ago

Sorry, clicked a wrong button. Looking for quicker resolution on this issue.