Beispiel #1
0
 /// <summary>
 /// Removes a Graph from the Dataset
 /// </summary>
 /// <param name="graphUri">Graph URI</param>
 public sealed override void RemoveGraph(Uri graphUri)
 {
     if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
     {
         if (this.DefaultGraphUris.Any())
         {
             foreach (Uri u in this.DefaultGraphUris)
             {
                 if (this.IsDefaultGraph(u))
                 {
                     //Default Graph gets cleared
                     GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(this[u]);
                     wrapper.Clear();
                     this._actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
                 }
                 else
                 {
                     //Other Graphs get actually deleted
                     this._actions.Add(new GraphPersistenceAction(this[u], GraphPersistenceActionType.Deleted));
                 }
             }
         }
         else if (this.HasGraph(graphUri))
         {
             this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             this.RemoveGraphInternal(graphUri);
         }
     }
     else if (this.HasGraph(graphUri))
     {
         this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         this.RemoveGraphInternal(graphUri);
     }
 }
        public void GraphPersistenceWrapperNodeCreation()
        {
            Graph g = new Graph();
            GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(g);

            INode s = wrapper.CreateBlankNode();
            INode p = wrapper.CreateUriNode("rdf:type");
            INode o = wrapper.CreateUriNode("rdfs:Class");

            wrapper.Assert(s, p, o);
        }
Beispiel #3
0
 /// <summary>
 /// Removes a Graph from the Dataset
 /// </summary>
 /// <param name="graphUri">Graph URI</param>
 public sealed override void RemoveGraph(Uri graphUri)
 {
     if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
     {
         if (this.DefaultGraph != null)
         {
             GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(DefaultGraph);
             wrapper.Clear();
             this._actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
         }
         else if (this.HasGraph(graphUri))
         {
             this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             this.RemoveGraphInternal(graphUri);
         }
     }
     else if (this.HasGraph(graphUri))
     {
         this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         this.RemoveGraphInternal(graphUri);
     }
 }
 /// <summary>
 /// Removes a Graph from the Dataset
 /// </summary>
 /// <param name="graphUri">Graph URI</param>
 public sealed override bool RemoveGraph(Uri graphUri)
 {
     if (graphUri == null)
     {
         if (DefaultGraphUris.Any())
         {
             foreach (Uri u in DefaultGraphUris)
             {
                 if (IsDefaultGraph(u))
                 {
                     // Default Graph gets cleared
                     GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(this[u]);
                     wrapper.Clear();
                     _actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
                     return(true);
                 }
                 else
                 {
                     // Other Graphs get actually deleted
                     _actions.Add(new GraphPersistenceAction(this[u], GraphPersistenceActionType.Deleted));
                     return(true);
                 }
             }
         }
         else if (HasGraph(graphUri))
         {
             _actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             return(RemoveGraphInternal(graphUri));
         }
     }
     else if (HasGraph(graphUri))
     {
         _actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         return(RemoveGraphInternal(graphUri));
     }
     return(false);
 }
 /// <summary>
 /// Removes a Graph from the Dataset.
 /// </summary>
 /// <param name="graphUri">Graph URI.</param>
 public sealed override bool RemoveGraph(Uri graphUri)
 {
     if (graphUri == null)
     {
         if (InternalDefaultGraph != null)
         {
             GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(InternalDefaultGraph);
             wrapper.Clear();
             _actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
             return(true);
         }
         else if (HasGraph(graphUri))
         {
             _actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             return(RemoveGraphInternal(graphUri));
         }
     }
     else if (HasGraph(graphUri))
     {
         _actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         return(RemoveGraphInternal(graphUri));
     }
     return(false);
 }
Beispiel #6
0
 /// <summary>
 /// Removes a Graph from the Dataset
 /// </summary>
 /// <param name="graphUri">Graph URI</param>
 public sealed override void RemoveGraph(Uri graphUri)
 {
     if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
     {
         if (this.DefaultGraph != null)
         {
             GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(DefaultGraph);
             wrapper.Clear();
             this._actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
         }
         else if (this.HasGraph(graphUri))
         {
             this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             this.RemoveGraphInternal(graphUri);
         }
     }
     else if (this.HasGraph(graphUri))
     {
         this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         this.RemoveGraphInternal(graphUri);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Removes a Graph from the Dataset
 /// </summary>
 /// <param name="graphUri">Graph URI</param>
 public override sealed void RemoveGraph(Uri graphUri)
 {
     if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
     {
         if (this.DefaultGraphUris.Any())
         {
             foreach (Uri u in this.DefaultGraphUris)
             {
                 if (this.IsDefaultGraph(u))
                 {
                     //Default Graph gets cleared
                     GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(this[u]);
                     wrapper.Clear();
                     this._actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
                 }
                 else
                 {
                     //Other Graphs get actually deleted
                     this._actions.Add(new GraphPersistenceAction(this[u], GraphPersistenceActionType.Deleted));
                 }
             }
         }
         else if (this.HasGraph(graphUri))
         {
             this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
             this.RemoveGraphInternal(graphUri);
         }
     }
     else if (this.HasGraph(graphUri))
     {
         this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
         this.RemoveGraphInternal(graphUri);
     }
 }