/// <summary> /// Exectues a certain List of InnerQuery objects /// </summary> /// <param name="input">the list of innerquery to be queried</param> /// <returns>a list of resultSet one for each innerquery.queryText</returns> public static List<ResSetToJSON.innerResult> ExecuteQueryWithInnerQuery(SPARQLQueryBuilder.InnerQuery input,string obj1,string obj2) { //list to hold the results List<ResSetToJSON.innerResult> resultsList = new List<ResSetToJSON.innerResult>(); try { //temp result holder ResSetToJSON.innerResult temp; //fetching results and passing to the list temp = new ResSetToJSON.innerResult(); // //temp.firstObj = obj1; //temp.lastObj = obj2; temp = setOriginalObjects(temp,input.queryText); temp.connectState = (int)input.connectState; temp.resultSets = ExecuteQueryWithString(input.queryText); //if there's any results add it if (temp.resultSets.Count > 0) resultsList.Add(temp); } catch { } return resultsList; }
/// <summary> /// Exectues a certain List of InnerQuery objects /// </summary> /// <param name="input">the list of innerquery to be queried</param> /// <returns>a list of resultSet one for each innerquery.queryText</returns> public static List <ResSetToJSON.innerResult> ExecuteQueryWithInnerQuery(SPARQLQueryBuilder.InnerQuery input, string obj1, string obj2) { //list to hold the results List <ResSetToJSON.innerResult> resultsList = new List <ResSetToJSON.innerResult>(); try { //temp result holder ResSetToJSON.innerResult temp; //fetching results and passing to the list temp = new ResSetToJSON.innerResult(); // //temp.firstObj = obj1; //temp.lastObj = obj2; temp = setOriginalObjects(temp, input.queryText); temp.connectState = (int)input.connectState; temp.resultSets = ExecuteQueryWithString(input.queryText); //if there's any results add it if (temp.resultSets.Count > 0) { resultsList.Add(temp); } } catch { } return(resultsList); }
/// <summary> /// helper function to manage the changes of the queries first and last objects /// </summary> /// <param name="temp">the innerResult object ot set it's first and last object</param> /// <param name="input">the query string</param> /// <returns></returns> private static ResSetToJSON.innerResult setOriginalObjects(ResSetToJSON.innerResult temp, string input) { //List<string> urls = new List<string>(); string one = ""; string two = ""; MatchCollection mc = Regex.Matches(input, @"\<(.*?)\>", RegexOptions.IgnoreCase); one = mc[0].Value.Replace("<", ""); temp.firstObj = one.Replace(">", ""); two = mc[1].Value.Replace("<", ""); temp.lastObj = two.Replace(">", ""); return(temp); }