Commit 06b9e527 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

updated prefix checking as per TS v0.2.1

parent f0703de7
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -66,17 +66,14 @@ public class ReadOntology extends JobRunner {

	static final Map<String, String> PREFIXES = new HashMap<String, String>();
	static {
		PREFIXES.put("owl", "http://www.w3.org/2002/07/owl#");
		PREFIXES.put("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
		PREFIXES.put("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
		PREFIXES.put("owl", "http://www.w3.org/2002/07/owl#");
		PREFIXES.put("xsd", "http://www.w3.org/2001/XMLSchema#");
		PREFIXES.put("dcterms", "http://purl.org/dc/terms/");
		PREFIXES.put("vann", "http://purl.org/vocab/vann/");
		PREFIXES.put("schema", "http://schema.org/");
		PREFIXES.put("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
		PREFIXES.put("voaf", "http://purl.org/vocommons/voaf#");
		PREFIXES.put("dce", "http://purl.org/dc/elements/1.1/");
		PREFIXES.put("dct", "http://purl.org/dc/terms/");
		PREFIXES.put("xml", "http://www.w3.org/XML/1998/namespace/");
		PREFIXES.put("saref", "https://saref.etsi.org/core/");
	}

@@ -128,7 +125,7 @@ public class ReadOntology extends JobRunner {
		for (String s : PREFIXES.keySet()) {
			if (prefixes.containsKey(s)) {
				if (!prefixes.get(s).equals(PREFIXES.get(s))) {
					logger.warn(String.format(
					logger.error(String.format(
							"Prefix `%s:` in the ontology file is expected to be equal to `<%s>`. Got: `<%s>`", s,
							PREFIXES.get(s), prefixes.get(s)));
				}
@@ -139,7 +136,7 @@ public class ReadOntology extends JobRunner {
			String l = entry.getValue();
			if (l.contains("saref")) {
				if (!l.matches(Constants.REGEX_ONTO_SERIES_URI)) {
					logger.warn(String.format(
					logger.error(String.format(
							"Prefix `%s:` in the ontology file contains string \"saref\", but does not seem to match the official SAREF ontologies namespaces: `\\\\%s\\\\`. Got: `<%s>`",
							s, Constants.REGEX_ONTO_SERIES_URI, l));
				}