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

now also import external ontologies

parent e66bcb65
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import org.semanticweb.owlapi.profiles.OWL2DLProfile;
import org.semanticweb.owlapi.profiles.OWLProfileReport;
import org.semanticweb.owlapi.profiles.OWLProfileViolation;
import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
import org.semanticweb.owlapi.util.PriorityCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -52,8 +53,9 @@ public class CheckOWLProfile extends JobRunner {
		final OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();

		OWLParserFactory jenaModelParserFactory = new JenaModelOntologyParserFactory(dataset);
		Set<OWLParserFactory> ontologyParsers = Collections.singleton(jenaModelParserFactory);
		ontologyManager.setOntologyParsers(ontologyParsers);
		PriorityCollection<OWLParserFactory> ontologyParsers = ontologyManager.getOntologyParsers();
		ontologyParsers.add(jenaModelParserFactory);
//		ontologyManager.setOntologyParsers(ontologyParsers);

		final Supplier<OWLOntologyManager> m = () -> ontologyManager;
		final OWLOntology ontology;
+4 −4
Original line number Diff line number Diff line
@@ -196,10 +196,10 @@ public class ReadExamples extends JobRunner {
				String uri = s.asResource().getURI();
				if(uri.equals(version.getRepository().getNamespace())) {
					found = true;
				} else {
					if(!uri.matches("^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$")) {
						logger.error("Only SAREF ontologies with specific versions shall be imported. Their URIs conform to the regular expression `^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$`");
					}
//				} else {
//					if(!uri.matches("^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$")) {
//						logger.error("Only SAREF ontologies with specific versions shall be imported. Their URIs conform to the regular expression `^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$`");
//					}
				}
			}
			if(!found) {
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class JenaModelOntologyParser extends AbstractOWLParser {
                		consumer.handleTriple(s2, p2, object, language);
            		} else if ( dt != null) {
            			IRI dt2 = IRI.create(dt);
                		consumer.handleTriple(s2, p2, object, language);
                		consumer.handleTriple(s2, p2, object, dt2);
            		} else {
            			consumer.handleTriple(s2, p2, object);
            		}