/// <summary> /// Processes a LOAD command /// </summary> /// <param name="cmd">Load Command</param> public void ProcessLoadCommand(LoadCommand cmd) { if (this._manager is IUpdateableGenericIOManager) { ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString()); } else { try { //Check IO Behaviour //For a load which is essentially an insert we either need the ability to Update Add Triples or to Overwrite Graphs if (cmd.TargetUri == null) { //Must support notion of default graph if ((this._manager.IOBehaviour & IOBehaviour.HasDefaultGraph) == 0) throw new SparqlUpdateException("The underlying store does not support the notion of an explicit unnamed Default Graph required to process this command"); //Must allow either OverwriteDefault or CanUpdateDeleteTriples if ((this._manager.IOBehaviour & IOBehaviour.CanUpdateAddTriples) == 0 && (this._manager.IOBehaviour & IOBehaviour.OverwriteDefault) == 0) throw new SparqlUpdateException("The underlying store does not support the required IO Behaviour to implement this command"); } else { //Must support named graphs if ((this._manager.IOBehaviour & IOBehaviour.HasNamedGraphs) == 0) throw new SparqlUpdateException("The underlying store does not support the notion of named graphs required to process this command"); //Must allow either CanUpdateDeleteTriples or OverwriteNamed if ((this._manager.IOBehaviour & IOBehaviour.CanUpdateAddTriples) == 0 && (this._manager.IOBehaviour & IOBehaviour.OverwriteNamed) == 0) throw new SparqlUpdateException("The underlying store does not support the required IO Behaviour to implement this command"); } #if !NO_SYNC_HTTP Graph g = new Graph(); if (!this._manager.UpdateSupported) this._manager.LoadGraph(g, cmd.TargetUri); UriLoader.Load(g, cmd.SourceUri); g.BaseUri = cmd.TargetUri; if (this._manager.UpdateSupported) { this._manager.UpdateGraph(cmd.TargetUri, g.Triples, Enumerable.Empty<Triple>()); } else { this._manager.SaveGraph(g); } #else throw new SparqlUpdateException("Executing the LOAD command requires synchronous HTTP requests which are not supported on your platform currently"); #endif } catch { if (!cmd.Silent) throw; } } }
/// <summary> /// Processes a LOAD command /// </summary> /// <param name="cmd">Load Command</param> public void ProcessLoadCommand(LoadCommand cmd) { if (this._manager is IUpdateableGenericIOManager) { ((IUpdateableGenericIOManager)this._manager).Update(cmd.ToString()); } else { try { Graph g = new Graph(); if (!this._manager.UpdateSupported) this._manager.LoadGraph(g, cmd.TargetUri); UriLoader.Load(g, cmd.SourceUri); g.BaseUri = cmd.TargetUri; if (this._manager.UpdateSupported) { this._manager.UpdateGraph(cmd.TargetUri, g.Triples, Enumerable.Empty<Triple>()); } else { this._manager.SaveGraph(g); } } catch { if (!cmd.Silent) throw; } } }