Ejemplo n.º 1
0
        internal void OnMonitoredGraphCleared(object sender, GraphEventArgs e)
        {
            SpinWrappedGraph g = (SpinWrappedGraph)GetModifiableGraph(e.Graph.BaseUri);

            g.Clear();
            Storage.DeleteGraph(g.BaseUri);
            _ignoreMonitoredChangeEvents = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a graph in the dataset and submits it to SPIN processing.
        /// If the graph already exists in the dataset, this will lead its replacement by the new graph.
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public bool AddGraph(IGraph g)
        {
            SpinWrappedGraph graph = (SpinWrappedGraph)GetModifiableGraph(g.BaseUri);

            graph.Reset();

            // Add graph handlers to monitor subsequent changes to the graph
            g.Changed        += OnMonitoredGraphChanged;
            g.ClearRequested += OnMonitoredGraphClearRequested;
            g.Cleared        += OnMonitoredGraphCleared;

            // Add the graph to the synchronized collection so remote updates are reflected locally on updates completion
            _synchronizedGraphs.Add(g);

            graph.Assert(g.Triples);
            ExecuteUpdate();

            return(true);
        }
Ejemplo n.º 3
0
        internal void OnMonitoredGraphChanged(object sender, GraphEventArgs e)
        {
            if (_ignoreMonitoredChangeEvents)
            {
                return;
            }
            Uri graphUri       = e.Graph.BaseUri;
            SpinWrappedGraph g = (SpinWrappedGraph)GetModifiableGraph(graphUri);

            if (e.TripleEvent != null)
            {
                if (e.TripleEvent.WasAsserted)
                {
                    g.Assert(e.TripleEvent.Triple);
                }
                else
                {
                    g.Retract(e.TripleEvent.Triple);
                }
            }
        }