Exemplo n.º 1
0
        public void FindNodeIdsByRelationshipType(Guid nodeId, ref HashSet <Guid> relatedMapsNodeList, Guid ignoreNodeId, Guid descriptorTypeId, params Guid[] relationshipTypes)
        {
            if (DescriptorsByNode.ContainsKey(nodeId))
            {
                Dictionary <Guid, List <QueryMapDescriptor> > descriptorsByType = DescriptorsByNode[nodeId];

                foreach (List <QueryMapDescriptor> descriptorList in descriptorsByType.Values)
                {
                    foreach (QueryMapDescriptor descriptor in descriptorList)
                    {
                        if (Relationships.ContainsKey(descriptor.RelationshipUid.Value))
                        {
                            QueryMapRelationship relationship = Relationships[descriptor.RelationshipUid.Value];

                            foreach (Guid relationshipType in relationshipTypes)
                            {
                                if (relationship.RelationshipTypeUid == relationshipType)
                                {
                                    var descriptors = DescriptorsByRelationship[relationship.RelationshipUid][descriptorTypeId];

                                    foreach (QueryMapDescriptor opposingDescriptor in descriptors)
                                    {
                                        if (opposingDescriptor.NodeUid.Value != null && (ignoreNodeId == Guid.Empty || opposingDescriptor.NodeUid != ignoreNodeId))
                                        {
                                            relatedMapsNodeList.Add(opposingDescriptor.NodeUid.Value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public IEnumerable <QueryMapRelationship> GetRelationshipsByRelationshipType(Guid nodeId, params Guid[] relationshipTypes)
        {
            if (DescriptorsByNode.ContainsKey(nodeId))
            {
                Dictionary <Guid, List <QueryMapDescriptor> > descriptorsByType = DescriptorsByNode[nodeId];

                foreach (List <QueryMapDescriptor> descriptorList in descriptorsByType.Values)
                {
                    foreach (QueryMapDescriptor descriptor in descriptorList)
                    {
                        if (Relationships.ContainsKey(descriptor.RelationshipUid.Value))
                        {
                            QueryMapRelationship relationship = Relationships[descriptor.RelationshipUid.Value];

                            foreach (Guid relationshipType in relationshipTypes)
                            {
                                if (relationship.RelationshipTypeUid == relationshipType)
                                {
                                    yield return(relationship);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void AddDescriptorByNode(QueryMapDescriptor descriptor)
        {
            if (descriptor.NodeUid.HasValue && descriptor.DescriptorTypeUid.HasValue)
            {
                Dictionary <Guid, List <QueryMapDescriptor> > descriptorsForNodeByDescriptorType;

                if (DescriptorsByNode.ContainsKey(descriptor.NodeUid.Value))
                {
                    descriptorsForNodeByDescriptorType = DescriptorsByNode[descriptor.NodeUid.Value];
                }
                else
                {
                    descriptorsForNodeByDescriptorType          = new Dictionary <Guid, List <QueryMapDescriptor> >();
                    DescriptorsByNode[descriptor.NodeUid.Value] = descriptorsForNodeByDescriptorType;
                }

                List <QueryMapDescriptor> descriptorsForNode;

                if (descriptorsForNodeByDescriptorType.ContainsKey(descriptor.DescriptorTypeUid.Value))
                {
                    descriptorsForNode = descriptorsForNodeByDescriptorType[descriptor.DescriptorTypeUid.Value];
                }
                else
                {
                    descriptorsForNode = new List <QueryMapDescriptor>();
                    descriptorsForNodeByDescriptorType[descriptor.DescriptorTypeUid.Value] = descriptorsForNode;
                }

                descriptorsForNode.Add(descriptor);
            }
        }
Exemplo n.º 4
0
 public IEnumerable <QueryMapRelationship> GetRelationshipsByDescriptorType(Guid nodeId, Guid descriptorType)
 {
     if (DescriptorsByNode.ContainsKey(nodeId))
     {
         if (DescriptorsByNode[nodeId].ContainsKey(descriptorType))
         {
             foreach (var descriptor in DescriptorsByNode[nodeId][descriptorType])
             {
                 if (Relationships.ContainsKey(descriptor.RelationshipUid.Value))
                 {
                     yield return(Relationships[descriptor.RelationshipUid.Value]);
                 }
             }
         }
     }
 }