Find All Predicates

Find All Predicates #

Problem #

How can I list all the predicates used in the graph?

Test Data #

Fig 1.: Graph diagram of test data

Show the test data in nquads format
<alice> <follows> <bob> .
<bob> <follows> <fred> .
<bob> <status> "cool_person" .
<dani> <follows> <bob> .
<charlie> <follows> <bob> .
<charlie> <follows> <dani> .
<dani> <follows> <greg> .
<dani> <status> "cool_person" .
<emily> <follows> <fred> .
<fred> <follows> <greg> .
<greg> <status> "cool_person" .
<predicates> <are> <follows> .
<predicates> <are> <status> .
<emily> <status> "smart_person" <smart_graph> .
<greg> <status> "smart_person" <smart_graph> .

Gizmo Query #

// Find all predicates
g.V().OutPredicates().Union(g.V().InPredicates()).Unique().All();

Results:

{"id":"follows"}
{"id":"status"}
{"id":"are"}