//todo: if issue with data, don't just hang visualiser
        private async Task <IEnumerable <IQuery <object?> > > BuildVisualisationCommands(
            string contentItemId,
            IContentItemVersion contentItemVersion)
        {
            ContentItem?contentItem = await contentItemVersion.GetContentItem(_contentManager, contentItemId);

            if (contentItem == null)
            {
                return(Enumerable.Empty <IQuery <INodeAndOutRelationshipsAndTheirInRelationships> >());
            }
            //todo: best to not use dynamic
            dynamic?graphSyncPartContent = contentItem.Content[nameof(GraphSyncPart)];

            _syncNameProvider.ContentType = contentItem.ContentType;

            string?sourceNodeId = _syncNameProvider.GetNodeIdPropertyValue(graphSyncPartContent, contentItemVersion);
            IEnumerable <string> sourceNodeLabels = await _syncNameProvider.NodeLabels();

            string sourceNodeIdPropertyName = _syncNameProvider.IdPropertyName();

            var rootContext = await _describeContentItemHelper.BuildRelationships(
                contentItem, sourceNodeIdPropertyName, sourceNodeId, sourceNodeLabels, _syncNameProvider,
                _contentManager, contentItemVersion, null, _serviceProvider);

            //todo: return relationships - can we do it without creating cypher outside of a query?

            if (rootContext == null)
            {
                return(Enumerable.Empty <IQuery <object?> >());
            }

            //todo: should create relationships in here
            return(await _describeContentItemHelper.GetRelationshipCommands(rootContext));
        }
コード例 #2
0
        //todo: if issue with data, don't just hang visualiser
        private async Task <IEnumerable <IQuery <object?> > > BuildVisualisationCommands(
            string contentItemId,
            IContentItemVersion contentItemVersion)
        {
            ContentItem?contentItem = await contentItemVersion.GetContentItem(_contentManager, contentItemId);

            if (contentItem == null)
            {
                return(Enumerable.Empty <IQuery <INodeAndOutRelationshipsAndTheirInRelationships> >());
            }
            //todo: best to not use dynamic
            dynamic?graphSyncPartContent = contentItem.Content[nameof(GraphSyncPart)];

            _syncNameProvider.ContentType = contentItem.ContentType;

            string?sourceNodeId = _syncNameProvider.GetNodeIdPropertyValue(graphSyncPartContent, contentItemVersion);
            IEnumerable <string> sourceNodeLabels = await _syncNameProvider.NodeLabels();

            string sourceNodeIdPropertyName = _syncNameProvider.IdPropertyName();

            var rootContext = await _describeContentItemHelper.BuildRelationships(
                contentItem, sourceNodeIdPropertyName, sourceNodeId, sourceNodeLabels, _syncNameProvider,
                _contentManager, contentItemVersion, null, _serviceProvider);

            //todo: return relationships - can we do it without creating cypher outside of a query?
            //todo: current depth is always 0, so deep nodes like PersonalityQuestionSet returns masses of data
            //todo: depth cut-off is done after build relationships, so does more work than is necessary
            //var relationships = new List<ContentItemRelationship>();

            if (rootContext == null)
            {
                return(Enumerable.Empty <IQuery <object?> >());
            }

            //todo: should create relationships in here
            return(await _describeContentItemHelper.GetRelationshipCommands(rootContext));
        }