From d40ff777a26f437947d54565b64535802c070cae Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Fri, 14 Sep 2018 09:43:16 -0700 Subject: [PATCH] ISSUE-17 Update all dependencies in pom.xml --- pom.xml | 31 ++++++++++++------- .../java/it/essepuntato/lode/LodeServlet.java | 31 ++++++++++--------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 45a89be..c31916b 100644 --- a/pom.xml +++ b/pom.xml @@ -15,21 +15,21 @@ com.github.ansell.aterms aterm-java - 1.8.2 + 1.8.2-p1 net.sf.saxon Saxon-HE - 9.5.1-6 + 9.8.0-14 - + org.jgrapht - jgrapht-jdk1.5 - 0.7.3 + jgrapht-core + 1.2.0 @@ -63,14 +63,14 @@ net.sourceforge.owlapi owlapi-distribution - 3.5.0 + 5.1.7 javax.servlet servlet-api - 2.5 + 3.0-alpha-1 provided @@ -83,16 +83,20 @@ maven-compiler-plugin - 3.1 + 3.8.0 - 1.7 - 1.7 + 1.8 + 1.8 + + -Xlint + - org.mortbay.jetty - jetty-maven-plugin + org.eclipse.jetty + jetty-maven-plugin + 9.4.12.v20180830 9966 foo @@ -106,6 +110,9 @@ 60000 + + jar + diff --git a/src/main/java/it/essepuntato/lode/LodeServlet.java b/src/main/java/it/essepuntato/lode/LodeServlet.java index a8baddd..d700bcd 100644 --- a/src/main/java/it/essepuntato/lode/LodeServlet.java +++ b/src/main/java/it/essepuntato/lode/LodeServlet.java @@ -52,11 +52,13 @@ import org.mindswap.pellet.PelletOptions; import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.io.IRIDocumentSource; import org.semanticweb.owlapi.io.RDFXMLOntologyFormat; import org.semanticweb.owlapi.io.StringDocumentTarget; import org.semanticweb.owlapi.model.AddImport; import org.semanticweb.owlapi.model.AddOntologyAnnotation; import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.MissingImportHandlingStrategy; import org.semanticweb.owlapi.model.OWLAnnotation; import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; import org.semanticweb.owlapi.model.OWLAnnotationProperty; @@ -71,6 +73,7 @@ import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyID; +import org.semanticweb.owlapi.model.OWLOntologyLoaderConfiguration; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.model.OWLOntologyStorageException; import org.semanticweb.owlapi.util.InferredAxiomGenerator; @@ -132,10 +135,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t String content = ""; - boolean useOWLAPI = new Boolean(request.getParameter("owlapi")); - boolean considerImportedOntologies = new Boolean(request.getParameter("imported")); - boolean considerImportedClosure = new Boolean(request.getParameter("closure")); - boolean useReasoner = new Boolean(request.getParameter("reasoner")); + boolean useOWLAPI = Boolean.valueOf(request.getParameter("owlapi")); + boolean considerImportedOntologies = Boolean.valueOf(request.getParameter("imported")); + boolean considerImportedClosure = Boolean.valueOf(request.getParameter("closure")); + boolean useReasoner = Boolean.valueOf(request.getParameter("reasoner")); if (considerImportedOntologies || considerImportedClosure || useReasoner) { useOWLAPI = true; @@ -226,9 +229,8 @@ private String parseWithOWLAPI(URL ontologyURL, boolean useOWLAPI, boolean consi if (useOWLAPI) { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - + OWLOntologyLoaderConfiguration loadingConfig = new OWLOntologyLoaderConfiguration(); OWLOntology ontology = null; - if (considerImportedClosure || considerImportedOntologies) { ontology = manager.loadOntology(IRI.create(ontologyURL.toString())); Set setOfImportedOntologies = new HashSet(); @@ -241,8 +243,8 @@ private String parseWithOWLAPI(URL ontologyURL, boolean useOWLAPI, boolean consi manager.addAxioms(ontology, importedOntology.getAxioms()); } } else { - manager.setSilentMissingImportsHandling(true); - ontology = manager.loadOntology(IRI.create(ontologyURL.toString())); + loadingConfig = loadingConfig.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT); + ontology = manager.loadOntologyFromOntologyDocument(new IRIDocumentSource(IRI.create(ontologyURL.toString())), loadingConfig); } if (useReasoner) { @@ -258,6 +260,7 @@ private String parseWithOWLAPI(URL ontologyURL, boolean useOWLAPI, boolean consi return result; } + @SuppressWarnings("unused") private String addImportedAxioms(String result, List removed) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); @@ -361,22 +364,22 @@ private OWLOntology parseWithReasoner(OWLOntologyManager manager, OWLOntology on Map> entityAnnotations = new HashMap>(); for (OWLClass aEntity : ontology.getClassesInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } for (OWLObjectProperty aEntity : ontology.getObjectPropertiesInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } for (OWLDataProperty aEntity : ontology.getDataPropertiesInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } for (OWLNamedIndividual aEntity : ontology.getIndividualsInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } for (OWLAnnotationProperty aEntity : ontology.getAnnotationPropertiesInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } for (OWLDatatype aEntity : ontology.getDatatypesInSignature()) { - entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology)); + entityAnnotations.put(aEntity, ontology.getAnnotationAssertionAxioms(aEntity.getIRI())); } manager.removeOntology(ontology);