Beispiel #1
0
 /// <summary>
 ///  Federate the triple store, untested at this time
 /// </summary>
 /// <param name="name"></param>
 /// <param name="storeNames"></param>
 /// <param name="url"></param>
 /// <returns></returns>
 public bool federateTripleStores(string name, List <string> storeNames, string url)
 {
     try
     {
         if (url != string.Empty)
         {
             this._url = url;
         }
         Request request           = new Request();
         List <NameValuePairs> nvp = new List <NameValuePairs>();
         NameValuePairs        np  = new NameValuePairs();
         np.Name  = "federate";
         np.Value = (object)storeNames;
         nvp.Add(np);
         request.StandardRequest("PUT", this._url + @"/repositories/" + legalizeName(name, this._url), nvp, string.Empty);
         return(true);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine("Error in federateTripleStores: " + ex.Message);
         return(false);
     }
 }
 /// <summary>
 ///  Federate the triple store, untested at this time
 /// </summary>
 /// <param name="name"></param>
 /// <param name="storeNames"></param>
 /// <param name="url"></param>
 /// <returns></returns>
 public bool federateTripleStores(string name, List<string> storeNames, string url)
 {
     try
     {
         if (url != string.Empty)
         {
             this._url = url;
         }
         Request request = new Request();
         List<NameValuePairs> nvp = new List<NameValuePairs>();
         NameValuePairs np = new NameValuePairs();
         np.Name = "federate";
         np.Value = (object)storeNames;
         nvp.Add(np);
         request.StandardRequest("PUT", this._url + @"/repositories/" + legalizeName(name,this._url), nvp, string.Empty);
         return true;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine("Error in federateTripleStores: " + ex.Message);
         return false;
     }
 }
        /// <summary>
        /// Function to return the size of the statement pairs
        /// </summary>
        /// <param name="Context"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public long getSize(string Context, string url)
        {
            try
            {

                List<NameValuePairs> np = new List<NameValuePairs>();
                NameValuePairs nvp = new NameValuePairs();
                nvp.Name =  "context";
                nvp.Value = Context;
                np.Add(nvp);

                if(url == string.Empty) {
                  List<Results> results = new List<Results>();
                  results = this.StandardRequest("GET", this._url+"/size",np,null);
                  return (long)results[0].Result;
                }
                else{
                    List<Results> results = new List<Results>();
                    results = this.StandardRequest("GET", url + "/size",np,null);
                    return (long)results[0].Result;
                }
            }
            catch (Exception)
            {

                throw;
            }
        }