aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-10 18:17:06 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-11 12:34:47 +0100
commit17bd9beaf7f358a44e5bf36a5855fe6727d506dc (patch)
tree47e9310a0cff869d9ec017dcb2c81876407782c8 /src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java
parent8651164cd632a5db310b457ce32d4fbc97bdc41c (diff)
downloadACQuA-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/constraints/UnaryBottom.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java b/src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java
deleted file mode 100644
index 5339c50..0000000
--- a/src/uk/ac/ox/cs/pagoda/constraints/UnaryBottom.java
+++ /dev/null
@@ -1,67 +0,0 @@
1package uk.ac.ox.cs.pagoda.constraints;
2
3import java.util.Collection;
4import java.util.HashSet;
5import java.util.LinkedList;
6import java.util.Set;
7
8import org.semanticweb.HermiT.model.Atom;
9import org.semanticweb.HermiT.model.AtomicConcept;
10import org.semanticweb.HermiT.model.DLClause;
11import org.semanticweb.HermiT.model.Individual;
12import org.semanticweb.HermiT.model.Term;
13import org.semanticweb.HermiT.model.Variable;
14
15public class UnaryBottom implements BottomStrategy {
16
17 @Override
18 public Collection<DLClause> process(Collection<DLClause> clauses) {
19 Collection<DLClause> ret = new LinkedList<DLClause>();
20 for (DLClause clause: clauses)
21 if (clause.getHeadLength() == 0) {
22 ret.add(DLClause.create(getEmptyHead(pickRepresentative(clause.getBodyAtoms())), clause.getBodyAtoms()));
23 }
24 else
25 ret.add(clause);
26 return ret;
27 }
28
29 protected Term pickRepresentative(Atom[] atoms) {
30 Term rep = null;
31 Set<Variable> vars = new HashSet<Variable>();
32 for (Atom atom: atoms) {
33 atom.getVariables(vars);
34 for (Variable v: vars)
35 if (rep == null || ((Variable) rep).getName().compareTo(v.getName()) > 0)
36 rep = v;
37 vars.clear();
38 }
39 if (rep != null) return rep;
40
41 Set<Individual> inds = new HashSet<Individual>();
42 for (Atom atom: atoms) {
43 atom.getIndividuals(inds);
44 for (Individual i: inds)
45 if (rep == null || ((Individual) rep).getIRI().compareTo(i.getIRI()) > 0)
46 rep = i;
47 inds.clear();
48 }
49
50 return rep;
51 }
52
53 @Override
54 public boolean isBottomRule(DLClause clause) {
55 return clause.getHeadLength() == 1 && clause.getHeadAtom(0).getDLPredicate().equals(AtomicConcept.NOTHING);
56 }
57
58 public Atom[] getEmptyHead(Term t) {
59 return new Atom[] {Atom.create(AtomicConcept.NOTHING, t)};
60 }
61
62 @Override
63 public int getBottomNumber() {
64 return 1;
65 }
66
67}