This section introduces methods on a Connection object for managing the LTE status for properties, and their indexes and full-text indexes. These mechanisms can be employed to accelerate queries.
Each example focuses solely on the method's usage. For a complete code example, please refer to the full example.
Loads one custom property of nodes or edges to the computing engine for query acceleration.
Parameters:
DBType: Type of the property (node or edge).string (Optional): Name of the schema, write * to specify all schemas.string: Name of the property.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Loads the edge property @relatesTo.type to engine in graphset 'UltipaTeam' and prints error code RequestConfig requestConfig = new RequestConfig() { Graph = "UltipaTeam" }; var res = await ultipa.Lte(DBType.Dbedge, "relatesTo", "type", requestConfig); Console.WriteLine(res.Status.ErrorCode); Thread.Sleep(3000); var prop = await ultipa.GetEdgeProperty("relatesTo", "type", requestConfig); Console.WriteLine("LTE status of the property: " + prop.Lte);
OutputSuccess LTE status of the property: True
Unloads one custom property of nodes or edges from the computing engine to save the memory.
Parameters:
DBType: Type of the property (node or edge).string (Optional): Name of the schema, write * to specify all schemas.string: Name of the property.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Unloads the edge property @relatesTo.type from engine in graphset 'UltipaTeam' and prints error code and whether it's LTE-ed RequestConfig requestConfig = new RequestConfig() { Graph = "UltipaTeam" }; var res = await ultipa.Ufe(DBType.Dbedge, "relatesTo", "type", requestConfig); Console.WriteLine(res.Status.ErrorCode); Thread.Sleep(3000); var prop = await ultipa.GetEdgeProperty("relatesTo", "type", requestConfig); Console.WriteLine("LTE status of the property: " + prop.Lte);
OutputSuccess LTE status of the property: False
Retrieves all indexes of node and edge properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all indexes retrieved in the current graphset.C#// Retrieves indexes in graphset 'Ad_Click' and prints their information RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true }; var res = await ultipa.ShowIndex(requestConfig); foreach (var item in res) { Console.WriteLine(JsonConvert.SerializeObject(item)); }
Output{"Schema":"user","Name":"shopping_level","Properties":"shopping_level","Status":"done","size":"4608315"} {"Schema":"ad","Name":"price","Properties":"price","Status":"done","size":"7828488"} {"Schema":"clicks","Name":"time","Properties":"time","Status":"done","size":"12809771"}
Retrieves all indexes of node properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all indexes retrieved in the current graphset.C#// Retrieves node indexes in graphset 'Ad_Click' and prints their information RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true }; var res = await ultipa.ShowNodeIndex(requestConfig); foreach (var item in res) { Console.WriteLine(JsonConvert.SerializeObject(item)); }
Output{"Schema":"user","Name":"shopping_level","Properties":"shopping_level","Status":"done","size":"4608315"} {"Schema":"ad","Name":"price","Properties":"price","Status":"done","size":"7828488"}
Retrieves all indexes of edge properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all indexes retrieved in the current graphset.C#// Retrieves edge indexes in graphset 'Ad_Click' and prints their information RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true }; var res = await ultipa.ShowEdgeIndex(requestConfig); foreach (var item in res) { Console.WriteLine(JsonConvert.SerializeObject(item)); }
Output{"Schema":"clicks","Name":"time","Properties":"time","Status":"done","size":"12809771"}
Creates a new index in the current graphset.
Parameters:
DBType: Type of the property (node or edge).string (Optional): Name of the schema.string: Name of the property.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Creates indexes for all node properties 'name' in graphset 'Ad_Click' and prints the error code RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true }; var res = await ultipa.CreateIndex(DBType.Dbnode, "name", requestConfig); Console.WriteLine(res.Status.ErrorCode);
OutputSuccess
Drops indexes in the current graphset.
Parameters:
DBType: Type of the property (node or edge).string (Optional): Name of the schema.string: Name of the property.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Drops the index of the node property @ad.name in graphset 'Ad_Click' and prints the error code RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true }; var res = await ultipa.DropIndex(DBType.Dbnode, "ad", "name", requestConfig); Console.WriteLine(res.Status.ErrorCode);
OutputSuccess
Retrieves all full-text indexes of node and edge properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all indexes retrieved in the current graphset.C#// Retrieves the first full-text index returned in graphset 'miniCircle' and prints its information RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle" }; var res = await ultipa.ShowFulltext(requestConfig); Console.WriteLine(JsonConvert.SerializeObject(res[0]));
Output{"Schema":"movie","Name":"genreFull","Properties":"genre","Status":"done","size":null}
Retrieves all full-text indexes of node properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all full-text indexes of node properties retrieved in the current graphset.C#// Retrieves the first node full-text index of node properties returned in graphset 'miniCircle' and prints its information RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle" }; var res = await ultipa.ShowNodeFulltext(requestConfig); Console.WriteLine(JsonConvert.SerializeObject(res[0]));
Output{"Schema":"movie","Name":"genreFull","Properties":"genre","Status":"done","size":null}
Retrieves all full-text indexes of edge properties from the current graphset.
Parameters:
RequestConfig (Optional): Configuration settings for the request.Returns:
List<Index>: The list of all edge full-text indexes of edge properties retrieved in the current graphset.C#// Retrieves the first edge full-text index of edge properties returned in graphset 'miniCircle' and prints its information RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle" }; var res = await ultipa.ShowEdgeFulltext(requestConfig); Console.WriteLine(JsonConvert.SerializeObject(res[0]));
Output{"Schema":"review","Name":"nameFull","Properties":"content","Status":"done","size":null}
Creates a new full-text index in the current graphset.
Parameters:
DBType: Type of the property (node or edge).string: Name of the schema.string: Name of the property.string: Name of the full-text index.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Creates full-text index called 'movieName' for the property @movie.name in graphset 'miniCircle' and prints the error code RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle" }; var res = await ultipa.CreateFulltext( DBType.Dbnode, "movie", "name", "movieName", requestConfig ); Console.WriteLine(res.Status.ErrorCode);
OutputSuccess
Drops a full-text index in the current graphset.
Parameters:
DBType: Type of the property (node or edge).string: Name of the full-text index.RequestConfig (Optional): Configuration settings for the request.Returns:
UqlResponse: Result of the request.C#// Drops the node full-index 'movieName' in graphset 'miniCircle' and prints the error code RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle" }; var res = await ultipa.DropFulltext(DBType.Dbnode, "movieName", requestConfig); Console.WriteLine(res.Status.ErrorCode);
OutputSuccess
C#using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Xml.Linq; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using UltipaService; using UltipaSharp; using UltipaSharp.api; using UltipaSharp.configuration; using UltipaSharp.connection; using UltipaSharp.exceptions; using UltipaSharp.structs; using UltipaSharp.utils; using Logger = UltipaSharp.utils.Logger; using Property = UltipaSharp.structs.Property; using Schema = UltipaSharp.structs.Schema; class Program { static async Task Main(string[] args) { // Connection configurations // URI example: Hosts=new[]{"mqj4zouys.us-east-1.cloud.ultipa.com:60010"} var myconfig = new UltipaConfig() { Hosts = new[] { "192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061" }, Username = "***", Password = "***", }; // Establishes connection to the database var ultipa = new Ultipa(myconfig); var isSuccess = ultipa.Test(); Console.WriteLine(isSuccess); // Request configurations RequestConfig requestConfig = new RequestConfig() { Graph = "Ad_Click", UseMaster = true, }; // Retrieves all indexes in graphset 'Ad_Click' and prints their information var res = await ultipa.ShowIndex(requestConfig); foreach (var item in res) { Console.WriteLine(JsonConvert.SerializeObject(item)); } } }