Translator Application Programming Interface Client
npm install trapi-client/predicates: returns web service metadata consisting of a simple map Biolink Model relationship predicates and concept category values used in knowledge graphs returned by the service (note: future TRAPI releases will significantly elaborate further on the functionality of this endpoint, which will also likely be renamed)
/query: executes a knowledge graph templated query on the underlying KP or ARA to return a relevant knowledge graph and a set of 'results' mapping of the seed concepts and edges of the knowledge graph templated query, against that knowledge graph.
npm for managing module dependencies and running the system which needs to be installed. Instructions for installing npm are here.
shell
$ npm install trapi-client
`
or using yarn
`shell
yarn add trapi-client
`
Locally Installing and Developing with the Client Project
If you wish to directly modify or add to the client software, the project may be directly installed as follows.
Obtaining the Source Code
The first step is to clone the project source code from the Github project repository, into a suitable location on your computer using a copy of Git installed on your operating system:
`shell
git clone https://github.com/STARInformatics/trapi-client-js.git
`
$3
After cloning the project, you need to install the project's Javascript module dependencies locally, by typing the following from within your root project directory (i.e. inside /path/to/your/project/trapi-client-js):
`shell
$ npm install
`
Using the Client
trapi.js
The trapi.js script may be run directly by typing:
`shell
$ node trapi.js
`
This script has very simple functionality for quick testing purposes.
client.js
The trapi.js script actually calls the underlying TRAPI client.js module to do its work. This client module may be directly invoked within other Javascript execution contexts by importing the module and running its functions directly, as illustrated by the code within the trapi.js script.
`javascript
var client = require("./src/client.js");
var predicates = client.predicates();
var results = client.query();
``