private string direct(string object1, string object2, int distance, Dictionary<string, List<string>> options)
{
Dictionary<string, List<string>> vars = new Dictionary<string, List<string>>();
vars["obj"] = new List<string>();
vars["pred"] = new List<string>();
// if the distance between the two objects is 1 , Query Generated will be in the form of ....where{obj1 ?p1 obj2}
if (distance == 1)
{
string retval = uri(object1) + "?pf1" + uri(object2);
vars["pred"].Add("?pf1");
return completeQuery(retval, options, vars);
}
// if the distance between the two objects is 1 , Query Generated will be in the form of ....where{obj1 ?pf1 ?of1 ?pf2 ... obj2}
// the where part of theQueries is then passed to thefunction CompleteQuery Method to Generate the complete Query
else
{
string query = uri(object1) + "?pf1 ?of1" + ".\n";
vars["pred"].Add("?pf1");
vars["obj"].Add("?of1");
for (int i = 1; i < distance - 1; i++)
{
query += "?of" + i + "?pf" + (i + 1) + "?of" + (i + 1) + ".\n";
vars["pred"].Add("?pf" + (i + 1));
vars["obj"].Add("?of" + (i + 1));
}
query += "?of" + (distance - 1) + "?pf" + distance + ' ' + uri(object2);
vars["pred"].Add("?pf" + distance);
return completeQuery(query, options, vars);
}
}