Class QueryGraphRequest
- java.lang.Object
-
- com.gpudb.protocol.QueryGraphRequest
-
- All Implemented Interfaces:
org.apache.avro.generic.GenericContainer,org.apache.avro.generic.IndexedRecord
public class QueryGraphRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters forGPUdb.queryGraph.Employs a topological query on a graph generated a-priori by
GPUdb.createGraphand returns a list of adjacent edge(s) or node(s), also known as an adjacency list, depending on what's been provided to the endpoint; providing edges will return nodes and providing nodes will return edges.To determine the node(s) or edge(s) adjacent to a value from a given column, provide a list of values to
queries. This field can be populated with column values from any table as long as the type is supported by the given identifier. See Query Identifiers for more information.To return the adjacency list in the response, leave
adjacencyTableempty.IMPORTANT: It's highly recommended that you review the Graphs and Solvers concepts documentation, the Graph REST Tutorial, and/or some /match/graph examples before using this endpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryGraphRequest.OptionsA set of string constants for theQueryGraphRequestparameteroptions.
-
Constructor Summary
Constructors Constructor Description QueryGraphRequest()Constructs a QueryGraphRequest object with default parameters.QueryGraphRequest(String graphName, List<String> queries, List<String> restrictions, String adjacencyTable, int rings, Map<String,String> options)Constructs a QueryGraphRequest object with the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Objectget(int index)This method supports the Avro framework and is not intended to be called directly by the user.StringgetAdjacencyTable()Name of the table to store the resulting adjacencies, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.static org.apache.avro.SchemagetClassSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetGraphName()Name of the graph resource to query.Map<String,String>getOptions()Additional parameters.List<String>getQueries()Nodes or edges to be queried specified using query identifiers.List<String>getRestrictions()Additional restrictions to apply to the nodes/edges of an existing graph.intgetRings()Sets the number of rings around the node to query for adjacency, with '1' being the edges directly attached to the queried node.org.apache.avro.SchemagetSchema()This method supports the Avro framework and is not intended to be called directly by the user.inthashCode()voidput(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.QueryGraphRequestsetAdjacencyTable(String adjacencyTable)Name of the table to store the resulting adjacencies, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.QueryGraphRequestsetGraphName(String graphName)Name of the graph resource to query.QueryGraphRequestsetOptions(Map<String,String> options)Additional parameters.QueryGraphRequestsetQueries(List<String> queries)Nodes or edges to be queried specified using query identifiers.QueryGraphRequestsetRestrictions(List<String> restrictions)Additional restrictions to apply to the nodes/edges of an existing graph.QueryGraphRequestsetRings(int rings)Sets the number of rings around the node to query for adjacency, with '1' being the edges directly attached to the queried node.StringtoString()
-
-
-
Constructor Detail
-
QueryGraphRequest
public QueryGraphRequest()
Constructs a QueryGraphRequest object with default parameters.
-
QueryGraphRequest
public QueryGraphRequest(String graphName, List<String> queries, List<String> restrictions, String adjacencyTable, int rings, Map<String,String> options)
Constructs a QueryGraphRequest object with the specified parameters.- Parameters:
graphName- Name of the graph resource to query.queries- Nodes or edges to be queried specified using query identifiers. Identifiers can be used with existing column names, e.g., 'table.column AS QUERY_NODE_ID', raw values, e.g., '{0, 2} AS QUERY_NODE_ID', or expressions, e.g., 'ST_MAKEPOINT(table.x, table.y) AS QUERY_NODE_WKTPOINT'. Multiple values can be provided as long as the same identifier is used for all values. If using raw values in an identifier combination, the number of values specified must match across the combination.restrictions- Additional restrictions to apply to the nodes/edges of an existing graph. Restrictions must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., 'table.column AS RESTRICTIONS_EDGE_ID', expressions, e.g., 'column/2 AS RESTRICTIONS_VALUECOMPARED', or raw values, e.g., '{0, 0, 0, 1} AS RESTRICTIONS_ONOFFCOMPARED'. If using raw values in an identifier combination, the number of values specified must match across the combination. The default value is an emptyList.adjacencyTable- Name of the table to store the resulting adjacencies, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If left blank, the query results are instead returned in the response. If the 'QUERY_TARGET_NODE_LABEL' query identifier is used inqueries, then two additional columns will be available: 'PATH_ID' and 'RING_ID'. See Using Labels for more information. The default value is ''.rings- Sets the number of rings around the node to query for adjacency, with '1' being the edges directly attached to the queried node. Also known as number of hops. For example, if it is set to '2', the edge(s) directly attached to the queried node(s) will be returned; in addition, the edge(s) attached to the node(s) attached to the initial ring of edge(s) surrounding the queried node(s) will be returned. If the value is set to '0', any nodes that meet the criteria inqueriesandrestrictionswill be returned. This parameter is only applicable when querying nodes. The default value is 1.options- Additional parameters.FORCE_UNDIRECTED: If set toTRUE, all inbound edges and outbound edges relative to the node will be returned. If set toFALSE, only outbound edges relative to the node will be returned. This parameter is only applicable if the queried graphgraphNameis directed and when querying nodes. Consult Directed Graphs for more details. Supported values: The default value isFALSE.LIMIT: When specified (>0), limits the number of query results. The size of the nodes table will be limited by theLIMITvalue. The default value is '0'.OUTPUT_WKT_PATH: If true then concatenated wkt line segments will be added as the WKT column of the adjacency table. Supported values: The default value isFALSE.AND_LABELS: If set toTRUE, the result of the query has entities that satisfy all of the target labels, instead of any. Supported values: The default value isFALSE.SERVER_ID: Indicates which graph server(s) to send the request to. Default is to send to the server, amongst those containing the corresponding graph, that has the most computational bandwidth.OUTPUT_CHARN_LENGTH: When specified (>0 and <=256), limits the number of char length on the output tables for string based nodes. The default length is 64. The default value is '64'.FIND_COMMON_LABELS: If set to true, for many-to-many queries or multi-level traversals, it lists the common labels between the source and target nodes and edge labels in each path. Otherwise (zero rings), it'll list all labels of the node(s) queried. Supported values: The default value isFALSE.
Map.
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Returns:
- The schema for the class.
-
getGraphName
public String getGraphName()
Name of the graph resource to query.- Returns:
- The current value of
graphName.
-
setGraphName
public QueryGraphRequest setGraphName(String graphName)
Name of the graph resource to query.- Parameters:
graphName- The new value forgraphName.- Returns:
thisto mimic the builder pattern.
-
getQueries
public List<String> getQueries()
Nodes or edges to be queried specified using query identifiers. Identifiers can be used with existing column names, e.g., 'table.column AS QUERY_NODE_ID', raw values, e.g., '{0, 2} AS QUERY_NODE_ID', or expressions, e.g., 'ST_MAKEPOINT(table.x, table.y) AS QUERY_NODE_WKTPOINT'. Multiple values can be provided as long as the same identifier is used for all values. If using raw values in an identifier combination, the number of values specified must match across the combination.- Returns:
- The current value of
queries.
-
setQueries
public QueryGraphRequest setQueries(List<String> queries)
Nodes or edges to be queried specified using query identifiers. Identifiers can be used with existing column names, e.g., 'table.column AS QUERY_NODE_ID', raw values, e.g., '{0, 2} AS QUERY_NODE_ID', or expressions, e.g., 'ST_MAKEPOINT(table.x, table.y) AS QUERY_NODE_WKTPOINT'. Multiple values can be provided as long as the same identifier is used for all values. If using raw values in an identifier combination, the number of values specified must match across the combination.- Parameters:
queries- The new value forqueries.- Returns:
thisto mimic the builder pattern.
-
getRestrictions
public List<String> getRestrictions()
Additional restrictions to apply to the nodes/edges of an existing graph. Restrictions must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., 'table.column AS RESTRICTIONS_EDGE_ID', expressions, e.g., 'column/2 AS RESTRICTIONS_VALUECOMPARED', or raw values, e.g., '{0, 0, 0, 1} AS RESTRICTIONS_ONOFFCOMPARED'. If using raw values in an identifier combination, the number of values specified must match across the combination. The default value is an emptyList.- Returns:
- The current value of
restrictions.
-
setRestrictions
public QueryGraphRequest setRestrictions(List<String> restrictions)
Additional restrictions to apply to the nodes/edges of an existing graph. Restrictions must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., 'table.column AS RESTRICTIONS_EDGE_ID', expressions, e.g., 'column/2 AS RESTRICTIONS_VALUECOMPARED', or raw values, e.g., '{0, 0, 0, 1} AS RESTRICTIONS_ONOFFCOMPARED'. If using raw values in an identifier combination, the number of values specified must match across the combination. The default value is an emptyList.- Parameters:
restrictions- The new value forrestrictions.- Returns:
thisto mimic the builder pattern.
-
getAdjacencyTable
public String getAdjacencyTable()
Name of the table to store the resulting adjacencies, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If left blank, the query results are instead returned in the response. If the 'QUERY_TARGET_NODE_LABEL' query identifier is used inqueries, then two additional columns will be available: 'PATH_ID' and 'RING_ID'. See Using Labels for more information. The default value is ''.- Returns:
- The current value of
adjacencyTable.
-
setAdjacencyTable
public QueryGraphRequest setAdjacencyTable(String adjacencyTable)
Name of the table to store the resulting adjacencies, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If left blank, the query results are instead returned in the response. If the 'QUERY_TARGET_NODE_LABEL' query identifier is used inqueries, then two additional columns will be available: 'PATH_ID' and 'RING_ID'. See Using Labels for more information. The default value is ''.- Parameters:
adjacencyTable- The new value foradjacencyTable.- Returns:
thisto mimic the builder pattern.
-
getRings
public int getRings()
Sets the number of rings around the node to query for adjacency, with '1' being the edges directly attached to the queried node. Also known as number of hops. For example, if it is set to '2', the edge(s) directly attached to the queried node(s) will be returned; in addition, the edge(s) attached to the node(s) attached to the initial ring of edge(s) surrounding the queried node(s) will be returned. If the value is set to '0', any nodes that meet the criteria inqueriesandrestrictionswill be returned. This parameter is only applicable when querying nodes. The default value is 1.- Returns:
- The current value of
rings.
-
setRings
public QueryGraphRequest setRings(int rings)
Sets the number of rings around the node to query for adjacency, with '1' being the edges directly attached to the queried node. Also known as number of hops. For example, if it is set to '2', the edge(s) directly attached to the queried node(s) will be returned; in addition, the edge(s) attached to the node(s) attached to the initial ring of edge(s) surrounding the queried node(s) will be returned. If the value is set to '0', any nodes that meet the criteria inqueriesandrestrictionswill be returned. This parameter is only applicable when querying nodes. The default value is 1.- Parameters:
rings- The new value forrings.- Returns:
thisto mimic the builder pattern.
-
getOptions
public Map<String,String> getOptions()
Additional parameters.FORCE_UNDIRECTED: If set toTRUE, all inbound edges and outbound edges relative to the node will be returned. If set toFALSE, only outbound edges relative to the node will be returned. This parameter is only applicable if the queried graphgraphNameis directed and when querying nodes. Consult Directed Graphs for more details. Supported values: The default value isFALSE.LIMIT: When specified (>0), limits the number of query results. The size of the nodes table will be limited by theLIMITvalue. The default value is '0'.OUTPUT_WKT_PATH: If true then concatenated wkt line segments will be added as the WKT column of the adjacency table. Supported values: The default value isFALSE.AND_LABELS: If set toTRUE, the result of the query has entities that satisfy all of the target labels, instead of any. Supported values: The default value isFALSE.SERVER_ID: Indicates which graph server(s) to send the request to. Default is to send to the server, amongst those containing the corresponding graph, that has the most computational bandwidth.OUTPUT_CHARN_LENGTH: When specified (>0 and <=256), limits the number of char length on the output tables for string based nodes. The default length is 64. The default value is '64'.FIND_COMMON_LABELS: If set to true, for many-to-many queries or multi-level traversals, it lists the common labels between the source and target nodes and edge labels in each path. Otherwise (zero rings), it'll list all labels of the node(s) queried. Supported values: The default value isFALSE.
Map.- Returns:
- The current value of
options.
-
setOptions
public QueryGraphRequest setOptions(Map<String,String> options)
Additional parameters.FORCE_UNDIRECTED: If set toTRUE, all inbound edges and outbound edges relative to the node will be returned. If set toFALSE, only outbound edges relative to the node will be returned. This parameter is only applicable if the queried graphgraphNameis directed and when querying nodes. Consult Directed Graphs for more details. Supported values: The default value isFALSE.LIMIT: When specified (>0), limits the number of query results. The size of the nodes table will be limited by theLIMITvalue. The default value is '0'.OUTPUT_WKT_PATH: If true then concatenated wkt line segments will be added as the WKT column of the adjacency table. Supported values: The default value isFALSE.AND_LABELS: If set toTRUE, the result of the query has entities that satisfy all of the target labels, instead of any. Supported values: The default value isFALSE.SERVER_ID: Indicates which graph server(s) to send the request to. Default is to send to the server, amongst those containing the corresponding graph, that has the most computational bandwidth.OUTPUT_CHARN_LENGTH: When specified (>0 and <=256), limits the number of char length on the output tables for string based nodes. The default length is 64. The default value is '64'.FIND_COMMON_LABELS: If set to true, for many-to-many queries or multi-level traversals, it lists the common labels between the source and target nodes and edge labels in each path. Otherwise (zero rings), it'll list all labels of the node(s) queried. Supported values: The default value isFALSE.
Map.- Parameters:
options- The new value foroptions.- Returns:
thisto mimic the builder pattern.
-
getSchema
public org.apache.avro.Schema getSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getSchemain interfaceorg.apache.avro.generic.GenericContainer- Returns:
- The schema object describing this class.
-
get
public Object get(int index)
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to get- Returns:
- value of the field with the given index.
- Throws:
IndexOutOfBoundsException
-
put
public void put(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
putin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to setvalue- the value to set- Throws:
IndexOutOfBoundsException
-
-