Skip to content

Commit f094b3e

Browse files
committed
fix by adding segment to rules.
1 parent bb48e2c commit f094b3e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

com.kdmanalytics.toif.ccr/src/com/kdmanalytics/toif/ccr/CoverageClaimGenerator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,18 @@ static Repository getRepositoryFromArguments(String[] args)
129129
* @param objFactory
130130
* @param segment
131131
* @param repository
132+
* @param segment
132133
* @return
133134
*/
134-
private static Collection<? extends Rule> getRules(ObjectFactory objFactory, Value cwe, Repository repository)
135+
private static Collection<? extends Rule> getRules(ObjectFactory objFactory, Value cwe, Repository repository, Value segment)
135136
{
136137
HashMap<String, Rule> ruleSet = new HashMap<String, CWECoverageClaimType.Claims.Claim.RuleSet.Rule>();
137138
RepositoryConnection con = null;
138139
try
139140
{
140141
con = getRepositoryConnection(repository);
141142

142-
String adaptorQuery = "SELECT ?descriptionText WHERE {" + "?finding <http://toif/toif:FindingHasCWEIdentifier> <" + cwe + "> . "
143+
String adaptorQuery = "SELECT ?descriptionText WHERE {<"+segment+"> <http://toif/contains> ?finding. ?finding <http://toif/toif:FindingHasCWEIdentifier> <" + cwe + "> . "
143144
+ "?finding <http://toif/toif:FindingIsDescribedByWeaknessDescription> ?description . "
144145
+ "?description <http://toif/description> ?descriptionText . }";
145146

@@ -348,7 +349,7 @@ private Collection<Claim> createClaims(ObjectFactory objFactory, Value segment,
348349

349350
Claim claim = claims.get(cweIdString);
350351
RuleSet ruleSet = objFactory.createCWECoverageClaimTypeClaimsClaimRuleSet();
351-
ruleSet.getRule().addAll(getRules(objFactory, cwe, repository));
352+
ruleSet.getRule().addAll(getRules(objFactory, cwe, repository,segment));
352353
claim.setRuleSet(ruleSet);
353354

354355
}

0 commit comments

Comments
 (0)