In KG we have sample Rdf triples be like.
input1 <---- f(x) -----> ouput1 <----- f(x) -----> output2 <----- f(x) -----> output3
My goal is to find all posibble paths from Input1 - output3. we start from (Input1) and everytime we will try to find f(x) and ouput with given input. SPARQL -
?function has_input input.?function has_output ?output.
when we got some (ouput)s, they become input for the next query and so on until we found goal output(output3).
As I am finding all posible paths so I just implemented a backtracking algorithm to consider all nodes and find all path combinations.
Problem: It takes too long time to finding all possible paths in worst case scenerio. Is there any solution that is related to semantic web? or any optimization technique for this scenerio to reduce time of backtrack?