jqassistant

How to use JQAssistant internal node labels in custom concept


I currently have a look into JQAssistant and how I can utilize it in my projects.

One thing, I want to do, is to use it to verify ADRs. Therefore, I want to check, if there are any JQA Constraints available for a given ADR.

I planned to use the internal JQA node labels JQAssistant, Rule and Constraint for it and wrote the following concept, which creates a relation :ENSURED_BY between a ADR and a JQA Constraint having the same ID.

<concept id="adr:matchingConstraint">
        <requiresConcept refId="adr:document"/>
        <description>Links ADRs with JQL Constraints which ensure the ADR</description>
        <cypher><![CDATA[
            match (a:Adr)
            match (c:Constraint) where c.id STARTS WITH a.adrId
            merge (a)-[r:ENSURED_BY]->(c)
            return a.adrId as adr, c.id, type(r)
        ]]></cypher>
    </concept>

The Cypher Query it self works fine. But as soon as I want to apply the concept, I get the following error:

[WARNING] --[ Concept Application Failure ]----------------------------------
[WARNING] Concept: adr:matchingConstraint
[WARNING] Severity: MINOR
[WARNING] Number of rows: 0
[WARNING] 
[WARNING] Links ADRs with JQL Constraints which ensure the ADR
[WARNING] -------------------------------------------------------------------
[WARNING] 

Problem seems to be, that the JQA related node labels are not yet set, when this concept is applied. When I run analyze a second time, the concept gets applied with no errors.

I want to use <requiresConcept /> to ensure the execution order, but I was not able to find, which concept creates the JQA labels.

Does anybody know, how I can wait for those labels? A work around would be to create my own concept and labels based on the XML plugin but since JQA already provides this, I think the better solution would be to use those.


Solution

  • The nodes representing executed rules (e.g. labeled with :jQAssistant:Concept) are created right after executing each according rule. The intented purpose is to track the result status and enable skipping rules for a subsequent analyze.

    So the safest way for your use case indeed is to run a second analyze, as otherwise it would be difficult to ensure that the concept above is executed as the last rule.