本文整理汇总了C#中DBObjectStream.GetBackwardEdges方法的典型用法代码示例。如果您正苦于以下问题:C# DBObjectStream.GetBackwardEdges方法的具体用法?C# DBObjectStream.GetBackwardEdges怎么用?C# DBObjectStream.GetBackwardEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectStream
的用法示例。
在下文中一共展示了DBObjectStream.GetBackwardEdges方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAttributeValue
/// <summary>
/// Extracts the attribute from <paramref name="myDBObject"/>.
/// </summary>
/// <param name="myType"></param>
/// <param name="myTypeAttribute"></param>
/// <param name="myDBObject"></param>
/// <param name="myLevelKey"></param>
/// <returns></returns>
private Object GetAttributeValue(GraphDBType myType, TypeAttribute myTypeAttribute, DBObjectStream myDBObject, EdgeList myLevelKey)
{
if (myTypeAttribute.TypeCharacteristics.IsBackwardEdge)
{
#region IsBackwardEdge
EdgeKey edgeKey = myTypeAttribute.BackwardEdgeDefinition;
var contBackwardExcept = myDBObject.ContainsBackwardEdge(edgeKey, _DBContext, _DBContext.DBObjectCache, myType);
if (contBackwardExcept.Failed())
throw new GraphDBException(contBackwardExcept.IErrors);
if (contBackwardExcept.Value)
{
var getBackwardExcept = myDBObject.GetBackwardEdges(edgeKey, _DBContext, _DBContext.DBObjectCache, myTypeAttribute.GetDBType(_DBContext.DBTypeManager));
if (getBackwardExcept.Failed())
throw new GraphDBException(getBackwardExcept.IErrors);
return getBackwardExcept.Value;
}
#endregion
}
else if (myDBObject.HasAttribute(myTypeAttribute.UUID, myType))
{
#region ELSE (!IsBackwardEdge)
return myDBObject.GetAttribute(myTypeAttribute.UUID, myType, _DBContext);
#endregion
}
return null;
}
示例2: GetAttributeValueAndResolve
/// <summary> Gets an attribute value - references will be resolved. </summary>
///
/// <remarks> Stefan, 16.04.2010. </remarks>
///
/// <param name="myType"> Type. </param>
/// <param name="myTypeAttribute"> my type attribute. </param>
/// <param name="myDBObject"> my database object. </param>
/// <param name="myDepth"> Depth of my. </param>
/// <param name="myLevelKey"> my level key. </param>
/// <param name="reference"> The reference. </param>
/// <param name="myUsingGraph"> true to my using graph. </param>
/// <param name="attributeValue"> [out] The attribute value. </param>
///
/// <returns> true if it succeeds, false if the DBO does not have the attribute. </returns>
private Boolean GetAttributeValueAndResolve(GraphDBType myType, SelectionElement mySelectionelement, DBObjectStream myDBObject, Int64 myDepth, EdgeList myLevelKey, String reference, Boolean myUsingGraph, out Object attributeValue, String myUndefAttrName = null)
{
var typeAttribute = mySelectionelement.Element;
if (typeAttribute.TypeCharacteristics.IsBackwardEdge)
{
#region IsBackwardEdge
EdgeKey edgeKey = typeAttribute.BackwardEdgeDefinition;
var contBackwardExcept = myDBObject.ContainsBackwardEdge(edgeKey, _DBContext, _DBContext.DBObjectCache, myType);
if (contBackwardExcept.Failed())
throw new GraphDBException(contBackwardExcept.IErrors);
if (contBackwardExcept.Value)
{
if (myDepth > 0)
{
var dbos = myDBObject.GetBackwardEdges(edgeKey, _DBContext, _DBContext.DBObjectCache, typeAttribute.GetDBType(_DBContext.DBTypeManager));
if (dbos.Failed())
throw new GraphDBException(dbos.IErrors);
if (dbos.Value != null)
{
attributeValue = ResolveAttributeValue(typeAttribute, dbos.Value, myDepth, myLevelKey, myDBObject, reference, myUsingGraph);
return true;
}
}
else
{
attributeValue = GetNotResolvedBackwardEdgeReferenceAttributeValue(myDBObject, typeAttribute, edgeKey, myLevelKey, myUsingGraph, _DBContext);
return true;
}
}
#endregion
}
else if (myDBObject.HasAttribute(typeAttribute, _DBContext))
{
#region SelectValueAssignment - kind of static assignment of selected attribute
if (mySelectionelement.SelectValueAssignment != null && mySelectionelement.SelectValueAssignment.ValueAssignmentType == SelectValueAssignment.ValueAssignmentTypes.Always)
{
// Currently the prior add SelectionElement verifies that TermDefinition is always a ValueDefinition - if others will become valid this must be changed!
attributeValue = (mySelectionelement.SelectValueAssignment.TermDefinition as ValueDefinition).Value.Value;
return true;
}
#endregion
#region ELSE (!IsBackwardEdge)
#region not a reference attribute value
if (!typeAttribute.IsUserDefinedType(_DBContext.DBTypeManager))
{
var attrVal = myDBObject.GetAttribute(typeAttribute, myType, _DBContext);
if (attrVal.Failed())
{
throw new GraphDBException(attrVal.IErrors);
}
// currently, we do not want to return a ADBBaseObject but the real value
if (attrVal.Value is ADBBaseObject)
attributeValue = (attrVal.Value as ADBBaseObject).GetReadoutValue();
else if (attrVal.Value is IBaseEdge)
attributeValue = (attrVal.Value as IBaseEdge).GetReadoutValues();
else
attributeValue = attrVal.Value;
return true;
}
#endregion
#region ELSE Reference attribute value
else
{
//.........这里部分代码省略.........
示例3: GetNotResolvedBackwardEdgeReferenceAttributeValue
private Edge GetNotResolvedBackwardEdgeReferenceAttributeValue(DBObjectStream myDBObject, TypeAttribute myTypeAttribute, EdgeKey edgeKey, EdgeList currentEdgeList, Boolean myUsingGraph, DBContext _DBContext)
{
IObject attrValue = null;
if (myUsingGraph)
{
var interestingLevelKey = new LevelKey((currentEdgeList + new EdgeKey(myTypeAttribute.RelatedGraphDBTypeUUID, myTypeAttribute.UUID)).Edges, _DBContext.DBTypeManager);
attrValue = new EdgeTypeSetOfReferences(_ExpressionGraph.SelectUUIDs(interestingLevelKey, myDBObject), myTypeAttribute.DBTypeUUID);
}
else
{
var attrValueException = myDBObject.GetBackwardEdges(edgeKey, _DBContext, _DBContext.DBObjectCache, myTypeAttribute.GetDBType(_DBContext.DBTypeManager));
if (attrValueException.Failed())
{
throw new GraphDBException(attrValueException.IErrors);
}
attrValue = attrValueException.Value;
}
if (attrValue == null)
{
return null;
}
else if (!(attrValue is IReferenceEdge))
{
throw new GraphDBException(new Error_InvalidEdgeType(attrValue.GetType(), typeof(IReferenceEdge)));
}
var readouts = new List<Vertex>();
var typeName = _DBContext.DBTypeManager.GetTypeByUUID(edgeKey.TypeUUID).Name;
foreach (var reference in (attrValue as IReferenceEdge).GetAllReferenceIDs())
{
var specialAttributes = new Dictionary<string, object>();
specialAttributes.Add(SpecialTypeAttribute_UUID.AttributeName, reference);
specialAttributes.Add(SpecialTypeAttribute_TYPE.AttributeName, typeName);
readouts.Add(new Vertex(specialAttributes));
}
return new Edge(null, readouts, _DBContext.DBTypeManager.GetTypeAttributeByEdge(edgeKey).GetDBType(_DBContext.DBTypeManager).Name);
}
示例4: AddAttributesByDBO
//.........这里部分代码省略.........
}
else
{
myAttributes.Add(typeAttr.Name, GetNotResolvedReferenceAttributeValue(myDBObject, typeAttr, myType, myEdgeList, myUsingGraph, _DBContext));
}
}
#endregion
}
else
{
throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
}
}
#endregion
#region Get all backwardEdge attributes
if (mySelType == TypesOfSelect.Minus || mySelType == TypesOfSelect.Asterisk || mySelType == TypesOfSelect.Ad || mySelType == TypesOfSelect.Lt)
{
foreach (var beAttr in GetBackwardEdgeAttributes(myType))
{
if (myDepth > 0)
{
if (mySelType == TypesOfSelect.Ad)
{
if (beAttr.BackwardEdgeDefinition.TypeUUID != myTypeID)
{
continue;
}
}
var bes = myDBObject.GetBackwardEdges(beAttr.BackwardEdgeDefinition, _DBContext, _DBContext.DBObjectCache, beAttr.GetDBType(_DBContext.DBTypeManager));
if (bes.Failed())
throw new GraphDBException(bes.IErrors);
if (bes.Value != null) // otherwise the DBO does not have any
myAttributes.Add(beAttr.Name, ResolveAttributeValue(beAttr, bes.Value, myDepth, myEdgeList, myDBObject, myReference, myUsingGraph));
}
else
{
if (mySelType == TypesOfSelect.Ad)
{
if (beAttr.BackwardEdgeDefinition.TypeUUID != myTypeID)
{
continue;
}
}
var notResolvedBEs = GetNotResolvedBackwardEdgeReferenceAttributeValue(myDBObject, beAttr, beAttr.BackwardEdgeDefinition, myEdgeList, myUsingGraph, _DBContext);
if (notResolvedBEs != null)
{
myAttributes.Add(beAttr.Name, notResolvedBEs);
}
}
}
}
#endregion
#region Get all undefined attributes from DBO
if (mySelType == TypesOfSelect.Asterisk || mySelType == TypesOfSelect.Rhomb)
{
var undefAttrException = myDBObject.GetUndefinedAttributes(_DBContext.DBObjectManager);
if (undefAttrException.Failed())
throw new GraphDBException(undefAttrException.IErrors);
foreach (var undefAttr in undefAttrException.Value)
myAttributes.Add(undefAttr.Key, undefAttr.Value.GetReadoutValue());
}
#endregion
#region Add special attributes
if (mySelType == TypesOfSelect.Asterisk)
{
foreach (var specialAttr in GetSpecialAttributes(myType))
{
if (!myAttributes.ContainsKey(specialAttr.Name))
{
var result = (specialAttr as ASpecialTypeAttribute).ExtractValue(myDBObject, myType, _DBContext);
if (result.Failed())
{
throw new GraphDBException(result.IErrors);
}
myAttributes.Add(specialAttr.Name, result.Value.GetReadoutValue());
}
}
}
#endregion
}