Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-17 Update all dependencies in pom.xml #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
<dependency>
<groupId>com.github.ansell.aterms</groupId>
<artifactId>aterm-java</artifactId>
<version>1.8.2</version>
<version>1.8.2-p1</version>
</dependency>

<!-- saxon-he -->
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-6</version>
<version>9.8.0-14</version>
</dependency>

<!-- jgrapht (jdk 1.5) -->
<!-- jgrapht -->
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-jdk1.5</artifactId>
<version>0.7.3</version>
<artifactId>jgrapht-core</artifactId>
<version>1.2.0</version>
</dependency>

<!-- pellet -->
Expand Down Expand Up @@ -63,14 +63,14 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>3.5.0</version>
<version>5.1.7</version>
</dependency>

<!-- servlets -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>

Expand All @@ -83,16 +83,20 @@

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint</arg>
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.12.v20180830</version>
<configuration>
<stopPort>9966</stopPort>
<stopKey>foo</stopKey>
Expand All @@ -106,6 +110,9 @@
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<supportedPackagings>
<supportedPackaging>jar</supportedPackaging>
</supportedPackagings>
</configuration>
</plugin>

Expand Down
31 changes: 17 additions & 14 deletions src/main/java/it/essepuntato/lode/LodeServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<OWLOntology> setOfImportedOntologies = new HashSet<OWLOntology>();
Expand All @@ -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) {
Expand All @@ -258,6 +260,7 @@ private String parseWithOWLAPI(URL ontologyURL, boolean useOWLAPI, boolean consi
return result;
}

@SuppressWarnings("unused")
private String addImportedAxioms(String result, List<String> removed) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Expand Down Expand Up @@ -361,22 +364,22 @@ private OWLOntology parseWithReasoner(OWLOntologyManager manager, OWLOntology on

Map<OWLEntity, Set<OWLAnnotationAssertionAxiom>> entityAnnotations = new HashMap<OWLEntity, Set<OWLAnnotationAssertionAxiom>>();
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);
Expand Down