public SemanticRules build(ApplicationPackage applicationPackage) {
            var ruleFiles = applicationPackage.getFiles(ApplicationPackage.RULES_DIR, "sr");
            var rules = new SemanticRules(ruleFiles.stream().map(this::toRuleBaseConfigView).toList());

            // Create config to make sure rules are valid, config is validated in call to toMap() below
            var builder = new SemanticRulesConfig.Builder();
            rules.getConfig(builder);
            SemanticRulesConfig config = builder.build();
            try {
                toMap(config);  // validates config
                ensureZeroOrOneDefaultRule(config);
            } catch (ParseException e) {
                throw new IllegalArgumentException(e);
            }
            return rules;
        }
Builds the semantic rules for an application package and validates them
config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRules.java