new public void ProcessMoveCommand(MoveCommand cmd) { try { //If Source and Destination are equal this is a no-op if (EqualityHelper.AreUrisEqual(cmd.SourceUri, cmd.DestinationUri)) return; if (cmd.SourceUri != null && !_manager.ListGraphs().Any(g => EqualityHelper.AreUrisEqual(cmd.SourceUri, g))) { throw new SparqlUpdateException(string.Format("Could not find source graph <{0}>", cmd.SourceUri)); } _manager.MoveGraph(cmd.SourceUri, cmd.DestinationUri); } catch { if (!cmd.Silent) throw; } }
/// <summary> /// Processes a MOVE command /// </summary> /// <param name="cmd">Move Command</param> public void ProcessMoveCommand(MoveCommand cmd) { this.ProcessCommand(cmd); }
/// <summary> /// Processes a MOVE command /// </summary> /// <param name="cmd">Move Command</param> public void ProcessMoveCommand(MoveCommand cmd) { if (this._manager is IUpdateableGenericIOManager) { ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString()); } else { try { //If Source and Destination are equal this is a no-op if (EqualityHelper.AreUrisEqual(cmd.SourceUri, cmd.DestinationUri)) return; //Firstly check that appropriate IO Behaviour is provided if (cmd.SourceUri == null || cmd.DestinationUri == null) { if ((this._manager.IOBehaviour & IOBehaviour.HasDefaultGraph) == 0) throw new SparqlUpdateException("The underlying store does not provide support for an explicit unnamed Default Graph required to process this command"); } IOBehaviour desired = cmd.DestinationUri == null ? IOBehaviour.OverwriteDefault : IOBehaviour.OverwriteNamed; if ((this._manager.IOBehaviour & desired) == 0) throw new SparqlUpdateException("The underlying store does not provide the required IO Behaviour to implement this command"); Graph source = new Graph(); this._manager.LoadGraph(source, cmd.SourceUri); source.BaseUri = cmd.SourceUri; //If the Manager supports delete ensure the Destination Graph is deleted if (this._manager.DeleteSupported) { try { this._manager.DeleteGraph(cmd.DestinationUri); } catch (Exception ex) { throw new SparqlUpdateException("Unable to process a MOVE command as unable to ensure that the Destination Graph was deleted prior to moving the data from the Source Graph", ex); } } //Load Destination Graph and ensure it is empty Graph dest = new Graph(); this._manager.LoadGraph(dest, cmd.DestinationUri); dest.BaseUri = cmd.DestinationUri; dest.Clear(); //Transfer the data and update both the Graphs //For the Source Graph which we must delete the contents of either use DeleteGraph() if supported or //just save an empty Graph in its place and hope that SaveGraph() is an overwrite operation dest.Merge(source); source.Clear(); this._manager.SaveGraph(dest); if (this._manager.DeleteSupported) { try { this._manager.DeleteGraph(cmd.SourceUri); } catch (Exception ex) { throw new SparqlUpdateException("Unable to process a MOVE command as unable to ensure that the Source Graph was deleted after the movement of data to the Destination Graph", ex); } } else { this._manager.SaveGraph(source); } } catch { if (!cmd.Silent) throw; } } }
/// <summary> /// Processes a MOVE command /// </summary> /// <param name="cmd">Move Command</param> public void ProcessMoveCommand(MoveCommand cmd) { if (this._manager is IUpdateableGenericIOManager) { ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString()); } else { try { Graph source = new Graph(); this._manager.LoadGraph(source, cmd.SourceUri); source.BaseUri = cmd.SourceUri; //If the Manager supports delete ensure the Destination Graph is deleted if (this._manager.DeleteSupported) { try { this._manager.DeleteGraph(cmd.DestinationUri); } catch (Exception ex) { throw new SparqlUpdateException("Unable to process a MOVE command as unable to ensure that the Destination Graph was deleted prior to moving the data from the Source Graph", ex); } } //Load Destination Graph and ensure it is empty Graph dest = new Graph(); this._manager.LoadGraph(dest, cmd.DestinationUri); dest.BaseUri = cmd.DestinationUri; dest.Clear(); //Transfer the data and update both the Graphs //For the Source Graph which we must delete the contents of either use DeleteGraph() if supported or //just save an empty Graph in its place and hope that SaveGraph() is an overwrite operation dest.Merge(source); source.Clear(); this._manager.SaveGraph(dest); if (this._manager.DeleteSupported) { try { this._manager.DeleteGraph(cmd.SourceUri); } catch (Exception ex) { throw new SparqlUpdateException("Unable to process a MOVE command as unable to ensure that the Source Graph was deleted after the movement of data to the Destination Graph", ex); } } else { this._manager.SaveGraph(source); } } catch { if (!cmd.Silent) throw; } } }
/// <summary> /// Processes a MOVE command /// </summary> /// <param name="cmd">Move Command</param> /// <param name="context">SPARQL Update Evaluation Context</param> protected virtual void ProcessMoveCommandInternal(MoveCommand cmd, SparqlUpdateEvaluationContext context) { cmd.Evaluate(context); }
/// <summary> /// Processes a MOVE command /// </summary> /// <param name="cmd">Move Command</param> public void ProcessMoveCommand(MoveCommand cmd) { this.ProcessMoveCommandInternal(cmd, this.GetContext()); }