diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-05-10 18:17:06 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-05-11 12:34:47 +0100 |
| commit | 17bd9beaf7f358a44e5bf36a5855fe6727d506dc (patch) | |
| tree | 47e9310a0cff869d9ec017dcb2c81876407782c8 /src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java | |
| parent | 8651164cd632a5db310b457ce32d4fbc97bdc41c (diff) | |
| download | ACQuA-17bd9beaf7f358a44e5bf36a5855fe6727d506dc.tar.gz ACQuA-17bd9beaf7f358a44e5bf36a5855fe6727d506dc.zip | |
[pagoda] Move project to Scala
This commit includes a few changes:
- The repository still uses Maven to manage dependency but it is now a
Scala project.
- The code has been ported from OWLAPI 3.4.10 to 5.1.20
- A proof of concept program using both RSAComb and PAGOdA has been
added.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java b/src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java deleted file mode 100644 index 81b8a01..0000000 --- a/src/uk/ac/ox/cs/pagoda/rules/EqualityAxiomatiser.java +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.rules; | ||
| 2 | |||
| 3 | import java.io.BufferedWriter; | ||
| 4 | import java.io.FileOutputStream; | ||
| 5 | import java.io.IOException; | ||
| 6 | import java.io.OutputStreamWriter; | ||
| 7 | |||
| 8 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 9 | import org.semanticweb.owlapi.model.OWLClass; | ||
| 10 | import org.semanticweb.owlapi.model.OWLObjectProperty; | ||
| 11 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 12 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 13 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 14 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 15 | |||
| 16 | public class EqualityAxiomatiser { | ||
| 17 | |||
| 18 | OWLOntology ontology; | ||
| 19 | |||
| 20 | public EqualityAxiomatiser(String fileName) { | ||
| 21 | ontology = OWLHelper.loadOntology(OWLManager.createOWLOntologyManager(), fileName); | ||
| 22 | } | ||
| 23 | |||
| 24 | public EqualityAxiomatiser(OWLOntology ontology) { | ||
| 25 | this.ontology = ontology; | ||
| 26 | } | ||
| 27 | |||
| 28 | public static void main(String[] args) throws IOException { | ||
| 29 | if (args.length == 0) { | ||
| 30 | args = new String[1]; | ||
| 31 | args[0] = "../uobmGenerator/ontologies/2rl/univ-bench-dl-TBox.owl"; | ||
| 32 | } | ||
| 33 | |||
| 34 | EqualityAxiomatiser axiomatiser; | ||
| 35 | for (String fileName: args) { | ||
| 36 | axiomatiser = new EqualityAxiomatiser(fileName); | ||
| 37 | String outputFileName = fileName.replace(".owl", "-axiomatised.rule"); | ||
| 38 | BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFileName))); | ||
| 39 | writer.write(axiomatiser.getRuleTexts()); | ||
| 40 | writer.close(); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | public String getRuleTexts() { | ||
| 45 | StringBuffer buf = new StringBuffer(); | ||
| 46 | // buf.append(reflexivity()).append(Utility.LINE_SEPARATOR); | ||
| 47 | buf.append(symmetry()).append(Utility.LINE_SEPARATOR); | ||
| 48 | buf.append(transitivity()).append(Utility.LINE_SEPARATOR); | ||
| 49 | |||
| 50 | for (OWLObjectProperty p: ontology.getObjectPropertiesInSignature(true)) | ||
| 51 | buf.append(addingEqualities4Properties(OWLHelper.addAngles(p.getIRI().toString()))).append(Utility.LINE_SEPARATOR); | ||
| 52 | |||
| 53 | for (OWLClass c: ontology.getClassesInSignature(true)) | ||
| 54 | buf.append(addingEqualities4Class(OWLHelper.addAngles(c.getIRI().toString()))).append(Utility.LINE_SEPARATOR); | ||
| 55 | |||
| 56 | return buf.toString(); | ||
| 57 | } | ||
| 58 | |||
| 59 | private static String transitivity() { | ||
| 60 | StringBuffer buffer = new StringBuffer(); | ||
| 61 | buffer.append(Namespace.EQUALITY_QUOTED).append("(?Y0,?Y2) :- ").append(Namespace.EQUALITY_QUOTED ).append("(?Y0,?Y1), ").append(Namespace.EQUALITY_QUOTED ).append("(?Y1,?Y2) ."); | ||
| 62 | return buffer.toString(); | ||
| 63 | } | ||
| 64 | |||
| 65 | private static String symmetry() { | ||
| 66 | StringBuffer buffer = new StringBuffer(); | ||
| 67 | buffer.append(Namespace.EQUALITY_QUOTED ).append("(?Y1,?Y0) :- ").append(Namespace.EQUALITY_QUOTED ).append("(?Y0,?Y1) ."); | ||
| 68 | return buffer.toString(); | ||
| 69 | } | ||
| 70 | |||
| 71 | @SuppressWarnings("unused") | ||
| 72 | private static String reflexivity() { | ||
| 73 | StringBuffer buffer = new StringBuffer(); | ||
| 74 | buffer.append(Namespace.EQUALITY_QUOTED ).append("(?Y0,?Y0) :- ."); | ||
| 75 | return buffer.toString(); | ||
| 76 | } | ||
| 77 | |||
| 78 | private static String addingEqualities4Properties(String property) { | ||
| 79 | StringBuffer buffer = new StringBuffer(); | ||
| 80 | buffer.append(property).append("(?Y2,?Y1) :- ").append(property).append("(?Y0,?Y1), ").append(Namespace.EQUALITY_QUOTED ).append("(?Y0,?Y2) .\n"); | ||
| 81 | buffer.append(property).append("(?Y0,?Y2) :- ").append(property).append("(?Y0,?Y1), ").append(Namespace.EQUALITY_QUOTED ).append("(?Y1,?Y2) ."); | ||
| 82 | return buffer.toString(); | ||
| 83 | } | ||
| 84 | |||
| 85 | private static String addingEqualities4Class(String clazz) { | ||
| 86 | StringBuffer buffer = new StringBuffer(); | ||
| 87 | buffer.append(clazz).append("(?Y1) :- ").append(clazz).append("(?Y0), ").append(Namespace.EQUALITY_QUOTED ).append("(?Y0,?Y1) ."); | ||
| 88 | return buffer.toString(); | ||
| 89 | } | ||
| 90 | |||
| 91 | } | ||
