diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-29 18:35:51 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-29 18:35:51 +0100 |
| commit | 4b7253559c290b6fdd1c4122830f153fda85dd62 (patch) | |
| tree | 37c1487e4682be719dec532ca3d7e1af353fb9a1 /src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java | |
| parent | 6a559a415b3bdb3048021839e5bcf5bbf5aa4bbd (diff) | |
| download | ACQuA-4b7253559c290b6fdd1c4122830f153fda85dd62.tar.gz ACQuA-4b7253559c290b6fdd1c4122830f153fda85dd62.zip | |
Disposable.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java | 116 |
1 files changed, 63 insertions, 53 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java b/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java index 1f7148c..29e74c2 100644 --- a/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java +++ b/src/uk/ac/ox/cs/pagoda/rules/DatalogProgram.java | |||
| @@ -1,64 +1,74 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.rules; | 1 | 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; | ||
| 5 | import uk.ac.ox.cs.pagoda.constraints.PredicateDependency; | ||
| 6 | import uk.ac.ox.cs.pagoda.constraints.UpperUnaryBottom; | ||
| 7 | import uk.ac.ox.cs.pagoda.util.disposable.Disposable; | ||
| 8 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; | ||
| 4 | 9 | ||
| 5 | import uk.ac.ox.cs.pagoda.constraints.*; | 10 | public class DatalogProgram extends Disposable { |
| 6 | 11 | ||
| 7 | public class DatalogProgram { | 12 | UpperDatalogProgram upperProgram = new UpperDatalogProgram(); |
| 13 | LowerDatalogProgram lowerProgram; | ||
| 14 | GeneralProgram program = new GeneralProgram(); | ||
| 8 | 15 | ||
| 9 | UpperDatalogProgram upperProgram = new UpperDatalogProgram(); | 16 | BottomStrategy upperBottom; |
| 10 | LowerDatalogProgram lowerProgram; | ||
| 11 | GeneralProgram program = new GeneralProgram(); | ||
| 12 | |||
| 13 | BottomStrategy upperBottom; | ||
| 14 | |||
| 15 | public DatalogProgram(OWLOntology o) { | ||
| 16 | lowerProgram = new LowerDatalogProgram(); | ||
| 17 | init(o, false); | ||
| 18 | } | ||
| 19 | |||
| 20 | public DatalogProgram(OWLOntology o, boolean toClassify) { | ||
| 21 | lowerProgram = new LowerDatalogProgram(toClassify); | ||
| 22 | init(o, toClassify); | ||
| 23 | } | ||
| 24 | 17 | ||
| 25 | private void init(OWLOntology o, boolean forSemFacet) { | 18 | public DatalogProgram(OWLOntology o) { |
| 26 | upperProgram.load(o, upperBottom = new UpperUnaryBottom()); | 19 | lowerProgram = new LowerDatalogProgram(); |
| 27 | // upperProgram.load(o, upperBottom = new UnaryBottom()); | 20 | init(o, false); |
| 28 | lowerProgram.clone(upperProgram); | 21 | } |
| 29 | program.clone(upperProgram); | 22 | |
| 30 | // program.botStrategy = new UnaryBottom(); | 23 | public DatalogProgram(OWLOntology o, boolean toClassify) { |
| 31 | 24 | lowerProgram = new LowerDatalogProgram(toClassify); | |
| 32 | upperProgram.transform(); | 25 | init(o, toClassify); |
| 33 | lowerProgram.transform(); | 26 | } |
| 34 | program.transform(); | 27 | |
| 35 | 28 | public LowerDatalogProgram getLower() { | |
| 36 | program.buildDependencyGraph(); | 29 | if(isDisposed()) throw new DisposedException(); |
| 37 | PredicateDependency graph = upperProgram.buildDependencyGraph(); | 30 | return lowerProgram; |
| 38 | lowerProgram.dependencyGraph = graph; | 31 | } |
| 39 | } | 32 | |
| 33 | public UpperDatalogProgram getUpper() { | ||
| 34 | if(isDisposed()) throw new DisposedException(); | ||
| 35 | return upperProgram; | ||
| 36 | } | ||
| 37 | |||
| 38 | public GeneralProgram getGeneral() { | ||
| 39 | if(isDisposed()) throw new DisposedException(); | ||
| 40 | return program; | ||
| 41 | } | ||
| 40 | 42 | ||
| 41 | public LowerDatalogProgram getLower() { | 43 | public String getAdditionalDataFile() { |
| 42 | return lowerProgram; | 44 | if(isDisposed()) throw new DisposedException(); |
| 43 | } | 45 | return upperProgram.getAdditionalDataFile(); |
| 44 | 46 | } | |
| 45 | public UpperDatalogProgram getUpper() { | 47 | |
| 46 | return upperProgram; | 48 | public BottomStrategy getUpperBottomStrategy() { |
| 47 | } | 49 | if(isDisposed()) throw new DisposedException(); |
| 48 | 50 | return upperBottom; | |
| 49 | public GeneralProgram getGeneral() { | 51 | } |
| 50 | return program; | 52 | |
| 51 | } | 53 | @Override |
| 52 | 54 | public void dispose() { | |
| 53 | public String getAdditionalDataFile() { | 55 | super.dispose(); |
| 54 | return upperProgram.getAdditionalDataFile(); | 56 | if(upperProgram != null) upperProgram.deleteABoxTurtleFile(); |
| 55 | } | 57 | } |
| 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(); | ||
| 56 | 65 | ||
| 57 | public BottomStrategy getUpperBottomStrategy() { | 66 | upperProgram.transform(); |
| 58 | return upperBottom; | 67 | lowerProgram.transform(); |
| 59 | } | 68 | program.transform(); |
| 60 | 69 | ||
| 61 | public void deleteABoxTurtleFile() { | 70 | program.buildDependencyGraph(); |
| 62 | if (upperProgram != null) upperProgram.deleteABoxTurtleFile(); | 71 | PredicateDependency graph = upperProgram.buildDependencyGraph(); |
| 63 | } | 72 | lowerProgram.dependencyGraph = graph; |
| 73 | } | ||
| 64 | } | 74 | } |
