SkillsFundingAgency / dfc-servicetaxonomy-editor

MIT License
5 stars 5 forks source link

Can we use this for own content types ? #440

Open giannik opened 3 years ago

giannik commented 3 years ago

hello. Started investigation graph databases with this project . I created my own content type, added the content part Graph sync, picked one of the available settings in the part, but when publish i get an error "database preview cannot be found" . Is there a setting I have to set to point it to a database called preview in neo4j? Because i created a database called preview in neo4j but still same error. Thanks.

lazcool commented 3 years ago

Yes, your appsettings needs to match the name of the preview database you've created.

So for example, if you're using the default database for the published graph, and you've created a preview graph called preview (using create database preview; in Neo's browser), then the Neo4j config in your appsettings would look something like this...

    "Neo4j": {
        "Endpoints": [
            {
                "Name": "desktop_enterprise",
                "Uri": "bolt://localhost:7687",
                "Username": "neo4j",
                "Password": "",
                "Enabled": true
            }
        ],
        "ReplicaSets": [
            {
                "ReplicaSetName": "published",
                "GraphInstances": [
                    {
                        "Endpoint": "desktop_enterprise",
                        "GraphName": "neo4j",
                        "DefaultGraph": true,
                        "Enabled": true
                    }
                ]
            },
            {
                "ReplicaSetName": "preview",
                "GraphInstances": [
                    {
                        "Endpoint": "desktop_enterprise",
                        "GraphName": "preview",
                        "DefaultGraph": false,
                        "Enabled": true
                    }
                ]
            }
        ]
    },

The name of the preview graph is picked up from the "GraphName": "preview" setting.

giannik commented 3 years ago

Thank you , managed to get my first content item into the graph database.

Time to start diving in.

One thing i noticed is that when i publish the content item from the admin it does not show up in the content items list in admin. Is this intended behaviour ? I have a content type called "Person" with 3 parts (Title, autoroute, htmlbody, graphsync). For graphsyn part i picked the "NCS" setting. Then published a new content item. I saw it inside the graphdb but was available in the contentitems list.

lazcool commented 3 years ago

The item should appear in the content items list. All existing functionality should basically be unchanged.

I'd guess there was an issue and you didn't see the error notification due to a bug that's now fixed in master.

If you have PublishEvents set to true in your appsettings, that would cause the publish to be cancelled and the item not to appear in the contents list. When items are published, saved etc., events can be published to Azure event grid, which I assume you don't need. You can check the logs to see if that's the issue.

You should also be able to use the default custom settings for the graph sync part, which might be more suitable for you. Sensible defaults are provided, it's just that you don't currently see what they are on the settings page.

giannik commented 3 years ago

Cool. I set PublishEvents to false and its showing now in content items list. One other question. Is it possible to re-create the graph on-demand , like for example from a backgroud job at night ? So I could disable the node creation when content item is published but then on demand re-create the graph it at will.

Like the lucene indexes for search which has a rebuild index button from the admin.

Thanks Giannis

lazcool commented 3 years ago

Yes, in the admin menu there's an option to validate and repair all items in the graph (or just recently modified items). If no items are in the graph, they should be created.

image

There's also a Sync Validation workflow that repairs all items in the graph, that by default runs at 1am each night.

There's a caveat that currently, if you're recreating the whole graph, the repair process might have to be run more than once (it needs to better handle content picker relationship dependencies).

giannik commented 3 years ago

Hmm, good to know, thanks. I guess that i could easily add a setting in the graph sync part to disable graph sync in real time. Just for performance reasons to not interfere with content item creation . Then on demand create the graph with all content items, as you described. Starting to like the whole graph db stuff.

giannik commented 3 years ago

Once I get the hang of things Im thinking of creating a cypher query provider in orchard to query items from the graph and display them in the UI.

lazcool commented 3 years ago

Glad to know you're getting on well with the graph db stuff.

We already have a Cypher query runner, except it's bit-rotted. The feature is in the Cypher category (we'll move it to the Graph category with the other features). I suspect it's an easy fix to get it running again.

image

We also have a graph visualiser to view content items (& also content types).

giannik commented 3 years ago

Thats great. How do i see the contentypes graph visualizer. Only coud find the content item visualizer.

giannik commented 3 years ago

One use case I would like to investigate is see all my content parts and query which content types are using a specific content part.

lazcool commented 3 years ago

The content types graph visualisation is currently hard-coded to show a particular set of content types. We need to make it work for all content types. (It's called Visualise Ontology...)

image