Add a check to drop StatPop nodes#677
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Code Review
This pull request introduces a check to ignore StatisticalPopulation nodes during pipeline processing. It adds a helper method isStatisticalPopulation in GraphUtils and the corresponding constant in Vocabulary. Feedback suggests simplifying the isStatisticalPopulation method by removing redundant namespace stripping, as getPropertyValues already handles this, allowing for a direct contains check.
| public static boolean isStatisticalPopulation(PropertyValues pvs) { | ||
| List<String> types = getPropertyValues(pvs.getPvsMap(), Property.typeOf.name()); | ||
| for (String type : types) { | ||
| if (McfUtil.stripNamespace(type).equals(Vocabulary.STATISTICAL_POPULATION_TYPE)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } |
There was a problem hiding this comment.
The helper method getPropertyValues already strips namespaces from the returned values (using McfUtil.stripNamespace). Therefore, calling McfUtil.stripNamespace(type) again inside the loop is redundant. We can simplify this method by directly checking if the returned list contains Vocabulary.STATISTICAL_POPULATION_TYPE.
public static boolean isStatisticalPopulation(PropertyValues pvs) {
return getPropertyValues(pvs.getPvsMap(), Property.typeOf.name())
.contains(Vocabulary.STATISTICAL_POPULATION_TYPE);
}
No description provided.