Skip to content

Commit

Permalink
Added three more methods
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed May 24, 2014
1 parent 59e7fd7 commit bf8b9cc
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Expand Up @@ -11,6 +11,7 @@
package net.bioclipse.owlapi.business;

import java.io.IOException;
import java.util.List;

import net.bioclipse.core.PublishedClass;
import net.bioclipse.core.PublishedMethod;
Expand Down Expand Up @@ -55,4 +56,28 @@ public OWLOntology load(String target, IRIMapper iriMapper)
public String listMappings(IRIMapper mapper)
throws IOException, BioclipseException, CoreException;

@Recorded
@PublishedMethod(
params = "OWLOntology ontology",
methodSummary = "Checks for OWL DL profile violations."
)
public String checkVioloations(OWLOntology ontology)
throws IOException, BioclipseException, CoreException;

@Recorded
@PublishedMethod(
params = "OWLOntology ontology",
methodSummary = "Shows the (non-asserted) OWL classes."
)
public String showClasses(OWLOntology ontology)
throws IOException, BioclipseException, CoreException;

@Recorded
@PublishedMethod(
params = "OWLOntology ontology",
methodSummary = "Lists the imported ontologies."
)
public List<OWLOntology> getImportedOntologies(OWLOntology ontology)
throws IOException, BioclipseException, CoreException;

}
Expand Up @@ -10,6 +10,8 @@
package net.bioclipse.owlapi.business;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import net.bioclipse.business.BioclipsePlatformManager;
Expand All @@ -22,9 +24,13 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.profiles.OWL2DLProfile;
import org.semanticweb.owlapi.profiles.OWLProfileReport;
import org.semanticweb.owlapi.profiles.OWLProfileViolation;
import org.semanticweb.owlapi.util.SimpleIRIMapper;

public class OWLAPIManager implements IBioclipseManager {
Expand Down Expand Up @@ -94,4 +100,38 @@ public String listMappings(IRIMapper mapper, IProgressMonitor monitor)
return list.toString();
}

public String checkVioloations(OWLOntology ontology, IProgressMonitor monitor)
throws IOException, BioclipseException, CoreException {
if (monitor == null) monitor = new NullProgressMonitor();

StringBuffer list = new StringBuffer();
OWL2DLProfile profile = new OWL2DLProfile();
OWLProfileReport report = profile.checkOntology(ontology);
for(OWLProfileViolation v:report.getViolations()) {
list.append(v).append('\n');
}
return list.toString();
}

public String showClasses(OWLOntology ontology, IProgressMonitor monitor)
throws IOException, BioclipseException, CoreException {
if (monitor == null) monitor = new NullProgressMonitor();

StringBuffer list = new StringBuffer();
for (OWLClass cls : ontology.getClassesInSignature()) {
list.append(cls.toString()).append('\n');
}
return list.toString();
}

public List<OWLOntology> getImportedOntologies(OWLOntology ontology, IProgressMonitor monitor)
throws IOException, BioclipseException, CoreException {
if (monitor == null) monitor = new NullProgressMonitor();

List<OWLOntology> list = new ArrayList<>();
for (OWLOntology importedOntology : ontology.getImports()) {
list.add(importedOntology);
}
return list;
}
}

0 comments on commit bf8b9cc

Please sign in to comment.