Use of variable with shortest

Hi every one,

I need some help on using variables with shortest. I want to find the shortest path between 2 nodes by attribute.

Here is the mutation where I feed the data into my schema

    set {
      # -- create 3 tables as 3 nodes
      _:table1 <table> "Table1" .
      _:table2 <table> "Table2" .
      _:table3 <table> "Table3" .

      # -- Prepare predicate joins_with with Facets
      _:table1 <joins_with> _:table2 (joint_type="INNER", table_column="col_from_t1", remote_table_column="col_from_t2") .
      _:table2 <joins_with> _:table3 (joint_type="LEFT", table_column="col_from_t1", remote_table_column="col_from_t3") .

I want to get the shortest path between table1 and table3. It should will be Table1 -> Table2 -> Table3

Here is my query

	A as var(func:allofterms(table, "Table1")) {

	B as var(func:allofterms(table, "Table3")) {

       path as shortest(from: uid(A) , to: uid(B) ) {
       path(func: uid(path)) {

But I got this error "Expecting argument name. Got: lex.Item [12] \"(\"", it’s like the value of uid is never passed.

Can you guys help me on this? do I miss something?
Thank you already :slight_smile:

it looks like uid function not supported in shortest function.

you can only pass shortest(from: 0x01,to : 0x02) .
so , you need split your query in two parts.
firsrt get the uid .
then, use the uid , find the shortest path.

thanks :slightly_smiling_face:

you are welcome :sunglasses:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.