aboutsummaryrefslogtreecommitdiff
path: root/test/uk/ac/ox/cs/pagoda/endomorph
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 /test/uk/ac/ox/cs/pagoda/endomorph
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 'test/uk/ac/ox/cs/pagoda/endomorph')
-rw-r--r--test/uk/ac/ox/cs/pagoda/endomorph/DependencyGraphTest.java60
1 files changed, 0 insertions, 60 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/endomorph/DependencyGraphTest.java b/test/uk/ac/ox/cs/pagoda/endomorph/DependencyGraphTest.java
deleted file mode 100644
index a4579a3..0000000
--- a/test/uk/ac/ox/cs/pagoda/endomorph/DependencyGraphTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
1package uk.ac.ox.cs.pagoda.endomorph;
2
3import org.semanticweb.owlapi.apibinding.OWLManager;
4import org.semanticweb.owlapi.model.*;
5import org.testng.Assert;
6import org.testng.annotations.Test;
7import uk.ac.ox.cs.JRDFox.model.GroundTerm;
8import uk.ac.ox.cs.JRDFox.model.Individual;
9import uk.ac.ox.cs.pagoda.query.AnswerTuple;
10import uk.ac.ox.cs.pagoda.summary.Graph;
11import uk.ac.ox.cs.pagoda.summary.NodeTuple;
12import uk.ac.ox.cs.pagoda.util.TestUtil;
13
14import java.util.HashSet;
15
16import static uk.ac.ox.cs.pagoda.util.TestUtil.getEntityIRI;
17
18public class DependencyGraphTest {
19
20 private OWLOntology getOntology() throws OWLOntologyCreationException {
21 OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
22 OWLDataFactory factory = manager.getOWLDataFactory();
23 OWLOntology ontology = manager.createOntology();
24
25 OWLClass hardWorkingStudent = factory.getOWLClass(getEntityIRI("HardWorkingStudent"));
26 manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(hardWorkingStudent));
27 OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a"));
28 OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b"));
29 OWLObjectProperty takesCourse = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "takesCourse")));
30 manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(takesCourse));
31
32 // Class assertions
33 manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, a)); // HardWorkingStudent(a)
34 manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, b)); // HardWorkingStudent(b)
35
36 // Minimum cardinality axiom
37 manager.addAxiom(ontology,
38 factory.getOWLEquivalentClassesAxiom(hardWorkingStudent,
39 factory.getOWLObjectMinCardinality(3,
40 takesCourse)));
41 return ontology;
42 }
43
44 @Test
45 public void test() throws OWLOntologyCreationException {
46 OWLOntology ontology = getOntology();
47 Graph graph = new Graph(ontology);
48 DependencyGraph dependencyGraph = new DependencyGraph(graph);
49
50 HashSet<NodeTuple> tuples = new HashSet<>();
51 tuples.add(graph.getNodeTuple(new AnswerTuple(new GroundTerm[]{Individual.create(String.format(TestUtil.NS, "a")), Individual.create(String.format(TestUtil.NS, "a"))})));
52 tuples.add(graph.getNodeTuple(new AnswerTuple(new GroundTerm[]{Individual.create(String.format(TestUtil.NS, "a")), Individual.create(String.format(TestUtil.NS, "b"))})));
53 tuples.add(graph.getNodeTuple(new AnswerTuple(new GroundTerm[]{Individual.create(String.format(TestUtil.NS, "b")), Individual.create(String.format(TestUtil.NS, "a"))})));
54 tuples.add(graph.getNodeTuple(new AnswerTuple(new GroundTerm[]{Individual.create(String.format(TestUtil.NS, "b")), Individual.create(String.format(TestUtil.NS, "b"))})));
55
56 dependencyGraph.build(tuples);
57
58 Assert.assertTrue(dependencyGraph.getTopologicalOrder().size() >= 2);
59 }
60}