diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java b/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java index 29e74c2..e2a171d 100644 --- a/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java +++ b/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java | |||
| @@ -2,11 +2,12 @@ package uk.ac.ox.cs.pagoda.rules; | |||
| 2 | 2 | ||
| 3 | import org.semanticweb.owlapi.model.OWLOntology; | 3 | import org.semanticweb.owlapi.model.OWLOntology; |
| 4 | import uk.ac.ox.cs.pagoda.constraints.BottomStrategy; | 4 | import uk.ac.ox.cs.pagoda.constraints.BottomStrategy; |
| 5 | import uk.ac.ox.cs.pagoda.constraints.PredicateDependency; | ||
| 6 | import uk.ac.ox.cs.pagoda.constraints.UpperUnaryBottom; | 5 | import uk.ac.ox.cs.pagoda.constraints.UpperUnaryBottom; |
| 7 | import uk.ac.ox.cs.pagoda.util.disposable.Disposable; | 6 | import uk.ac.ox.cs.pagoda.util.disposable.Disposable; |
| 8 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; | 7 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; |
| 9 | 8 | ||
| 9 | import java.io.InputStream; | ||
| 10 | |||
| 10 | public class DatalogProgram extends Disposable { | 11 | public class DatalogProgram extends Disposable { |
| 11 | 12 | ||
| 12 | UpperDatalogProgram upperProgram = new UpperDatalogProgram(); | 13 | UpperDatalogProgram upperProgram = new UpperDatalogProgram(); |
| @@ -15,14 +16,36 @@ public class DatalogProgram extends Disposable { | |||
| 15 | 16 | ||
| 16 | BottomStrategy upperBottom; | 17 | BottomStrategy upperBottom; |
| 17 | 18 | ||
| 18 | public DatalogProgram(OWLOntology o) { | 19 | public DatalogProgram(InputStream inputStream) { |
| 19 | lowerProgram = new LowerDatalogProgram(); | 20 | lowerProgram = new LowerDatalogProgram(); |
| 20 | init(o, false); | 21 | |
| 22 | upperProgram.load(inputStream, upperBottom = new UpperUnaryBottom()); | ||
| 23 | lowerProgram.clone(upperProgram); | ||
| 24 | program.clone(upperProgram); | ||
| 25 | |||
| 26 | upperProgram.transform(); | ||
| 27 | lowerProgram.transform(); | ||
| 28 | program.transform(); | ||
| 29 | |||
| 30 | program.buildDependencyGraph(); | ||
| 31 | lowerProgram.dependencyGraph = upperProgram.buildDependencyGraph(); | ||
| 21 | } | 32 | } |
| 22 | 33 | ||
| 23 | public DatalogProgram(OWLOntology o, boolean toClassify) { | 34 | public DatalogProgram(OWLOntology o) { |
| 24 | lowerProgram = new LowerDatalogProgram(toClassify); | 35 | lowerProgram = new LowerDatalogProgram(); |
| 25 | init(o, toClassify); | 36 | |
| 37 | upperProgram.load(o, upperBottom = new UpperUnaryBottom()); | ||
| 38 | // upperProgram.load(o, upperBottom = new UnaryBottom()); | ||
| 39 | lowerProgram.clone(upperProgram); | ||
| 40 | program.clone(upperProgram); | ||
| 41 | // program.botStrategy = new UnaryBottom(); | ||
| 42 | |||
| 43 | upperProgram.transform(); | ||
| 44 | lowerProgram.transform(); | ||
| 45 | program.transform(); | ||
| 46 | |||
| 47 | program.buildDependencyGraph(); | ||
| 48 | lowerProgram.dependencyGraph = upperProgram.buildDependencyGraph(); | ||
| 26 | } | 49 | } |
| 27 | 50 | ||
| 28 | public LowerDatalogProgram getLower() { | 51 | public LowerDatalogProgram getLower() { |
| @@ -55,20 +78,4 @@ public class DatalogProgram extends Disposable { | |||
| 55 | super.dispose(); | 78 | super.dispose(); |
| 56 | if(upperProgram != null) upperProgram.deleteABoxTurtleFile(); | 79 | if(upperProgram != null) upperProgram.deleteABoxTurtleFile(); |
| 57 | } | 80 | } |
| 58 | |||
| 59 | private void init(OWLOntology o, boolean forSemFacet) { | ||
| 60 | upperProgram.load(o, upperBottom = new UpperUnaryBottom()); | ||
| 61 | // upperProgram.load(o, upperBottom = new UnaryBottom()); | ||
| 62 | lowerProgram.clone(upperProgram); | ||
| 63 | program.clone(upperProgram); | ||
| 64 | // program.botStrategy = new UnaryBottom(); | ||
| 65 | |||
| 66 | upperProgram.transform(); | ||
| 67 | lowerProgram.transform(); | ||
| 68 | program.transform(); | ||
| 69 | |||
| 70 | program.buildDependencyGraph(); | ||
| 71 | PredicateDependency graph = upperProgram.buildDependencyGraph(); | ||
| 72 | lowerProgram.dependencyGraph = graph; | ||
| 73 | } | ||
| 74 | } | 81 | } |
