本文整理汇总了C#中sones.Library.Commons.Transaction.TransactionToken类的典型用法代码示例。如果您正苦于以下问题:C# TransactionToken类的具体用法?C# TransactionToken怎么用?C# TransactionToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionToken类属于sones.Library.Commons.Transaction命名空间,在下文中一共展示了TransactionToken类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is IHyperEdge)
{
return new FuncParameter((UInt64)((IHyperEdge)myCallingObject).GetAllEdges().Count());
}
else if (myCallingObject is ISingleEdge)
{
UInt64 count = 1;
return new FuncParameter(count);
}
else if (myCallingObject is IncomingEdgeCollection)
{
return new FuncParameter((UInt64)(myCallingObject as IncomingEdgeCollection).LongCount());
}
else if (myCallingObject is IEnumerable<long>)
{
return new FuncParameter((UInt64)(myCallingObject as IEnumerable<long>).LongCount());
}
else if (myCallingObject is IEnumerable<IVertex>)
{
return new FuncParameter((UInt64)(myCallingObject as IEnumerable<IVertex>).LongCount());
}
else
{
throw new UnknownDBException("Unexpected input for COUNT aggregate.");
}
}
开发者ID:loubo,项目名称:sones,代码行数:28,代码来源:CountFunc.cs
示例2: Execute
public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
_query = myQuery;
var vertexType = myGraphDB.GetVertexType<IVertexType>(
mySecurityToken,
myTransactionToken,
new RequestGetVertexType(_typeName),
(stats, vType) => vType);
_WhereExpression.Validate(myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, vertexType);
var expressionGraph = _WhereExpression.Calculon(myPluginManager, myGraphDB, mySecurityToken,
myTransactionToken,
new CommonUsageGraph(myGraphDB, mySecurityToken,
myTransactionToken));
var toBeDeletedVertices =
expressionGraph.Select(
new LevelKey(vertexType.ID, myGraphDB, mySecurityToken, myTransactionToken),
null, true);
//TODO: do sth that is better than that: ew RequestDelete(new RequestGetVertices(_typeName, toBeDeletedVertices.Select(_ => _.VertexID))).
return myGraphDB.Delete<QueryResult>(
mySecurityToken,
myTransactionToken,
new RequestDelete(new RequestGetVertices(_typeName, toBeDeletedVertices.Select(_ => _.VertexID))).AddAttributes(_toBeDeletedAttributes),
CreateQueryResult);
}
开发者ID:loubo,项目名称:sones,代码行数:29,代码来源:DeleteNode.cs
示例3: ExecFunc
/// <summary>
/// Executes the function on myCallingObject
/// </summary>
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
var currentInnerEdgeType = ((IOutgoingEdgeDefinition)myAttributeDefinition).InnerEdgeType;
if (myCallingObject is IHyperEdge && currentInnerEdgeType.HasProperty("Weight"))
{
var hyperEdge = myCallingObject as IHyperEdge;
if (currentInnerEdgeType.HasProperty("Weight"))
{
var weightProperty = currentInnerEdgeType.GetPropertyDefinition("Weight");
var maxWeight = hyperEdge.InvokeHyperEdgeFunc<Double>(singleEdges =>
{
return Convert.ToDouble(
weightProperty.GetValue(
singleEdges
.OrderByDescending(edge => weightProperty.GetValue(edge))
.First()));
});
return new FuncParameter(maxWeight);
}
}
throw new InvalidTypeException(myCallingObject.GetType().ToString(), "Weighted IHyperEdge");
}
开发者ID:loubo,项目名称:sones,代码行数:31,代码来源:MaxWeightFunc.cs
示例4: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (!(myCallingObject is String))
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
var pos = Convert.ToInt32(myParams[0].Value);
StringBuilder resString = new StringBuilder();
bool dontInsert = false;
if (pos > (myCallingObject as String).Length)
{
dontInsert = true;
resString.Append((myCallingObject as String).ToString());
}
else
{
resString.Append((myCallingObject as String).ToString().Substring(0, pos));
}
foreach (FuncParameter fp in myParams.Skip(1))
{
resString.Append(fp.Value as String);
}
if(!dontInsert)
resString.Append((myCallingObject as String).ToString().Substring(pos));
return new FuncParameter(resString.ToString());
}
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:InsertFunc.cs
示例5: GetResult
public override QueryResult GetResult(
GQLPluginManager myPluginManager,
IGraphDB myGraphDB,
SecurityToken mySecurityToken,
TransactionToken myTransactionToken)
{
var resultingVertices = new List<IVertexView>();
ASonesException error = null;
#region Specific index
var request = new RequestDescribeIndex(_TypeName, _IndexName, _IndexEdition);
var indices = myGraphDB.DescribeIndex<IEnumerable<IIndexDefinition>>(mySecurityToken, myTransactionToken, request, (stats, definitions) => definitions);
if (indices == null)
{
error = new IndexTypeDoesNotExistException(_TypeName, _IndexName);
}
if (String.IsNullOrEmpty(_IndexEdition))
{
//_IndexEdition = DBConstants.DEFAULTINDEX;
}
resultingVertices = new List<IVertexView>() { GenerateOutput(indices, _IndexName) };
#endregion
if(error != null)
return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Failed, resultingVertices, error);
else
return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Successful, resultingVertices);
}
开发者ID:loubo,项目名称:sones,代码行数:34,代码来源:DescribeIndexDefinition.cs
示例6: Execute
public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
Query = myQuery;
var indexDef = new IndexPredefinition(_IndexName);
indexDef.SetIndexType(_IndexType);
indexDef.SetVertexType(_DBType);
indexDef.SetEdition(_IndexEdition);
//to be indices attributes
foreach (var aIndexedProperty in _AttributeList)
{
indexDef.AddProperty(aIndexedProperty.IndexAttribute.ContentString);
}
//options for the index
if (_options != null)
{
foreach (var aKV in _options)
{
indexDef.AddOption(aKV.Key, aKV.Value);
}
}
return myGraphDB.CreateIndex<QueryResult>(mySecurityToken, myTransactionToken, new RequestCreateIndex(indexDef), GenerateResult);
}
开发者ID:loubo,项目名称:sones,代码行数:26,代码来源:CreateIndexNode.cs
示例7: AddVertex
public IVertex AddVertex(RequestInsertVertex myInsertDefinition, TransactionToken myTransaction, SecurityToken mySecurity)
{
IVertexType vertexType = GetVertexType(myInsertDefinition.VertexTypeName, myTransaction, mySecurity);
if (vertexType.IsAbstract)
throw new AbstractConstraintViolationException(myInsertDefinition.VertexTypeName);
ConvertUnknownProperties(myInsertDefinition, vertexType);
ConvertDefaultValues(myInsertDefinition, vertexType);
if (myInsertDefinition.OutgoingEdges != null)
CheckOutgoingEdges(myInsertDefinition.OutgoingEdges, vertexType);
if (myInsertDefinition.StructuredProperties != null)
{
CheckAddStructuredProperties(myInsertDefinition.StructuredProperties, vertexType);
}
CheckMandatoryConstraint(myInsertDefinition, vertexType);
if (myInsertDefinition.BinaryProperties != null)
CheckAddBinaryProperties(myInsertDefinition, vertexType);
return null;
}
开发者ID:loubo,项目名称:sones,代码行数:25,代码来源:CheckVertexHandler.cs
示例8: CreateQueryPlan
/// <summary>
/// Creates a query plan using a logic expression
/// </summary>
/// <param name="myExpression">The logic expression</param>
/// <param name="myIsLongRunning">Determines whether it is anticipated that the request could take longer</param>
/// <param name="myTransaction">The current transaction token</param>
/// <param name="mySecurity">The current security token</param>
/// <returns>A query plan</returns>
public IQueryPlan CreateQueryPlan(IExpression myExpression, Boolean myIsLongRunning, TransactionToken myTransaction, SecurityToken mySecurity)
{
IQueryPlan result;
switch (myExpression.TypeOfExpression)
{
case TypeOfExpression.Binary:
result = GenerateFromBinaryExpression((BinaryExpression) myExpression, myIsLongRunning, myTransaction, mySecurity);
break;
case TypeOfExpression.Unary:
result = GenerateFromUnaryExpression((UnaryExpression)myExpression, myTransaction, mySecurity);
break;
case TypeOfExpression.Property:
result = GenerateFromPropertyExpression((PropertyExpression)myExpression, myTransaction, mySecurity);
break;
default:
throw new ArgumentOutOfRangeException();
}
return result;
}
开发者ID:loubo,项目名称:sones,代码行数:38,代码来源:QueryPlanManager.cs
示例9: Execute
public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
var sw = Stopwatch.StartNew();
QueryResult result = null;
if (_DumpFormat.ToString().ToUpper().Equals("GQL"))
{
var plugin = myPluginManager.GetAndInitializePlugin<IGraphDBExport>("GQLEXPORT");
if (plugin != null)
{
result = plugin.Export(_DumpDestination, _DumpableGrammar, myGraphDB, myGraphQL, mySecurityToken, myTransactionToken, _TypesToDump, _DumpType);
}
}
sw.Stop();
if (result != null)
{
return new QueryResult(myQuery, _DumpFormat.ToString(), (ulong)sw.ElapsedMilliseconds, result.TypeOfResult, result.Vertices, result.Error);
}
else
return null;
}
开发者ID:loubo,项目名称:sones,代码行数:25,代码来源:DumpNode.cs
示例10: CommonUsageGraph
/// <summary>
/// Constructor
/// </summary>
public CommonUsageGraph(IGraphDB myIGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
: this()
{
_iGraphDB = myIGraphDB;
_securityToken = mySecurityToken;
_transactionToken = myTransactionToken;
_Levels = new Dictionary<int, IExpressionLevel>();
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:CommonUsageGraph.cs
示例11: LevelKey
public LevelKey(IEnumerable<EdgeKey> myEdgeKey, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
Edges = new List<EdgeKey>();
foreach (var aEdgeKey in myEdgeKey)
{
if (aEdgeKey.IsAttributeSet)
{
var vertexType = myGraphDB.GetVertexType<IVertexType>
(mySecurityToken,
myTransactionToken,
new RequestGetVertexType(aEdgeKey.VertexTypeID),
(stats, type) => type);
var attribute = vertexType.GetAttributeDefinition(aEdgeKey.AttributeID);
if (attribute != null && attribute.Kind != AttributeType.Property)
{
//so there is an edge
Edges.Add(aEdgeKey);
Level++;
AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);
}
else
{
if (Level == 0)
{
var newEdgeKey = new EdgeKey(aEdgeKey.VertexTypeID);
Edges.Add(newEdgeKey);
AddHashCodeFromSingleEdge(ref _hashcode, newEdgeKey);
break;
}
else
{
break;
}
}
}
else
{
if (Level == 0)
{
Edges.Add(aEdgeKey);
AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);
break;
}
else
{
break;
}
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:58,代码来源:LevelKey.cs
示例12: Execute
public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
_query = myQuery;
return myGraphDB.AlterVertexType<QueryResult>(
mySecurityToken,
myTransactionToken,
CreateNewRequest(myGraphDB, myPluginManager, mySecurityToken, myTransactionToken),
CreateOutput);
}
开发者ID:loubo,项目名称:sones,代码行数:10,代码来源:AlterVertexTypeNode.cs
示例13: AddVertexTypes
public override IEnumerable<IVertexType> AddVertexTypes(IEnumerable<VertexTypePredefinition> myVertexTypeDefinitions, TransactionToken myTransaction, SecurityToken mySecurity)
{
#region check arguments
myVertexTypeDefinitions.CheckNull("myVertexTypeDefinitions");
#endregion
CheckAdd(myVertexTypeDefinitions);
return null;
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:CheckVertexTypeManager.cs
示例14: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is String)
{
return new FuncParameter(((String)myCallingObject).ToLower());
}
else
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:ToLowerFunc.cs
示例15: Import
public QueryResult Import(String myLocation, IGraphDB myGraphDB, IGraphQL myGraphQL, SecurityToken mySecurityToken, TransactionToken myTransactionToken, UInt32 myParallelTasks = 1U, IEnumerable<string> myComments = null, UInt64? myOffset = null, UInt64? myLimit = null, VerbosityTypes myVerbosityType = VerbosityTypes.Silent)
{
ASonesException error;
Stream stream = null;
QueryResult result;
#region Read querie lines from location
try
{
#region file
if (myLocation.ToLower().StartsWith(@"file:\\"))
{
//lines = ReadFile(location.Substring(@"file:\\".Length));
stream = GetStreamFromFile(myLocation.Substring(@"file:\\".Length));
}
#endregion
#region http
else if (myLocation.ToLower().StartsWith("http://"))
{
stream = GetStreamFromHttp(myLocation);
}
#endregion
else
{
error = new InvalidImportLocationException(myLocation, @"file:\\", "http://");
result = new QueryResult("", ImportFormat, 0L, ResultType.Failed, null, error);
return result;
}
#region Start import using the AGraphDBImport implementation and return the result
return Import(stream, myGraphDB, myGraphQL, mySecurityToken, myTransactionToken, myParallelTasks, myComments, myOffset, myLimit, myVerbosityType);
#endregion
}
catch (Exception ex)
{
#region throw new exception
error = new ImportFailedException(ex);
result = new QueryResult("", ImportFormat, 0L, ResultType.Failed, null, error);
return result;
#endregion
}
finally
{
if (stream != null)
{
stream.Dispose();
}
}
#endregion
}
开发者ID:loubo,项目名称:sones,代码行数:54,代码来源:GraphDBImport_GQL.cs
示例16: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject != null)
{
return new FuncParameter(true);
}
else
{
return new FuncParameter(false);
}
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:Exists.cs
示例17: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (!(myCallingObject is String))
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
var substring = myCallingObject.ToString().Substring(Convert.ToInt32(myParams[0].Value), Convert.ToInt32(myParams[1].Value));
return new FuncParameter(substring);
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:SubstringFunc.cs
示例18: Execute
public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
var sw = Stopwatch.StartNew();
QueryResult result = null;
_query = myQuery;
String myAction = "";
IEnumerable<IVertex> myToBeUpdatedVertices = null;
//prepare
var vertexType = myGraphDB.GetVertexType<IVertexType>(
mySecurityToken,
myTransactionToken,
new RequestGetVertexType(_Type),
(stats, vtype) => vtype);
if (_WhereExpression != null)
{
//validate
_WhereExpression.Validate(myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, vertexType);
//calculate
var expressionGraph = _WhereExpression.Calculon(myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, new CommonUsageGraph(myGraphDB, mySecurityToken, myTransactionToken), false);
//extract
myToBeUpdatedVertices = expressionGraph.Select(new LevelKey(vertexType.ID, myGraphDB, mySecurityToken, myTransactionToken), null, true).ToList();
}
if (myToBeUpdatedVertices != null && myToBeUpdatedVertices.Count() > 0)
{
//update
result = ProcessUpdate(myToBeUpdatedVertices, myGraphDB, myPluginManager, mySecurityToken, myTransactionToken);
myAction = "Updated";
}
else
{
//insert
result = ProcessInsert(myGraphDB, myPluginManager, mySecurityToken, myTransactionToken);
myAction = "Inserted";
}
if (result.Error != null)
throw result.Error;
sw.Stop();
return GenerateResult(sw.Elapsed.TotalMilliseconds, result, myAction);
}
开发者ID:loubo,项目名称:sones,代码行数:52,代码来源:InsertOrUpdateNode.cs
示例19: GetResult
public override QueryResult GetResult(
GQLPluginManager myPluginManager,
IGraphDB myGraphDB,
SecurityToken mySecurityToken,
TransactionToken myTransactionToken)
{
var resultingVertices = new List<IVertexView>();
ASonesException error = null;
if (!String.IsNullOrEmpty(_EdgeName))
{
#region Specific edge
var request = new RequestGetEdgeType(_EdgeName);
var edge = myGraphDB.GetEdgeType<IEdgeType>(mySecurityToken, myTransactionToken, request, (stats, edgeType) => edgeType);
if (edge != null)
{
resultingVertices = new List<IVertexView>() { GenerateOutput(edge, _EdgeName) };
}
else
{
error = new EdgeTypeDoesNotExistException(_EdgeName, "");
}
#endregion
}
else
{
#region All edges
var resultingReadouts = new List<IVertexView>();
var request = new RequestGetAllEdgeTypes();
foreach (var edge in myGraphDB.GetAllEdgeTypes<IEnumerable<IEdgeType>>(mySecurityToken, myTransactionToken, request, (stats, edgeTypes) => edgeTypes))
{
resultingReadouts.Add(GenerateOutput(edge, edge.Name));
}
#endregion
}
if(error != null)
return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Failed, resultingVertices, error);
else
return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Successful, resultingVertices);
}
开发者ID:loubo,项目名称:sones,代码行数:51,代码来源:DescribeEdgeDefinition.cs
示例20: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is UInt64)
{
var dtValue = Convert.ToDateTime((UInt64)myCallingObject);
return new FuncParameter((Int64)UNIXTimeConversionExtension.ToUnixTimeStamp(dtValue));
}
else if (myCallingObject is DateTime)
{
return new FuncParameter(UNIXTimeConversionExtension.ToUnixTimeStamp((DateTime)myCallingObject));
}
else
{
throw new InvalidTypeException(myCallingObject.GetType().ToString(), "DateTime");
}
}
开发者ID:loubo,项目名称:sones,代码行数:16,代码来源:ToUNIXDate.cs
注:本文中的sones.Library.Commons.Transaction.TransactionToken类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论