InterSystems IRIS Data Platform 2019.2  /  Using InterSystems Natural Language Processing (NLP)

Using InterSystems Natural Language Processing (NLP)
iKnow Web Services
Previous section           Next section
InterSystems: The power behind what matters   

The %iKnow package provides web service classes that execute NLP queries. This chapter provides an overview of these classes and describes how to use them. It discusses the following topics:
Available Web Services
NLP provides the following web service classes:
The %iKnow.Queries package also contains classes that the compiler generated when these classes were compiled. For example, when the compiler compiled the class %iKnow.Queries.CcWSAPI, it generated the classes in the %iKnow.Queries.CcWSAPI package. These generated classes are not intended for direct use.
Using an NLP Web Service
To use a web service, you create and use a web client that communicates with it. To do so for an NLP web service, you use the same procedure as with any other web service:
  1. Create a web client that can communicate with the web service. Typically, to do so, you generate the web client using a tool provided by the client technology and you provide the WSDL of the web service as input. This process generates a set of client classes.
    Note that for an InterSystems IRIS Data Platform™ web service, the WSDL is available at the following URL:
    For example:
  2. Rather than editing the generated client classes, create an additional class or routine that uses them. The details depend on the technology.
    In InterSystems IRIS, to use a web client, you create an instance of the web client class and then invoke its instance methods. See the following example.
For demonstration purposes, let us generate and use an InterSystems IRIS web client to work with an NLP web service on the same machine. To do this in the SAMPLES namespace:
  1. In Studio, click Tools > Add-ins > SOAP Wizard.
  2. On the first screen, click URL.
  3. Type the following URL:
    If needed, replace 52773 with the port that your web server uses for this installation of InterSystems IRIS.
  4. Click Next.
  5. For Proxy Class Package, type a package name such as MyClient
  6. Click Next twice.
    The wizard generates and compiles the classes and displays a list of these classes.
    This process generates the class MyClient.iKnow.Queries.EntityWSAPISoap. This class defines a set of methods, one for each web method defined in the web service on which this client is based. Each of these methods looks like this (with illegal line breaks added here):
    Method GetByFilter(domainid As %Integer, filter As %String, filtermode As %Integer, enttype As %Integer, 
    blackListIds As %ListOfDataTypes(ELEMENTTYPE="%String",XMLITEMNAME="blackListIdsItem",XMLNAME="blackListIds")) 
    As %XML.DataSet [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
     Quit ..WebMethod("GetByFilter").
    The signature of this method is the same as for the corresponding method in the web service.
    This process also generates a set of classes in the MyClient.iKnow.Queries.EntityWSAPISoap, which are not for direct use.
  7. Click Finish.
  8. To use the generated client, enter the following in the Terminal in the SAMPLES namespace:
    set client=##class(MyClient.iKnow.Queries.EntityWSAPISoap).%New()
    This creates an instance of the client class, which can then communicate with the web service.
  9. Execute methods of this class. For example:
    write client.GetCountByDomain(2)
Comparison of NLP Web Services with Primary NLP APIs
The primary NLP APIs use arguments that cannot be easily represented in SOAP messages, so the methods in NLP web services have different signatures than do the methods in the primary NLP APIs. In particular, note the following differences:
See Also
For information on web services and clients in InterSystems IRIS, see Creating Web Services and Web Clients.

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-23 05:35:26