softvis-research/Getaviz

Metadata.json replacement with Neo4j

Closed this issue · 4 comments

I'm on the way to replace the metdata.json file, used by controllers with the information from Neo4j and am interested in where and how can we access this information?

grafik

Are we saving this kind of information, like "accesses", "belongsTo" or do I have to make cypher queries each time to get this information for a new element?

  • something to start with -> how to get only parent packages, even if they are empty and don't contain anything?

grafik

Have a look at the org.getaviz.generator.jqa.JQA2JSON from generator2. This class generates metaData.json, you can see all queries that are executed there. We don't store the properties like belongsTo etc in the graph. Most of the information is already available from the graph constructed by jQAssistant, but has a different name. So CONTAINS relationship between packages is equal to belongsTo etc. You have to execute a query anyway. If it's a query to get a node attribute (like belongsTo) or a relationship (like CONTAINS) does not really make a difference.

how to get only parent packages, even if they are empty and don't contain anything?

What are parent packages? If they are empty, how can they be parent of anything?

Just hoped that I missed something and we do have this information stored somewhere :(

What are parent packages? If they are empty, how can they be parent of anything?

My bad. I've meant "first level" package/s. In the example above it would be just "com".

One more question - do I understand it right, that basically I have to migrate JQA2JSON logic to frontend? (Because there is little more going on than just reading the query, namely adding specific parameters to the element, which will be added afterwards). I assume that it makes sense to create a new controller for this task, right?

The query would be something like this:

MATCH (p:Package) WHERE NOT (:Package)-[:CONTAINS]->(p) RETURN p

Not tested, but should give you all packages without an incoming CONTAINS relationship

One more question - do I understand it right, that basically I have to migrate JQA2JSON logic to
frontend?

Yes

I assume that it makes sense to create a new controller for this task, right?

Gues this depends on how you do this. You could query all information one time at the beginning (basically the same behavior as now, but using the database instead of the json file). Or you could do this at runtime and only query the information that is currently needed. In the first case you don't need a controller from my point of view, just replace/update model.js

Query should be even easier, since all first level packages should have a common parent from type System or model or something like this