Example #1
0
 /// <summary>
 ///     Should only be invoked after loading is complete. Committing the transaction before will cause the loading to fail.
 /// </summary>
 public void Commit()
 {
     _currentEdge         = null;
     _currentEdgeCached   = null;
     _remainingBufferSize = 0;
     _baseGraph.Commit();
 }
Example #2
0
        public IEdge AddEdge(object id, IVertex outVertex, IVertex inVertex, string label)
        {
            GraphContract.ValidateAddEdge(id, outVertex, inVertex, label);

            if (!(outVertex is BatchVertex) || !(inVertex is BatchVertex))
            {
                throw new ArgumentException("Given element was not created in this baseGraph");
            }
            NextElement();

            var ov = GetCachedVertex(outVertex.Id);
            var iv = GetCachedVertex(inVertex.Id);

            _previousOutVertexId = outVertex.Id; //keep track of the previous out vertex id

            if (ov != null && iv != null)
            {
                _currentEdgeCached = _baseGraph.AddEdge(id, ov, iv, label);
                if (_edgeIdKey != null && id != null)
                {
                    _currentEdgeCached.SetProperty(_edgeIdKey, id);
                }
            }

            _currentEdge = new BatchEdge(this);
            return(_currentEdge);
        }
Example #3
0
 public void Shutdown()
 {
     _baseGraph.Commit();
     _baseGraph.Shutdown();
     _currentEdge       = null;
     _currentEdgeCached = null;
 }
Example #4
0
 private void NextElement()
 {
     _currentEdge       = null;
     _currentEdgeCached = null;
     if (_remainingBufferSize <= 0)
     {
         _baseGraph.Commit();
         _cache.NewTransaction();
         _remainingBufferSize = _bufferSize;
     }
     _remainingBufferSize--;
 }