• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pkiraly / metadata-qa-marc / #1527

22 Aug 2025 02:21PM UTC coverage: 90.345%. Remained the same
#1527

push

pkiraly
Improve timeline handling

5191 of 6416 new or added lines in 219 files covered. (80.91%)

886 existing lines in 78 files now uncovered.

36717 of 40641 relevant lines covered (90.34%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/src/main/java/de/gwdg/metadataqa/marc/cli/utils/ShaclUtils.java
1
package de.gwdg.metadataqa.marc.cli.utils;
2

3
import de.gwdg.metadataqa.api.configuration.ConfigurationReader;
4
import de.gwdg.metadataqa.api.configuration.SchemaConfiguration;
5
import de.gwdg.metadataqa.api.configuration.schema.Rule;
6
import de.gwdg.metadataqa.api.json.DataElement;
7
import de.gwdg.metadataqa.api.rule.RuleCatalog;
8
import de.gwdg.metadataqa.marc.cli.Shacl4bib;
9
import de.gwdg.metadataqa.marc.cli.parameters.Shacl4bibParameters;
10

11
import java.io.IOException;
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.logging.Logger;
15

NEW
16
public class ShaclUtils  {
×
17
  private static final Logger logger = Logger.getLogger(Shacl4bib.class.getCanonicalName());
1✔
18

19
  /**
20
   * Reads the schema from file
21
   * @param parameters
22
   * @return
23
   * @param <T>
24
   */
25
  public static <T extends Shacl4bibParameters> SchemaConfiguration setupSchema(String shaclConfigurationFile) {
26
    SchemaConfiguration schema = null;
1✔
27
    // String shaclConfigurationFile = parameters.getShaclConfigurationFile();
28
    try {
29
      if (shaclConfigurationFile.endsWith(".json"))
1✔
30
        schema = ConfigurationReader.readSchemaJson(shaclConfigurationFile);
1✔
31
      else
32
        schema = ConfigurationReader.readSchemaYaml(shaclConfigurationFile);
1✔
NEW
33
    } catch (IOException exception) {
×
NEW
34
      logger.severe("Error when the SHACL schema is initialized. " + exception.getLocalizedMessage());
×
NEW
35
      System.exit(0);
×
36
    }
1✔
37
    return schema;
1✔
38
  }
39

40
  /**
41
   * Instantiates a RuleCatalogue
42
   * @param schema
43
   * @param parameters
44
   * @return
45
   * @param <T>
46
   */
47
  public static <T extends Shacl4bibParameters> RuleCatalog setupRuleCatalog(
48
      SchemaConfiguration schema,
49
      T parameters) {
50
    return new RuleCatalog(schema.asSchema())
1✔
51
      .setOnlyIdInHeader(true)
1✔
52
      .setOutputType(parameters.getShaclOutputType());
1✔
53
  }
54

55
  public static Map<String, String> createRulePathMap(SchemaConfiguration schema) {
56
    Map<String, String> rulePathMap = new HashMap<>();
1✔
57
    for (DataElement dataElement : schema.asSchema().getPaths()) {
1✔
58
      for (Rule rule : dataElement.getRules()) {
1✔
59
        if (rule.getId() != null) {
1✔
60
          rulePathMap.put(rule.getId(), dataElement.getPath());
1✔
61
        }
62
      }
1✔
63
    }
1✔
64
    return rulePathMap;
1✔
65
  }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc