new public void ProcessAddCommand(AddCommand 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.AddGraph(cmd.SourceUri, cmd.DestinationUri); } catch { if (!cmd.Silent) throw; } }
/// <summary> /// Processes an ADD command /// </summary> /// <param name="cmd">Add Command</param> public void ProcessAddCommand(AddCommand cmd) { this.ProcessCommand(cmd); }
/// <summary> /// Processes an ADD command /// </summary> /// <param name="cmd">Add Command</param> public void ProcessAddCommand(AddCommand 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"); //Load Source Graph Graph source = new Graph(); this._manager.LoadGraph(source, cmd.SourceUri); source.BaseUri = cmd.SourceUri; //Load Destination Graph Graph dest = new Graph(); this._manager.LoadGraph(dest, cmd.DestinationUri); dest.BaseUri = cmd.DestinationUri; //Transfer the data and update the Destination Graph dest.Merge(source); this._manager.SaveGraph(dest); } catch { if (!cmd.Silent) throw; } } }
/// <summary> /// Processes an ADD command /// </summary> /// <param name="cmd">Add Command</param> public void ProcessAddCommand(AddCommand 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; //Load Destination Graph Graph dest = new Graph(); this._manager.LoadGraph(dest, cmd.DestinationUri); dest.BaseUri = cmd.DestinationUri; //Transfer the data and update the Destination Graph dest.Merge(source); this._manager.SaveGraph(dest); } catch { if (!cmd.Silent) throw; } } }
/// <summary> /// Processes an ADD command /// </summary> /// <param name="cmd">Add Command</param> /// <param name="context">SPARQL Update Evaluation Context</param> protected virtual void ProcessAddCommandInternal(AddCommand cmd, SparqlUpdateEvaluationContext context) { cmd.Evaluate(context); }
/// <summary> /// Processes an ADD command /// </summary> /// <param name="cmd">Add Command</param> public void ProcessAddCommand(AddCommand cmd) { this.ProcessAddCommandInternal(cmd, this.GetContext()); }