예제 #1
0
        /// <summary>
        /// Processes a CREATE command
        /// </summary>
        /// <param name="cmd">Create Command</param>
        /// <remarks>
        /// <para>
        /// Implemented by adding an empty Graph to the Store
        /// </para>
        /// <para>
        /// <strong>Warning:</strong> As the <see cref="IGenericIOManager">IGenericIOManager</see> interface does not allow checking whether a Graph exists processing CREATE commands can result in overwriting existing Graphs
        /// </para>
        /// </remarks>
        public void ProcessCreateCommand(CreateCommand cmd)
        {
            if (this._manager is IUpdateableGenericIOManager)
            {
                ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString());
            }
            else
            {
                Graph g = new Graph();
                g.BaseUri = cmd.TargetUri;

                try
                {
                    //As Khalil Ahmed pointed out the behaviour when the store doesn't support empty graphs the behaviour should be to act as if the operation succeeded
                    if ((this._manager.IOBehaviour & IOBehaviour.ExplicitEmptyGraphs) == 0) return;

                    this._manager.SaveGraph(g);
                }
                catch
                {
                    if (!cmd.Silent) throw;
                }
            }
        }
 /// <summary>
 /// Processes a CREATE command
 /// </summary>
 /// <param name="cmd">Create Command</param>
 /// <remarks>
 /// <para>
 /// Implemented by adding an empty Graph to the Store
 /// </para>
 /// <para>
 /// <strong>Warning:</strong> As the <see cref="IGenericIOManager">IGenericIOManager</see> interface does not allow checking whether a Graph exists processing CREATE commands can result in overwriting existing Graphs
 /// </para>
 /// </remarks>
 public void ProcessCreateCommand(CreateCommand cmd)
 {
     if (this._manager is IUpdateableGenericIOManager)
     {
         ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString());
     }
     else
     {
         Graph g = new Graph();
         g.BaseUri = cmd.TargetUri;
         try
         {
             this._manager.SaveGraph(g);
         }
         catch
         {
             if (!cmd.Silent) throw;
         }
     }
 }