UltipaDocs
Try Playground
  • Introduction
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Installation
    • Connection
    • Request Configuration
    • UQL Execution
    • GQL Execution
    • Graphset Management
    • Schema and Property Management
    • Data Insertion and Deletion
    • Query Acceleration
    • Algorithm Management
    • Downloads and Exports
    • Process and Task Management
    • Access Management
    • Server Statistics
    • Result Processing
    • Types Mapping Ultipa and C#
  • RESTful API
  1. Docs
  2. /
  3. Ultipa Drivers
  4. /
  5. Convenience Methods

Query Acceleration

This section introduces methods for managing various indexes and LTE status for properties in graphs.

Index

showIndex()

Retrieves all indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved indexes.
TypeScript
// Retrieves indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const indexList = await driver.showIndex(requestConfig);
for (const index of indexList) {
 console.log(index);
}
Output
Index {
  id: '1',
  name: 'test_index',
  properties: 'year,float',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}
Index {
  id: '2',
  name: 'year_index',
  properties: 'year',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}
Index {
  id: '1',
  name: 'targetPostInd',
  properties: 'targetPost',
  schema: 'disagree',
  status: 'DONE',
  size: undefined,
  dbType: 1
}

showNodeIndex()

Retrieves all node indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved indexes.
TypeScript
// Retrieves node indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const indexList = await driver.showNodeIndex(requestConfig);
for (const index of indexList) {
 console.log(index);
}
Output
Index {
  id: '1',
  name: 'test_index',
  properties: 'year,float',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}
Index {
  id: '2',
  name: 'year_index',
  properties: 'year',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}

showEdgeIndex()

Retrieves all edge indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved indexes.
TypeScript
// Retrieves edge indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const indexList = await driver.showEdgeIndex(requestConfig);
for (const index of indexList) {
 console.log(index);
}
Output
Index {
  id: '1',
  name: 'targetPostInd',
  properties: 'targetPost',
  schema: 'disagree',
  status: 'DONE',
  size: undefined,
  dbType: 1
}

dropIndex()

Drops a specified index from the graph.

Parameters

  • dbType: DBType: Type of the index (node or edge).
  • indexName: string: Name of the index.
  • config?: RequestConfig: Request configuration.

Returns

  • Response: Response of the request.
TypeScript
// Drops the node index 'test_index' from the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const response = await driver.dropIndex(DBType.DBNODE, "test_index", requestConfig);
console.log(response.status?.message);
Output
SUCCESS

dropNodeIndex()

Drops a specified node index from the graph.

Parameters

  • indexName: string: Name of the index.
  • config?: RequestConfig: Request configuration.

Returns

  • Response: Response of the request.
TypeScript
// Drops the node index 'test_index' from the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const response = await driver.dropNodeIndex("test_index", requestConfig);
console.log(response.status?.message);
Output
SUCCESS

dropEdgeIndex()

Drops a specified edge index from the graph.

Parameters

  • indexName: string: Name of the index.
  • config?: RequestConfig: Request configuration.

Returns

  • Response: Response of the request.
TypeScript
// Drops the edge index 'targetPostInd' from the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const response = await driver.dropEdgeIndex("targetPostInd", requestConfig);
console.log(response.status?.message);
Output
SUCCESS

Full-text

showFulltext()

Retrieves all full-text indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved full-text indexes.
TypeScript
// Retrieves full-text indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const fulltextList = await driver.showFulltext(requestConfig);
for (const fulltext of fulltextList) {
 console.log(fulltext);
}
Output
Index {
  id: undefined,
  name: 'name',
  properties: 'name',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}
Index {
  id: undefined,
  name: 'Content',
  properties: 'content',
  schema: 'review',
  status: 'DONE',
  size: undefined,
  dbType: 1
}

showNodeFulltext()

Retrieves all node full-text indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved full-text indexes.
TypeScript
// Retrieves node full-text indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const fulltextList = await driver.showNodeFulltext(requestConfig);
for (const fulltext of fulltextList) {
 console.log(fulltext);
};
Output
Index {
  id: undefined,
  name: 'name',
  properties: 'name',
  schema: 'account',
  status: 'DONE',
  size: undefined,
  dbType: 0
}

showEdgeFulltext()

Retrieves all edge full-text indexes from the graph.

Parameters

  • config?: RequestConfig: Request configuration.

Returns

  • Index[]: The list of retrieved full-text indexes.
TypeScript
// Retrieves edge full-text indexes in the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const fulltextList = await driver.showEdgeFulltext(requestConfig);
for (const fulltext of fulltextList) {
 console.log(fulltext);
}
Output
Index {
  id: undefined,
  name: 'Content',
  properties: 'content',
  schema: 'review',
  status: 'DONE',
  size: undefined,
  dbType: 1
}

createFulltext()

Creates a full-text index in the graph.

Parameters

  • dbType: DBType: Type of the full-text index (node or edge).
  • schemaName: string: Name of the schema.
  • propertyName: string: Name of the property.
  • fulltextName: string: Name of the full-text index.
  • config?: RequestConfig: Request configuration.

Returns

  • JobResponse: Response of the request.
