コード例 #1
0
ファイル: GraphDSServer.cs プロジェクト: alrehamy/sones
 public TResult Update <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, Int64 myTransactionToken, RequestUpdate myRequestUpdate, Converter.UpdateResultConverter <TResult> myOutputconverter)
 {
     return(_iGraphDB.Update <TResult>(mySecurityToken,
                                       myTransactionToken,
                                       myRequestUpdate,
                                       myOutputconverter));
 }
コード例 #2
0
ファイル: GraphMLImport.cs プロジェクト: zhouweiaccp/sones
        /// <summary>
        /// Reads an edge information from the GraphML File and inserts
        /// the edge in the GraphDB by altering the existing source vertex.
        ///
        /// Currently only the "weight" attribute will be considered and
        /// has to be annotated correctly (see class documentation).
        /// </summary>
        /// <param name='myReader'>
        /// XmlReader
        /// </param>
        private void ReadEdge(XmlReader myReader)
        {
            #region read edge data

            var sourceID = ReadVertexID(myReader, GraphMLTokens.SOURCE);
            var targetID = ReadVertexID(myReader, GraphMLTokens.TARGET);

            if (!_VertexIDMapper.ContainsKey(sourceID) || !_VertexIDMapper.ContainsKey(targetID))
            {
                throw new InvalidDataException(String.Format(
                                                   "Source or Target vertexID for edge ({0},{1}) doesn't exist",
                                                   sourceID,
                                                   targetID));
            }

            // get the weight
            var edgeWeight = ReadEdgeWeight(myReader);

            #endregion

            #region create edge (update vertex)

            var hyperEdge = new EdgePredefinition(_EdgeTypeName);
            hyperEdge.AddEdge(new EdgePredefinition()
                              .AddVertexID(_VertexTypeName, _VertexIDMapper[targetID])
                              .AddUnknownProperty(
                                  GraphMLTokens.EDGE_WEIGHT,
                                  Convert.ChangeType(edgeWeight, typeof(String), CultureInfo.GetCultureInfo("en-us"))
                                  ));


            var requestUpdate = new RequestUpdate(new RequestGetVertices(_VertexTypeName, new List <long>()
            {
                _VertexIDMapper[sourceID]
            }));
            requestUpdate.AddElementsToCollection(_EdgeTypeName, hyperEdge);

            // process the update
            _GraphDB.Update <IEnumerable <IVertex> >(
                _SecurityToken,
                _TransactionToken,
                requestUpdate,
                (stats, v) => v
                );

            _EdgeCount++;

            #endregion
        }
コード例 #3
0
        /// <summary>
        /// Executes the statement and returns a IQueryResult.
        /// </summary>
        public override IQueryResult Execute(IGraphDB myGraphDB,
                                             IGraphQL myGraphQL,
                                             GQLPluginManager myPluginManager,
                                             String myQuery,
                                             SecurityToken mySecurityToken,
                                             Int64 myTransactionToken)
        {
            Query = myQuery;

            return(myGraphDB.Update(mySecurityToken,
                                    myTransactionToken,
                                    GenerateUpdateRequest(myGraphDB,
                                                          myPluginManager,
                                                          mySecurityToken,
                                                          myTransactionToken),
                                    GenerateOutput));
        }
コード例 #4
0
ファイル: UpdateNode.cs プロジェクト: loubo/sones
        /// <summary>
        /// Executes the statement and returns a QueryResult.
        /// </summary>
        public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            Query = myQuery;

            return myGraphDB.Update(mySecurityToken, myTransactionToken, GenerateUpdateRequest(myGraphDB, myPluginManager, mySecurityToken, myTransactionToken), GenerateOutput);
        }