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/summary/EstimatedFeatureComparator.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/summary/EstimatedFeatureComparator.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/summary/EstimatedFeatureComparator.java | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/summary/EstimatedFeatureComparator.java b/src/uk/ac/ox/cs/pagoda/summary/EstimatedFeatureComparator.java deleted file mode 100644 index 59fdf7f..0000000 --- a/src/uk/ac/ox/cs/pagoda/summary/EstimatedFeatureComparator.java +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.summary; | ||
| 2 | |||
| 3 | import java.util.Comparator; | ||
| 4 | import java.util.HashMap; | ||
| 5 | import java.util.HashSet; | ||
| 6 | import java.util.Map; | ||
| 7 | |||
| 8 | public class EstimatedFeatureComparator implements Comparator<Node> { | ||
| 9 | |||
| 10 | Graph graph; | ||
| 11 | Map<Node, EstimatedFeature> node2features = new HashMap<Node, EstimatedFeature>(); | ||
| 12 | |||
| 13 | public EstimatedFeatureComparator(Graph graph) { | ||
| 14 | this.graph = graph; | ||
| 15 | EstimatedFeature feature; | ||
| 16 | for (Node node: graph.getNodes()) { | ||
| 17 | feature = new EstimatedFeature(graph, node); | ||
| 18 | node2features.put(node, feature); | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | @Override | ||
| 23 | public int compare(Node o1, Node o2) { | ||
| 24 | EstimatedFeature f1 = node2features.get(o1), f2 = node2features.get(o2); | ||
| 25 | int result; | ||
| 26 | if ((result = o1.getLabel().compareTo(o2.getLabel())) != 0) return result; | ||
| 27 | if ((result = f1.outGoingNodeCount - f2.outGoingNodeCount) != 0) return result; | ||
| 28 | if ((result = f1.inComingNodeCount - f2.inComingNodeCount) != 0) return result; | ||
| 29 | if ((result = Edge.compareLabels(graph.getOutGoingEdges(o1), graph.getOutGoingEdges(o2))) != 0) return result; | ||
| 30 | result = Edge.compareLabels(graph.getInComingEdges(o1), graph.getInComingEdges(o2)); | ||
| 31 | return result; | ||
| 32 | } | ||
| 33 | |||
| 34 | } | ||
| 35 | |||
| 36 | class EstimatedFeature { | ||
| 37 | |||
| 38 | int outGoingNodeCount, inComingNodeCount; | ||
| 39 | |||
| 40 | public EstimatedFeature(Graph graph, Node node) { | ||
| 41 | HashSet<String> neighbours = new HashSet<String>(); | ||
| 42 | for (Edge edge: graph.getOutGoingEdges(node)) | ||
| 43 | neighbours.add(edge.getToNodeName()); | ||
| 44 | outGoingNodeCount = neighbours.size(); | ||
| 45 | |||
| 46 | neighbours.clear(); | ||
| 47 | for (Edge edge: graph.getInComingEdges(node)) | ||
| 48 | neighbours.add(edge.getFromNodeName()); | ||
| 49 | inComingNodeCount = neighbours.size(); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
