Versions Compared

Key

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

This REST Handler contains:

  • Endpoints that return Saga configuration and build information
  • Endpoints to process text and return the interpretation graph

Table of Contents
maxLevel2

Saga_rest_endpoint
EndpointprocessText
  • Will return a Saga interpretation graph in the format specified
  • By default, it returns the graph in HTML format which is 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
    summaryTag to use to process the text
    nametag
  • Parameter
    summaryPipeline or pipeline stage to use to process the text
    nameprocessor
  • 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
    • ux - Returns an output useful for Saga to show the graph on a web display.
    • text - Returns a "line" with the highest confidence route and a text representation of the graph.
    • 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

  • If true, it will combine all the SEMANTIC_TAGs, which has same matching text and same confidence value
    defaultfalse
    namecombine
    typeboolean

    • The combination includes the metadata, of every SEMANTIC_TAG
  • Parameter
    summaryIf true, it will also add the components from the highest route confidence tokens.
    defaulttrue
    nameaddComponents
    typeboolean
  • Parameter
    summaryApplicable when addComponents is true. Indicates which components to add to the response
    namecompFields
    typestring array

    • If missing all the components will be added
  • Parameter
    summaryIf true, it will add the metadata of the entities found in every SEMANTIC_TAG
    defaultfalse
    namemetadata
    typeboolean
  • Parameter
    summarySpecifies the format of the results. It could be one of these values: "ux", "text" or "json"
    defaultux
    nametype
    • ux - Returns an output useful for Saga to show the graph on a web display.
    • text - Returns a "line" with the highest confidence route and a text representation of the graph.
    • json - Returns all the semantic tags on the graph.
  • Parameter
    summaryUsed to pretty format the JSON result
    defaultfalse
    namepretty
    typeboolean
Note

The parameters tags, tag and processor are mutually exclusive, only one is required, and the priority order is:

  1. tags
  2. tag
  3. processor


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"],
    "combine": true,
    "addComponents": true,
    "compFields": "paris",
	"splitRegex": "[\r\n]+",
	"type": "text",
	"pretty": true
}'

Response

