Class to handle the actual communication to the server WCF compatible, so if you use WCF, then you will always need to pass the url to every function Otherwise, you can set it using the constructor
Inheritance: IRESTInterface
Example #1
0
 /// <summary>
 /// Initialize new triple store
 /// </summary>
 /// <param name="name"></param>
 /// <param name="url"></param>
 /// <returns></returns>
 public bool createTripleStore(string name, string url)
 {
     try
     {
         if (url != string.Empty)
         {
             this._url = url;
         }
         Request request = new Request();
         request.StandardRequest("PUT", this._url + @"/repositories/" + legalizeName(name,this._url), null, null);
         return true;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine("Error in create triple store : " + 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;
     }
 }
Example #3
0
        /// <summary>
        /// List the triple stores at the current url
        /// </summary>
        /// <returns></returns>
        public List<string> listTripleStores(string url)
        {
            if (url != string.Empty)
            {
                this._url = url;
            }
            List<string> stores = new List<string>();
            try
            {
                Request request = new Request();
                List<Results> rs = new List<Results>();
                rs = request.StandardRequest("GET", this._url + @"/repositories", null, null);
                foreach (Results result in rs)
                {
                    stores.Add(result.Result.ToString());
                }
            }
            catch (Exception ex)
            {

                System.Diagnostics.Trace.WriteLine("Error in listTripleStores : " + ex.Message);
            }

            return stores;
        }
 /// <summary>
 /// StandardRequest allows you to submit a basic request to the server
 /// </summary>
 /// <param name="method">Needs to be the standard REST methods: PUT, GET, etc.</param>
 /// <param name="url">URL of the server</param>
 /// <param name="options">Options to be passed in the HTTP Request</param>
 /// <param name="contentType">ContentType parameter</param>
 /// <returns></returns>
 public List<Results> StandardRequest(string method, string url, List<NameValuePairs> options, string contentType)
 {
     Request rq = new Request();
     return rq.StandardRequest(method, url, options, contentType);
 }
 public List<Results> jsonRequest(string method, string url)
 {
     Request rq = new Request();
     return rq.JSONRequest(method, url, null, null);
 }