Hi 2 questions
-
I’m using the following GSQL for listing out all my vertices and I’d like to know if there’s a better way…
SELECT * FROM goals WHERE goal !="--"
Is there a better WHERE statement that I can use to simply list all verticies without having to force a “Not Equal” to “–”.
Is there a “Not Empty” comparison operator or function instead?
-
Trying to List out ALL Edges with the following GSQL line and it’s not working…
SELECT * FROM goals-(requires)->goals WHERE goal_0 !=""
Then I tried this and it still didn’t work and I get a semantic check fails error
SELECT * FROM goals-(requires)->goals WHERE from_id !=""
the Edges table is called “requires” has the following header and 2 record as follows
goal_0, goal_1, note
Expand & Calibrate, Ops Management, _
Expand & Calibrate, Client Sales, _
Hi William,
-
Yes you can, with a written query instead of a using the built-in queries : https://docs.tigergraph.com/dev/gsql-ref/querying/query-operations
-
from_id can only use the == operator, and you’ll need to provide a vertex id for that too.
Or you can write a query to do this as well.
If you don’t like waiting for the queries to compile, you can use interpret query mode : https://docs.tigergraph.com/dev/gsql-ref/querying/query-operations#interpret-query
Thanks,
Kevin
Hi on Answer 2 is there an option to the following Edge query that will just keep it hoping past it’s first layer of 5 Verticies all the way to completion?
SELECT * FROM goals-(requires)->goals WHERE from_id ==“Expand & Calibrate”
There are 59 total edges in my db and this only shows the top 5 edges directly connected with the top level “Expand & Calibrate” vertex… so there are 54 more edges left that need to be shown.
Hi William,
The built in query will return all edge instances that are directly connected to the vertex with id “Expand & Calibrate”.
One thing you can double-check is if the data contains any unexpected whitespace in the string “Expand & Calibrate”.
e.g. " Expand & Calibrate" or "Expand & Calibrate "
You can also use GraphStudio to confirm the result from the query:
On the Explore Graph page, you can search for a specific vertex.
Once the vertex is displayed, double-click on it and it will expand to all its neighbors, allowing you to confirm the number of edges/vertices it is connected to.
Thanks,
Kevin
One thing to note is that to avoid exploding the visualization result, double click one vertex will expand up to 200 of its neighboring vertices. So if you have more data loaded, it won’t show all of them.
Hi Thanks for the reply…
I guess I’m asking if there’s a way to use GSQL in Terminal to get a list of all Edges in the Graph and not just with one vertex and it’s next nearest set of vertices.
I was successfully able to do this with Vertices only with the following GSGL Syntax.
SELECT * FROM goals WHERE goal !="–"
But I was hoping to find a way to do it just as easily for all Edges…
Thanks!
Hi,
Built in GSQL queries : https://docs.tigergraph.com/intro/gsql-101/built-in-select-queries#select-edges
The Built-in queries were designed to be lightweight, and not the main method for users to query the graph.
Like Renchu’s comment above about too many visual results showing up, there could possibly be more than thousands of edges resulting from the very simple GSQL query.
The only way to “easily” show the edges is to create your own query.
Thanks,
Kevin
Ok I understand that but can someone please help with the syntax or provide a gsql example to where I can create and load a simple .gsql text file query that I can load and run that will pull all edges from the DB and not just the ones that pair up with a starting vertex in the query?
I have less than a hundred vertices and edges combined so overloading the Terminal window shouldn’t be a problem.
Thanks!
Here is our documentation on querying: https://docs.tigergraph.com/dev/gsql-ref/querying
Here is a template for what you’re looking for :
CREATE QUERY test() FOR GRAPH query_name {
ListAccum<edge> @@edgeList;
Start = {vertexType.*};
hello = select t from Start:s-(edgeType:e)-vertexType:t
accum @@edgeList += e;
print @@edgeList;
}
Thanks,
Kevin