Example #1
0
        public static HashSet <IIdentifiable> GetExternalReferences([NotNull] AssetPropertyGraphDefinition propertyGraphDefinition, [NotNull] IGraphNode root)
        {
            var visitor = new ExternalReferenceCollector(propertyGraphDefinition);

            visitor.Visit(root);
            // An IIdentifiable can have been recorded both as internal and external reference. In this case we still want to clone it so let's remove it from external references
            visitor.externalReferences.ExceptWith(visitor.internalReferences);
            return(visitor.externalReferences);
        }
Example #2
0
        /// <summary>
        /// Computes the external references to the given root node and their accessors.
        /// </summary>
        /// <param name="propertyGraphDefinition">The property graph definition to use to analyze the graph.</param>
        /// <param name="root">The root node to analyze.</param>
        /// <returns>A set containing all external references to identifiable objects.</returns>
        public static Dictionary <IIdentifiable, List <NodeAccessor> > GetExternalReferenceAccessors([NotNull] AssetPropertyGraphDefinition propertyGraphDefinition, [NotNull] IGraphNode root)
        {
            var visitor = new ExternalReferenceCollector(propertyGraphDefinition);

            visitor.Visit(root);
            // An IIdentifiable can have been recorded both as internal and external reference. In this case we still want to clone it so let's remove it from external references
            foreach (var internalReference in visitor.internalReferences)
            {
                visitor.externalReferenceAccessors.Remove(internalReference);
            }
            return(visitor.externalReferenceAccessors);
        }