Beispiel #1
0
 public IGraph this[Uri graphUri]
 {
     get
     {
         IGraph graph = new SpinWrappedGraph();
         graph.BaseUri = graphUri;
         return(graph);
     }
 }
Beispiel #2
0
        private void OnModificableGraphCleared(object sender, GraphEventArgs e)
        {
            SpinWrappedGraph graph = (SpinWrappedGraph)e.Graph;

            graph.Reset();

            IUriNode sourceGraph = RDFUtil.CreateUriNode(graph.BaseUri);
            IUriNode graphNode   = RDFUtil.CreateUriNode(GetUpdateControlUri(graph.BaseUri));

            this.Retract(graphNode, RDFRuntime.PropertyUpdatesGraph, sourceGraph);
            this.Assert(graphNode, RDFRuntime.PropertyReplacesGraph, sourceGraph);
        }
Beispiel #3
0
        private IGraph GetModifiableGraph(Uri graphUri, INode modificationMode)
        {
            if (_modificableGraphs.ContainsKey(graphUri))
            {
                return(_modificableGraphs[graphUri]);
            }
            if (ContainsTriple(new Triple(RDFUtil.CreateUriNode(graphUri), RDF.PropertyType, RDFRuntime.ClassReadOnlyGraph)))
            {
                throw new SpinException("The graph " + graphUri.ToString() + " is marked as Readonly for the current dataset");
            }

            IUriNode sourceGraph        = RDFUtil.CreateUriNode(graphUri);
            IUriNode updateControlGraph = RDFUtil.CreateUriNode(GetUpdateControlUri(graphUri, true));

            this.Retract(RDFUtil.CreateUriNode(BaseUri), RDFRuntime.PropertyRemovesGraph, sourceGraph);
            this.Assert(sourceGraph, RDF.PropertyType, SD.ClassGraph);
            this.Assert(updateControlGraph, RDF.PropertyType, RDFRuntime.ClassUpdateControlGraph);

            if (!RDFUtil.sameTerm(sourceGraph, updateControlGraph))
            {
                this.Assert(updateControlGraph, modificationMode, sourceGraph);
                this.Assert(updateControlGraph, RDFRuntime.PropertyUpdatesGraph, updateControlGraph);
            }
            else
            {
                this.Assert(updateControlGraph, RDFRuntime.PropertyUpdatesGraph, sourceGraph);
            }

            SpinWrappedGraph graph = (SpinWrappedGraph)this[graphUri];

            graph.BaseUri  = graphUri;
            graph.Readonly = false;
            graph.Changed += OnModificableGraphChange;
            graph.Cleared += OnModificableGraphCleared;
            _modificableGraphs[graphUri] = graph;
            return(graph);
        }
Beispiel #4
0
 internal Uri GetTripleRemovalsMonitorUri(SpinWrappedGraph graph)
 {
     return(GetTripleRemovalsMonitorUri(GetUpdateControlUri(graph.BaseUri)));
 }