Commit 18f688ca authored by Maxime Lefrançois's avatar Maxime Lefrançois

false error in ex: namespace when default version

parent a9c6a004
......@@ -34,7 +34,10 @@ import fr.emse.gitlab.saref.SAREFPipelineException;
import fr.emse.gitlab.saref.entities.SAREFExample;
import fr.emse.gitlab.saref.entities.SAREFExtension;
import fr.emse.gitlab.saref.entities.SAREFProject;
import fr.emse.gitlab.saref.entities.SAREFVersion;
import fr.emse.gitlab.saref.entities.SAREFVersionName;
import fr.emse.gitlab.saref.managers.RepositoryManager;
import fr.emse.gitlab.saref.vocabs.SHACL;
/**
* Checks TS 103 673 Clause 9.6.2: Prefixes declaration
......@@ -102,8 +105,18 @@ public class Clause_9_6_2_Checker extends AbstractClauseChecker {
}
String exNamespace = prefixes.get(EX_PREFIX);
if (exNamespace != null && !exNamespace.equals(example.getNamespace())) {
logError(getMessage(MESSAGE.namespace, example.getNamespace(), exNamespace));
if (exNamespace != null) {
if(!versionName.equals(SAREFVersionName.DEFAULT)) {
if(!exNamespace.equals(example.getNamespace())) {
logError(getMessage(MESSAGE.namespace, example.getNamespace(), exNamespace));
}
} else {
String regex = "^" + example.getNamespace().replace(versionName.toString(), SAREFVersionName.REGEX_VERSION_NUMBER) + "$";
if(!Pattern.matches(regex, exNamespace)) {
String ver = example.getNamespace().replace(versionName.toString(), "<<some version>>");
logError(getMessage(MESSAGE.namespace, ver, exNamespace));
}
}
}
// how to check MESSAGE.BASE ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment