diff options
Diffstat (limited to 'test/uk/ac/ox/cs/data/RemoveDataPropertyRange.java')
| -rw-r--r-- | test/uk/ac/ox/cs/data/RemoveDataPropertyRange.java | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/test/uk/ac/ox/cs/data/RemoveDataPropertyRange.java b/test/uk/ac/ox/cs/data/RemoveDataPropertyRange.java deleted file mode 100644 index acaa91b..0000000 --- a/test/uk/ac/ox/cs/data/RemoveDataPropertyRange.java +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.data; | ||
| 2 | |||
| 3 | import java.io.File; | ||
| 4 | import java.io.FileOutputStream; | ||
| 5 | import java.io.IOException; | ||
| 6 | |||
| 7 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 8 | import org.semanticweb.owlapi.model.OWLAxiom; | ||
| 9 | import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom; | ||
| 10 | import org.semanticweb.owlapi.model.OWLException; | ||
| 11 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 12 | import org.semanticweb.owlapi.model.OWLOntologyManager; | ||
| 13 | |||
| 14 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 15 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 16 | |||
| 17 | public class RemoveDataPropertyRange { | ||
| 18 | |||
| 19 | public static void process(String file) throws OWLException, IOException { | ||
| 20 | OWLOntologyManager originalManager = OWLManager.createOWLOntologyManager(); | ||
| 21 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 22 | |||
| 23 | OWLOntology originalOntology = originalManager.loadOntologyFromOntologyDocument(new File(file)); | ||
| 24 | OWLOntology ontology = manager.createOntology(originalOntology.getOntologyID().getOntologyIRI()); | ||
| 25 | |||
| 26 | for (OWLOntology onto: originalOntology.getImportsClosure()) | ||
| 27 | for (OWLAxiom axiom: onto.getAxioms()) { | ||
| 28 | if (!(axiom instanceof OWLDataPropertyRangeAxiom)) | ||
| 29 | manager.addAxiom(ontology, axiom); | ||
| 30 | } | ||
| 31 | originalManager.removeOntology(originalOntology); | ||
| 32 | |||
| 33 | String extension = file.substring(file.lastIndexOf(".")); | ||
| 34 | String fileName = file.substring(file.lastIndexOf(Utility.FILE_SEPARATOR) + 1); | ||
| 35 | String dest = fileName.replace(extension, "-noDPR.owl"); | ||
| 36 | manager.saveOntology(ontology, new FileOutputStream(dest)); | ||
| 37 | System.out.println("The processed ontology is saved in " + dest + " successfully."); | ||
| 38 | manager.removeOntology(ontology); | ||
| 39 | } | ||
| 40 | |||
| 41 | public static void main(String[] args) { | ||
| 42 | try { | ||
| 43 | process(PagodaTester.chembl_tbox); | ||
| 44 | } catch (OWLException e) { | ||
| 45 | e.printStackTrace(); | ||
| 46 | } catch (IOException e) { | ||
| 47 | e.printStackTrace(); | ||
| 48 | } | ||
| 49 | |||
| 50 | } | ||
| 51 | |||
| 52 | } | ||