TypeScript
// Creates a full-text index 'moviePlot' for the property 'plot' of the 'movie' nodes

const requestConfig: RequestConfig = { graph: "miniCircle" };

const response = await driver.createFulltext(DBType.DBNODE, "movie", "plot", "moviePlot", requestConfig);
const jobID = response.jobId;

await new Promise(resolve => setTimeout(resolve, 3000));

const jobs = await driver.showJob(jobID, requestConfig);
for (const job of jobs) {
 console.log(`${job.id} - ${job.status}`);
}
Output
19 - FINISHED
19_1 - FINISHED

createNodeFulltext()

Creates a node full-text index in the graph.

Parameters

  • schemaName: string: Name of the schema.
  • propertyName: string: Name of the property.
  • fulltextName: string: Name of the full-text index.
  • config?: RequestConfig: Request configuration.

Returns

  • JobResponse: Response of the request.
TypeScript
// Creates a full-text index 'moviePlot' for the property 'plot' of the 'movie' nodes

const requestConfig: RequestConfig = { graph: "miniCircle" };

const response = await driver.createNodeFulltext("movie", "plot", "moviePlot", requestConfig);
const jobID = response.jobId;

await new Promise(resolve => setTimeout(resolve, 3000));

const jobs = await driver.showJob(jobID, requestConfig);
for (const job of jobs) {
 console.log(`${job.id} - ${job.status}`);
}
Output
20 - FINISHED
20_1 - FINISHED

createEdgeFulltext()

Creates an edge full-text index in the graph.

Parameters

  • schemaName: string: Name of the schema.
  • propertyName: string: Name of the property.
  • fulltextName: string: Name of the full-text index.
  • config?: RequestConfig: Request configuration.

Returns

  • JobResponse: Response of the request.
TypeScript
// Creates a full-text index 'agreeNotes' for the property 'notes' of the 'agree' edges

const requestConfig: RequestConfig = { graph: "miniCircle" };

const response = await driver.createEdgeFulltext("agree", "notes", "agreeNotes", requestConfig);
const jobID = response.jobId;

await new Promise(resolve => setTimeout(resolve, 3000));

const jobs = await driver.showJob(jobID, requestConfig);
for (const job of jobs) {
 console.log(`${job.id} - ${job.status}`);
}
Output
21 - FINISHED
21_1 - FINISHED

dropFulltext()

Drops a full-text index from the graph.

Parameters

  • dyType: DBType: Type of the full-text index (node or edge).
  • fulltextName: string: Name of the full-text index.
  • config?: RequestConfig: Request configuration.

Returns

  • Response: Response of the request.
TypeScript
// Drops the node full-index 'moviePlot' from the graph 'miniCircle'
const requestConfig: RequestConfig = { graph: "miniCircle" };
const response = await driver.dropFulltext(DBType.DBNODE, "moviePlot", requestConfig);
console.log(response.status?.message);
Output
SUCCESS

LTE

lte()

Loads a property to the computing engine.

Parameters

  • dbType: DBType: Type of the property (node or edge).
  • propertyName: string: Name of the property.
  • schemaName: string: Name of the schema.
  • config?: RequestConfig: Request configuration.

Returns

  • JobResponse: Response of the request.
TypeScript
// Loads the property 'year' of 'account' nodes to the computing engine

const requestConfig: RequestConfig = { graph: "miniCircle" };

const response = await driver.lte(DBType.DBNODE, "year", "account", requestConfig);
const jobID = response.jobId;

await new Promise(resolve => setTimeout(resolve, 3000));

const jobs = await driver.showJob(jobID, requestConfig);
for (const job of jobs) {
 console.log(`${job.id} - ${job.status}`);
}
Output
24 - FINISHED
24_1 - FINISHED

ufe()

Unloads a property from the computing engine.

Parameters

  • dbType: DBType: Type of the property (node or edge).
  • propertyName: string: Name of the property.
  • schemaName: string: Name of the schema.
  • config?: RequestConfig: Request configuration.

Returns

  • Response: Response of the request.
TypeScript
// Unloads the property 'year' of 'account' nodes from the computing engine
const requestConfig: RequestConfig = { graph: "miniCircle" };
const response = await driver.ufe(DBType.DBNODE, "year", "account", requestConfig);
console.log(response.status?.message);
Output
SUCCESS

Full Example

Example.ts
import { UltipaDriver } from "@ultipa-graph/ultipa-driver";
import { ULTIPA } from "@ultipa-graph/ultipa-driver/dist/types/index.js";
import { RequestConfig } from "@ultipa-graph/ultipa-driver/dist/types/types.js";

let sdkUsage = async () => {
  const ultipaConfig: ULTIPA.UltipaConfig = {
    // URI example: hosts: ["xxxx.us-east-1.cloud.ultipa.com:60010"]
    hosts: ["10.xx.xx.xx:60010"],
    username: "<username>",
    password: "<password>"
  };

  const driver = new UltipaDriver(ultipaConfig);

  // Retrieves indexes in the graph 'miniCircle'
  const requestConfig: RequestConfig = { graph: "miniCircle" };
  const indexList = await driver.showIndex(requestConfig);
  for (const index of indexList) {
    console.log(index);
  }
};

sdkUsage().catch(console.error);