Skip to content

Commit

Permalink
PR #73: fixing the problems which caused test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Jul 7, 2021
1 parent 2a7dc24 commit 7524e8d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,6 @@ public void handleEmptyFragment(JsonBranch collection) {
}
}

/*
private boolean isCollectionSkippable(
List<String> skippableIds,
JsonBranch collection,
int i,
JsonPathCache cache,
Object jsonFragment)
{
var skippable = false;
JsonBranch identifierPath = collection.getIdentifier();
if (!skippableIds.isEmpty() && identifierPath != null) {
String address = String.format("%s/%d/%s",
collection.getJsonPath(), i, identifierPath.getJsonPath());
List<T> values = cache.get(address, identifierPath.getJsonPath(), jsonFragment);
String id = (skippedEntryChecker != null)
? skippedEntryChecker.extractId(values.get(0))
: values.get(0).getValue();
skippable = skippableIds.contains(id);
}
return skippable;
}
*/

public void evaluateJsonBranch(JsonBranch jsonBranch,
PathCache cache,
CompletenessCounter completenessCounter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.gwdg.metadataqa.api.model.Category;
import de.gwdg.metadataqa.api.schema.Schema;
import de.gwdg.metadataqa.api.json.FieldGroup;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -74,12 +75,14 @@ private void initialize() {
public static List<String> getHeaders(Schema schema) {
List<String> headers = new ArrayList<>();
headers.add(TOTAL);
for (String category : schema.getCategories()) {

for (String category : schema.getCategories())
headers.add(category);
}
for (FieldGroup group: schema.getFieldGroups()) {
headers.add(group.getCategory());
}

for (FieldGroup group: schema.getFieldGroups())
if (!headers.contains(group.getCategory()))
headers.add(group.getCategory());

return headers;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/gwdg/metadataqa/api/json/FieldGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public FieldGroup(Category pCategory, String... pFields) {
this.category = pCategory.toString();
this.fields = Arrays.asList(pFields);
}

/**
* Get the list of field names.
* @return
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/de/gwdg/metadataqa/api/util/SchemaFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,10 @@ public static Schema fromConfig(SchemaConfiguration config) {
schema.addField(branch);
}

for (Group group : config.getGroups()) {
FieldGroup fieldgroup = new FieldGroup(
group.getCategories().get(0),
group.getFields());

schema.addFieldGroup(fieldgroup);
}
if (config.getGroups() != null)
for (Group group : config.getGroups())
for (String category : group.getCategories())
schema.addFieldGroup(new FieldGroup(category, group.getFields()));

if (config.getNamespaces() != null)
schema.setNamespaces(config.getNamespaces());
Expand Down

0 comments on commit 7524e8d

Please sign in to comment.