Search code examples
jqassistant

What node properties must exist for a clean graphml name in jQassistant


What properties must a node have, so that it's name is displayed in the graphml. grafic?

I create some node based on my packages with

MATCH (artifact:Artifact)
WHERE
   artifact.type <> "test-jar"
MATCH
  (artifact:Artifact)-[:CONTAINS]->(root:Package{fqn:"net.sf.sze.dao.api"})-[:CONTAINS]->(slice:Package)
WITH COLLECT(slice) AS rows1
MATCH
  (artifact:Artifact)-[:CONTAINS]->(root:Package{fqn:"net.sf.sze.frontend"})-[:CONTAINS]->(slice:Package)
WITH rows1 + COLLECT(slice) AS rows2
MATCH
  (artifact:Artifact)-[:CONTAINS]->(root:Package{fqn:"net.sf.sze.service"})-[:CONTAINS *2..2]->(slice:Package)
WITH rows2 + COLLECT(slice) AS rows3
UNWIND rows3 AS slice
MERGE (sn:Slice{name:slice.name})
MERGE (sn)-[:SLICE_CONTAINS]-> (slice)
RETURN
  sn

and try to create a graphml diagram with

MATCH
  (slice1:Slice)-[:SLICE_CONTAINS]->()-[:CONTAINS*]->(t1:Type),
  (slice2:Slice)-[:SLICE_CONTAINS]->()-[:CONTAINS*]->(t2:Type),
  (t1)-[d:DEPENDS_ON]->(t2)
WHERE
   slice1 <> slice2
WITH
  slice1, slice2, count(d) as weight
RETURN
  slice1 as Slice1, slice2 as Slice2, {
    role :     "relationship",
    type :     "DEPENDS_ON",
    startNode: slice1,
    endNode:   slice2,
    properties: {
      weight: weight
    }
  } as Dependency

The graph is created well expect the node names. I only get as Label CompositeObject, id = 123456 which makes the diagram useless.

Can anyone give me a hint, whats wrong?


Solution

  • For types defined by the jQAssistant scanner there are type specific rules what will be rendered as a label, e.g. "fqn" for ":Artifact" labeled nodes.

    You're creating a virtual relationship where the type cannot be determined thus no property can be shown. jQAssistant 1.3.0 will support a property "label" to control this, e.g.

      ....
    RETURN
      slice1 as Slice1, slice2 as Slice2, {
        role :     "relationship",
        type :     "DEPENDS_ON",
        startNode: slice1,
        endNode:   slice2,
        label: weight, // set an explicit label
        properties: {
          weight: weight
        }
     } as Dependency