Пример #1
0
        private string CreateGraphDMLforIVertex(
            IVertexType myVertexType,
            IVertex myVertex,
            Dictionary<long, IPropertyDefinition> myPropertyDefinitions)
        {
            var stringBuilder = new StringBuilder();
            var delimiter = ", ";

            //INSERT INTO ... VALUES (VertexID = ...,
            stringBuilder.Append(String.Concat(S_INSERT.ToUpperString(),
                                                " ",
                                                S_INTO.ToUpperString(),
                                                " ",
                                                myVertexType.Name,
                                                " ",
                                                S_VALUES.ToUpperString(),
                                                " ",
                                                S_BRACKET_LEFT));

            stringBuilder.Append(String.Concat(S_UUID, " = ", myVertex.VertexID.ToString(), delimiter));

            #region standard attributes (creationDate, ...)

            string standardProperties = CreateGraphDMLforVertexStandardProperties(myVertex);

            stringBuilder.Append(standardProperties);

            #endregion

            #region properties (age, list<String>, ...)

            string defAttrsDML = CreateGraphDMLforDefinedProperties(myVertex.GetAllProperties(),
                                                                    myPropertyDefinitions);

            stringBuilder.Append(defAttrsDML);

            #endregion

            #region unstructured data

            string unstrProperties = CreateGraphDMLforVertexUnstructuredProperties(
                                        myVertex.GetAllUnstructuredProperties(),
                                        myPropertyDefinitions);

            stringBuilder.Append(unstrProperties);

            #endregion

            #region outgoing edges

            #region singleEdge

            string outgoingSingleEdges = CreateGraphDMLforVertexOutgoingSingleEdges(
                                            myVertexType,
                                            myVertex.GetAllOutgoingSingleEdges(),
                                            myVertexType.GetOutgoingEdgeDefinitions(true)
                                                .ToDictionary(key => key.ID, value => value));

            stringBuilder.Append(outgoingSingleEdges);

            #endregion

            #region hyperEdge

            string outgoingHyperEdges = CreateGraphDMLforVertexOutgoingHyperEdges
                                        (myVertexType,
                                        myVertex.GetAllOutgoingHyperEdges(),
                                        myVertexType.GetOutgoingEdgeDefinitions(true)
                                            .ToDictionary(key => key.ID, value => value));

            stringBuilder.Append(outgoingHyperEdges);

            #endregion

            #endregion

            if (stringBuilder.ToString().EndsWith(delimiter))
                stringBuilder.RemoveSuffix(delimiter);

            stringBuilder.Append(S_BRACKET_RIGHT);

            return stringBuilder.ToString();
        }
Пример #2
0
        /// <summary>
        /// This will add all attributes of <paramref name="myDBObject"/> to the 
        /// <paramref name="myAttributes"/> reference. Reference attributes will be resolved to the <paramref name="myDepth"/>
        /// </summary>
        private void AddAttributesByDBO(
            SecurityToken mySecurityToken,
            Int64 myTransactionToken,
            ref Tuple<IDictionary<String, Object>, IDictionary<String, IEdgeView>> myAttributes,
            IVertexType myType,
            IVertex myDBObject,
            Int64 myDepth,
            EdgeList myEdgeList,
            String myReference,
            Boolean myUsingGraph,
            TypesOfSelect mySelType,
            Int64? myTypeID = null)
        {

            #region Get all attributes which are stored at the DBO

            #region properties

            foreach (var aProperty in myType.GetPropertyDefinitions(true))
            {
                var tempResult = aProperty.GetValue(myDBObject);

                if (tempResult != null)
                {
                    myAttributes.Item1.Add(aProperty.Name, tempResult);
                }
            }

            #endregion

            #region unstructured data

            foreach (var aUnstructuredProperty in myDBObject.GetAllUnstructuredProperties())
            {
                myAttributes.Item1.Add(aUnstructuredProperty.PropertyName, aUnstructuredProperty.Property);
            }

            #endregion

            #region outgoing edges

            foreach (var outgoingEdgeDefinition in myType.GetOutgoingEdgeDefinitions(true))
            {
                if (myDBObject.HasOutgoingEdge(outgoingEdgeDefinition.ID))
                {
                    // Since we can define special depth (via setting) for attributes we need to check them now
                    myDepth = GetDepth(-1, myDepth, myType, outgoingEdgeDefinition);
                    if ((myDepth > 0))
                    {
                        myAttributes.Item2.Add(
                            outgoingEdgeDefinition.Name,
                            ResolveAttributeValue(
                                outgoingEdgeDefinition,
                                myDBObject.GetOutgoingEdge(outgoingEdgeDefinition.ID),
                                myDepth,
                                myEdgeList,
                                myDBObject,
                                myReference,
                                myUsingGraph,
                                mySecurityToken,
                                myTransactionToken));
                    }
                    else
                    {
                        myAttributes.Item2.Add(outgoingEdgeDefinition.Name, 
                                                GetNotResolvedReferenceEdgeAttributeValue(myDBObject
                                                                                            .GetOutgoingEdge(outgoingEdgeDefinition.ID)
                                                                                            .GetTargetVertices()));
                    }
                }
            }

            #endregion

            #region incoming

            foreach (var aIncomingEdgeDefinition in myType.GetIncomingEdgeDefinitions(true))
            {
                if (myDBObject.HasIncomingVertices(aIncomingEdgeDefinition
                                                    .RelatedEdgeDefinition
                                                    .RelatedType.ID, 
                                                   aIncomingEdgeDefinition
                                                    .RelatedEdgeDefinition.ID))
                {
                    if (myDepth > 0)
                    {
                        myAttributes.Item2.Add(
                            aIncomingEdgeDefinition.Name,
                            ResolveIncomingEdgeValue(
                                aIncomingEdgeDefinition,
                                myDBObject.GetIncomingVertices(aIncomingEdgeDefinition
                                                                .RelatedEdgeDefinition
                                                                .RelatedType
                                                                .ID, 
                                                               aIncomingEdgeDefinition
                                                                .RelatedEdgeDefinition.ID),
                                myDepth,
                                myEdgeList,
                                myDBObject,
                                myReference,
                                myUsingGraph,
                                mySecurityToken,
                                myTransactionToken));
                    }
                    else
                    {
                        myAttributes.Item2.Add(aIncomingEdgeDefinition.Name, 
                                                GetNotResolvedReferenceEdgeAttributeValue(myDBObject.GetIncomingVertices(aIncomingEdgeDefinition
                                                                                                                            .RelatedEdgeDefinition
                                                                                                                            .RelatedType.ID, 
                                                                                                                          aIncomingEdgeDefinition
                                                                                                                            .RelatedEdgeDefinition.ID)));
                    }
                }
            }

            #endregion

            #endregion
        }
Пример #3
0
 public IEnumerable <UnstructuredPropertyContainer> GetAllUnstructuredProperties(
     PropertyHyperGraphFilter.GraphElementUnStructuredPropertyFilter myFilter)
 {
     return(_Vertex.GetAllUnstructuredProperties(myFilter));
 }
Пример #4
0
 public IEnumerable <Tuple <string, object> > GetAllUnstructuredProperties(
     PropertyHyperGraphFilter.GraphElementUnStructuredPropertyFilter myFilter)
 {
     return(_Vertex.GetAllUnstructuredProperties(myFilter));
 }