Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This REST Handler contains general/utility functionality:

  • endpoints that return Saga configuration and build information
  • endpoint to process text and return the interpretation graph.

Table of Contents
maxLevel2

Saga_rest_endpoint
EndpointprocessText

Will return Saga interpretation graph in the format specified.

By default it returns the graph in HTML format which is the one used by the UI. It also can return JSON or plain text.

Parameters

  • Parameter
    summaryThis is the text to process
    nameq
    requiredtrue
  • Parameter
    summaryList of tags to use to process the text
    nametags
    typestring array
    requiredtrue
  • Parameter
    summarySpecifies the regex to use to split text into TEXT_BLOCKs
    default[\r |\n ]+
    namesplitRegex
  • Parameter
    summarySpecifies the format of the results. It could be one of these values: "ux", "text" or "json"
    defaultux
    nametype
    • text - returns a "line" with the highest confidence route and a text representation of the graph.
    • ux - returns an output useful for Saga to show the graph on a web display.
    • json - returns all the semantic tags on the graph.
  • Parameter
    summaryUsed to pretty format the JSON result
    defaultfalse
    namepretty
    typeboolean

Request Examples

Code Block
languagepowershell
themeFadeToGrey
curl -X ${method} \
  http://localhost:${port}/${url} \
  -H 'Content-Type: application/json' \
  -d '
{
    "q": "I like traveling with Air Paris",
	"tags": ["airline"],
	"splitRegex": "[\r|\n]+",
	"type": "text",
	"pretty": true
}'

Response

Saga_json
{
    "_success": true,
    "data": {
        "line": [
            {
                "character": "0:1",
                "components": [
                    "I like traveling with Air Paris"
                ],
                "stage": "WhitespaceTokenizer",
                "confidence": 0.5,
                "flags": [
                    "TOKEN",
                    "ALL_UPPER_CASE",
                    "ORIGINAL"
                ],
                "_item": "I",
                "matching": "I"
            },
            {
                "character": "2:6",
                "components": [
                    "I like traveling with Air Paris"
                ],
                "stage": "WhitespaceTokenizer",
                "confidence": 0.5,
                "flags": [
                    "TOKEN",
                    "ALL_LOWER_CASE",
                    "ORIGINAL"
                ],
                "_item": "like",
                "matching": "like"
            },
            {
                "character": "7:16",
                "components": [
                    "I like traveling with Air Paris"
                ],
                "stage": "WhitespaceTokenizer",
                "confidence": 0.5,
                "flags": [
                    "TOKEN",
                    "ALL_LOWER_CASE",
                    "ORIGINAL"
                ],
                "_item": "traveling",
                "matching": "traveling"
            },
            {
                "character": "17:21",
                "components": [
                    "I like traveling with Air Paris"
                ],
                "stage": "WhitespaceTokenizer",
                "confidence": 0.4,
                "flags": [
                    "TOKEN",
                    "ALL_LOWER_CASE",
                    "SKIP",
                    "ORIGINAL"
                ],
                "_item": "with",
                "matching": "with"
            },
            {
                "character": "22:31",
                "stage": "DictionaryTagger",
                "display": "Air Paris",
                "patterns": [
                    "Air Orly",
                    "Air Paris"
                ],
                "confidence": 0.6975,
                "flags": [
                    "SEMANTIC_TAG",
                    "ENTITY"
                ],
                "id": "34365531",
                "_item": "{airline}",
                "matching": "Air Paris",
                "tags": [
                    "airline"
                ]
            }
        ],
        "graph": " V-----------[I like traveling with Air Paris]-----------V \n ^-[I]-V-[like]-V-[traveling]-V-[with]-V-[Air]-V-[Paris]-^ \n ^-[i]-^                               ^-[air]-^-[paris]-^ \n                                       ^---[{airline}]---^ \n"
    }
}
Saga_rest_endpoint
Endpointsolution
MethodGET

Returns the information of the solution currently being used. A solution is basically the set of Elasticsearch indices in use.

Request Examples

Code Block
languagepowershell
themeFadeToGrey
curl -X ${method} \
  http://localhost:${port}/${url} \
  -H 'Content-Type: application/json' \
  -d '
{
}'

Response

Saga_json
	"_success": true,
    "elasticSearch": {
    	"indexName": "air"
    },
    "display": "Saga - EN"



Saga_rest_endpoint
Endpointinfo
MethodGET

Returns build specific and configuration information about Saga.

Build information contains title, vendor, version, build revision and date.

Configuration information contains the solution (elastic index) and providers configured at the moment.

Request Examples

Code Block
curl -X ${method} \
  http://localhost:${port}/${url} \
  -H 'Content-Type: application/json' \
  -d '
{
}'


Response

Saga_json
    "msg": "Saga API online",
    "_success": true,
    "buildInfo": {
        "Implementation-Title": "Saga Server",
        "Implementation-Build": "9dde0a32f17264f7b9004fc8d141e5b1cd0838b0",
        "Implementation-Version": "1.0.0-SNAPSHOT",
        "Implementation-Timestamp": "1550261725668",
        "Implementation-Vendor-Id": "com.accenture.saga",
        "Built-By": "ronny.ortega.ugalde",
        "Build-Jdk": "11.0.2",
        "Implementation-Branch": "develop"
    },
    "solutions": [
        {
            "elasticSearch": {
                "indexName": "air"
            },
            "display": "Saga - EN"
        }
    ],
    "providers": [
        {
            "baseDir": "./config",
            "name": "filesystem-provider",
            "type": "FileSystem"
        },
        {
            "hostname": "localhost",
            "scheme": "http",
            "port": 9200,
            "name": "saga-provider",
            "exclude": [
                "updatedAt",
                "createdAt"
            ],
            "type": "Elastic",
            "timestamp": "updatedAt"
        }
    ]