Saga_json
{
  "_success": true,
  "data": {
    "line": [
      {
Saga_json
{
    "_success": true,
    "data": {
        "line": [
            {
                "character": "0:1",
                "components": [
                    "I like traveling with Air Paris"
                ],
                "stage": "WhitespaceTokenizer",
                "confidence": 0.5,
        "match": "I",
        "flags": [
          "ORIGINAL",
          "TOKENALL_UPPER_CASE",
          "TOKEN"
          "ALL_UPPER_CASE"],
           "text": "I",
         "ORIGINALstartPos": 0,
        "endPos": 1
       ]},
      {
          "_itemstage": "IWhitespaceTokenizer",
        "confidence": 0.5,
        "matchingmatch": "Ilike",
        "flags": [
   }       "ORIGINAL",
          "TOKEN",
    {      "ALL_LOWER_CASE"
        ],
        "charactertext": "2:6like",
        "startPos": 2,
        "componentsendPos": [6
      },
      {
        "stage"I like traveling with Air Paris": "WhitespaceTokenizer",
        "confidence": 0.5,
       ] "match": "traveling",
        "flags": [
         "stage": "WhitespaceTokenizerORIGINAL",
          "TOKEN",
          "confidence": 0.5,ALL_LOWER_CASE"
        ],
        "flagstext": ["traveling",
            "startPos": 7,
        "TOKENendPos",: 16
      },
      {
        "ALL_LOWER_CASE"stage": "WhitespaceTokenizer",
        "confidence": 0.4,
        "match":   "ORIGINALwith",
        "flags": [
       ],
    "ORIGINAL",
            "STOP_itemWORD": "like",
          "TOKEN",
        "matching":  "likeALL_LOWER_CASE"
            }],
          "text": "with",
  {
        "startPos": 17,
        "characterendPos": "7:16",21
      },
      {
        "components": [
          {
          "I like traveling with Air Paris""stage": "CaseAnalysis",
                ],
    "confidence": 0.45,
            "stagematch": "WhitespaceTokenizerParis",
                "confidenceflags": 0.5,[
                "flagsORIGINAL": [,
                    "TOKEN"LOWERED",
                    "ALL_LOWER_CASETOKEN",
                    "ORIGINAL"ALL_LOWER_CASE"
                ],
                "_itemtext": "travelingparis",
                "matchingstartPos": "traveling"26,
            }, "endPos": 31
            {}
        ],
        "characterstage": "17:21DictionaryTagger",
        "confidence": 0.6975,
        "componentsdisplay": [ "Air Paris",
        "match": "Air Paris",
          "flags"I: like[
 traveling with Air Paris"
      "SEMANTIC_TAG",
          ],"ENTITY"
        ],
        "stagetext": "WhitespaceTokenizer{airline}",
        "id": "34365531",
        "confidencestartPos": 0.422,
        "endPos": 31,
        "flagstags": [
                    "TOKEN","airline"
        ]
      }
      "ALL_LOWER_CASE"],
    "graph": " V-----------[I like traveling with Air          "SKIP",
  Paris]-----------V \n ^-[I]-V-[like]-V-[traveling]-V-[with]-V-[Air]-V-[Paris]-^ \n ^-[i]-^                  "ORIGINAL"
             ^-[air]-^-[paris]-^ \n  ],
                "_item": "with",
                "matching": "with"
            },
            {
                "character": "22:31",
      ^---[{airline}]---^ \n"
  }
}
Saga_rest_endpoint_legacy
EndpointprocessBatch
  • Will return a Saga interpretation graph in the format specified
  • By default, it returns the graph in HTML format which is used by the UI
  • It also can return JSON or plain text

Parameters

  • Parameter
    summaryList of texts to process
    namebatch
    typestring array
    requiredtrue
  • Parameter
    summaryList of tags to use to process the text
    nametags
    typestring array
    requiredtrue
  • Parameter
    summaryTag to use to process the text
    nametag
  • Parameter
    summaryPipeline or pipeline stage to use to process the text
    nameprocessor
  • Parameter
    summarySpecifies the regex to use to split text into TEXT_BLOCKs
    default[\r\n ]+
    namesplitRegex
  • Parameter
    summaryIf true, it will combine all the SEMANTIC_TAGs, which has same matching text and same confidence value
    defaultfalse
    namecombine
    typeboolean

    • The combination includes the metadata, of every SEMANTIC_TAG
  • Parameter
    summaryIf true, it will also add the components from the highest route confidence tokens.
    defaulttrue
    nameaddComponents
    typeboolean
  • Parameter
    summaryApplicable when addComponents is true. Indicates which components to add to the response
    namecompFields
    typestring array

    • If missing all the components will be added
  • Parameter
    summaryIf true, it will add the metadata of the entities found in every SEMANTIC_TAG
    defaultfalse
    namemetadata
    typeboolean
Note

The parameters tags, tag and processor are mutually exclusive, only one is required, and the priority order is:

  1. tags
  2. tag
  3. processor


Request Examples

Code Block
languagepowershell
themeFadeToGrey
curl -X ${method} \
  http://localhost:${port}/${url} \
  -H 'Content-Type: application/json' \
  -d '
{
    "batch": ["I like traveling with Air Paris", "I enjoy traveling with Delta"],
	"tags": ["airline"],
    "combine": true,
    "addComponents": true,
    "compFields": "paris"
}'

Response

Saga_json
[
    {
        "data": {
            "line": [
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "I",
                    "flags": [
                        "ORIGINAL",
                        "ALL_UPPER_CASE",
                        "TOKEN"
                    ],
                    "text": "I",
                    "startPos": 0,
                    "endPos": 1
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "like",
                    "flags": [
                        "ORIGINAL",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "like",
                    "startPos": 2,
                    "endPos": 6
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "traveling",
                    "flags": [
                        "ORIGINAL",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "traveling",
                    "startPos": 7,
                    "endPos": 16
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.4,
                    "match": "with",
                    "flags": [
                        "ORIGINAL",
                        "STOP_WORD",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "with",
                    "startPos": 17,
                    "endPos": 21
                },
                {
                    "components": [
                        {
                            "stage": "CaseAnalysis",
                            "confidence": 0.45,
                            "match": "Paris",
                            "flags": [
                                "ORIGINAL",
                                "ALL_LOWER_CASE",
                                "LOWERED",
                                "TOKEN"
                            ],
                            "text": "paris",
                            "startPos": 26,
                            "endPos": 31
                        }
                    ],
                    "stage": "DictionaryTagger",
                    "confidence": 0.6975,
                    "display": "Air Paris",
                    "match": "Air Paris",
                    "flags": [
                        "ENTITY",
                        "SEMANTIC_TAG"
                    ],
                    "text": "{airline}",
                    "id": "34365531",
                    "startPos": 22,
                    "endPos": 31,
                    "tags": [
                        "airline"
                    ]
                }
            ],
            "matches": [
                {
                    "components": [
                        {
                            "stage": "CaseAnalysis",
                            "confidence": 0.45,
                            "match": "Paris",
                            "flags": [
                                "ORIGINAL",
                                "ALL_LOWER_CASE",
                                "LOWERED",
                                "TOKEN"
                            ],
                            "text": "paris",
                            "startPos": 26,
                            "endPos": 31
                        }
                    ],
                    "stage": "DictionaryTagger",
                    "confidence": 0.6975,
                    "display": "Air Paris",
                    "match": "Air Paris",
                    "flags": [
                        "ENTITY",
                        "SEMANTIC_TAG"
                    ],
                    "text": "{airline}",
                    "id": "34365531",
                    "startPos": 22,
                    "endPos": 31,
                    "tags": [
                        "airline"
                    ]
                }
            ]
        }
    },
    {
        "data": {
            "line": [
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "I",
                    "flags": [
                        "ORIGINAL",
                        "ALL_UPPER_CASE",
                        "TOKEN"
                    ],
                    "text": "I",
                    "startPos": 0,
                    "endPos": 1
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "enjoy",
                    "flags": [
                        "ORIGINAL",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "enjoy",
                    "startPos": 2,
                    "endPos": 7
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "traveling",
                    "flags": [
                        "ORIGINAL",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "traveling",
                    "startPos": 8,
                    "endPos": 17
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.4,
                    "match": "with",
                    "flags": [
                        "ORIGINAL",
                        "STOP_WORD",
                        "ALL_LOWER_CASE",
                        "TOKEN"
                    ],
                    "text": "with",
                    "startPos": 18,
                    "endPos": 22
                },
                {
                    "stage": "WhitespaceTokenizer",
                    "confidence": 0.5,
                    "match": "Delta",
                    "flags": [
                        "ORIGINAL",
                        "TOKEN",
                        "TITLE_CASE"
                    ],
                    "text": "Delta",
                    "startPos": 23,
                    "endPos": 28
                }
            ],
            "matches": [
                {
                    "stage": "DictionaryTagger",
                    "confidence": 0.44999999999999996,
                    "display": "Delta Air Lines",
                    "match": "Delta",
                    "flags": [
                        "ENTITY",
                        "SEMANTIC_TAG"
                    ],
                    "text": "{airline}",
                    "id": "188920",
                    "startPos": 23,
                    "endPos": 28,
                    "stagetags": "DictionaryTagger",
[
                        "displayairline":
  "Air Paris",
                "patterns": []
                }
    "Air Orly",
       ]
        }
     "Air Paris"
                ],
                "confidence": 0.6975}
]



Saga_rest_endpoint_legacy
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 --location --request GET 'http://localhost:${port}/${url}'

Response

Saga_json
    "_success": true,
        "elasticSearch": {
        "flagsretries": [3,
        "delay": 5,
        "scheme":   "SEMANTIC_TAGhttp",
        "hostnamesAndPorts": [
            "ENTITYlocalhost:9200"
                ],
        "indexName": "pii",
        "idencryptionKey": "34365531f123123##c#$#4GGVqFk7L9123123@*^",
        "timeout": 30
    },
    "_itemdisplay": "Saga"
Saga_rest_endpoint_legacy
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
languagepowershell
themeFadeToGrey
curl --location --request GET 'http://localhost:${port}/${url}'


Response

Saga_json
    "msg": "Saga API online",
    "_success": true,
    "buildInfo": {{airline}",
                "matching": "Air Paris",
                "tags": [
                    "airline"
                ]
        "Implementation-Title":    }
        ]"Saga Server",
        "graphImplementation-Build": " V-----------[I like traveling with Air Paris]-----------V \n ^-[I]-V-[like]-V-[traveling]-V-[with]-V-[Air]-V-[Paris]-^ \n ^-[i]-^   "6b79d916e8ff9ad9efd742d4fbc8ce186f77c02d",
        "Implementation-Version": "1.2.2",
        "Implementation-Timestamp": "1609253821444",
        "Implementation-Vendor-Id": "com.accenture.saga",
           ^-[air]-^-[paris]-^ \n"Built-By": "mauricio.rizo.sandi",
        "Build-Jdk": "11",
           "Implementation-Branch": "develop"
    },
    "solutions": [
          ^---[{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": {
{
            "elasticSearch": {
                "retries": 3,
                "delay": 5,
                "scheme": "http",
                "hostnamesAndPorts": [
                    "localhost:9200"
                ],
                "indexName": "pii",
                "Implementation-TitleencryptionKey": "Saga Serverf123123##c#$#4GGVqFk7L9123123@*^",
                "Implementation-Build"timeout": "9dde0a32f17264f7b9004fc8d141e5b1cd0838b0",30
        "Implementation-Version": "1.0.0-SNAPSHOT"    },
        "Implementation-Timestamp    "display": "1550261725668Saga",
        "Implementation-Vendor-Id": "com.accenture.saga",}
    ],
    "Built-ByexportSettings": "ronny.ortega.ugalde",{
        "Build-Jdk": "11.0.2"maxSize": 40,
        "Implementation-BranchbatchSize": "develop"5000
    },
    "ssl": false,
    "solutionsproviders": [
        {
            "elasticSearchbaseDir": {
   "./config",
             "indexNamename": "airfilesystem-provider",
            }"encryptionKey": "f123123##c#$#4GGVqFk7L9123123@*^",
            "displaytype": "Saga - EN"
        }FileSystem"
    ],
    "providers": [ },
        {
            "baseDirscheme": "./confighttp",
            "namehostnamesAndPorts": "filesystem-provider",
[
                "type"localhost: 9200"FileSystem"
        },
        {],
            "hostnamename": "localhostsaga-provider",
            "schemeexclude": "http",[
                "portupdatedAt": 9200,
                "name": "saga-provider"createdAt"
            ],
            "excludeencryptionKey": ["f123123##c#$#4GGVqFk7L9123123@*^",
                "updatedAt"type": "Elastic",
                "createdAt"timestamp": "updatedAt"
        }
    ],
            "type": "Elastic",
            "timestamp": "updatedAt"
        }
    ]



Saga_rest_endpoint_legacy
EndpointstopServer
MethodGET
  • Stops the Saga Server
Warning

If you stop the server via HTTP request, it can only be restarted on-premise


Request Examples

Code Block
languagepowershell
themeFadeToGrey
curl --location --request GET 'http://localhost:${port}/${url}'


Response