From 4013a9d33d0f1a06b87d12dd0543912c53bba137 Mon Sep 17 00:00:00 2001 From: yzhou Date: Tue, 28 Apr 2015 17:13:55 +0100 Subject: pass the wine realisation --- .../ox/cs/pagoda/reasoner/full/HermitChecker.java | 55 ++++++++++++---------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java') diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java index 97925fc..4dd11d8 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java @@ -77,7 +77,8 @@ public class HermitChecker implements Checker { } private int tag = 0; - AnswerTuple topAnswerTuple = null, botAnswerTuple = null; +// AnswerTuple topAnswerTuple = null; + AnswerTuple botAnswerTuple = null; private void initialiseReasoner() { qGraph = new QueryGraph(queryClause.getBodyAtoms(), answerVariable[1], ontology); @@ -96,8 +97,9 @@ public class HermitChecker implements Checker { manager.removeAxioms(ontology, axioms); hermit = new Reasoner(ontology); } else { - if (topAnswerTuple != null && !check(topAnswerTuple)) tag = -1; - else if (botAnswerTuple != null && check(botAnswerTuple)) tag = 1; +// if (topAnswerTuple != null && !check(topAnswerTuple)) tag = -1; +// else + if (botAnswerTuple != null && check(botAnswerTuple)) tag = 1; } } else @@ -105,19 +107,22 @@ public class HermitChecker implements Checker { } private void addTopAndBotTuple(Set axioms) { - String top_str = Namespace.PAGODA_ANONY + "top", bot_str = Namespace.PAGODA_ANONY + "bot"; - topAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(top_str) } ); +// String top_str = Namespace.PAGODA_ANONY + "top"; + String bot_str = Namespace.PAGODA_ANONY + "bot"; +// topAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(top_str) } ); botAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(bot_str) } ); - OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)), bot_ind = factory.getOWLNamedIndividual(IRI.create(bot_str)); +// OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)); + OWLIndividual bot_ind = factory.getOWLNamedIndividual(IRI.create(bot_str)); Map counter = new HashMap(); - Set topAnswers = new HashSet(), botAnswers = new HashSet(); +// Set topAnswers = new HashSet(); + Set botAnswers = new HashSet(); OWLIndividual sub, obj; - if (dGraph.getExits().size() > 1) { - for (Clique answerClique: dGraph.getExits()) - topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative().getAnswerTuple().getGroundTerm(0)).getIRI()); - } - else topAnswerTuple = null; +// if (dGraph.getExits().size() > 1) { +// for (Clique answerClique: dGraph.getExits()) +// topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative().getAnswerTuple().getGroundTerm(0)).getIRI()); +// } +// else topAnswerTuple = null; if (dGraph.getEntrances().size() > 1) { for (Clique answerClique: dGraph.getEntrances()) @@ -129,23 +134,23 @@ public class HermitChecker implements Checker { if (axiom instanceof OWLClassAssertionAxiom) { OWLClassAssertionAxiom ca = (OWLClassAssertionAxiom) axiom; sub = ca.getIndividual(); - if (topAnswers.contains(sub.toStringID())) - axioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind)); +// if (topAnswers.contains(sub.toStringID())) +// axioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind)); if (botAnswers.contains(sub.toStringID())) inc(counter, factory.getOWLClassAssertionAxiom(ca.getClassExpression(), bot_ind)); } else if (axiom instanceof OWLObjectPropertyAssertionAxiom) { OWLObjectPropertyAssertionAxiom oa = (OWLObjectPropertyAssertionAxiom) axiom; sub = oa.getSubject(); obj = oa.getObject(); - if (topAnswers.contains(sub.toStringID())) - if (topAnswers.contains(obj.toStringID())) - axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind)); - else - axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj)); - else { - if (topAnswers.contains(obj.toStringID())) - axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind)); - } +//// if (topAnswers.contains(sub.toStringID())) +//// if (topAnswers.contains(obj.toStringID())) +//// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind)); +//// else +//// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj)); +//// else { +//// if (topAnswers.contains(obj.toStringID())) +//// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind)); +//// } if (botAnswers.contains(sub.toStringID())) if (botAnswers.contains(obj.toStringID())) @@ -161,8 +166,8 @@ public class HermitChecker implements Checker { else if (axiom instanceof OWLDataPropertyAssertionAxiom) { OWLDataPropertyAssertionAxiom da = (OWLDataPropertyAssertionAxiom) axiom; sub = da.getSubject(); - if (topAnswers.contains(sub.toStringID())) - axioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject())); +// if (topAnswers.contains(sub.toStringID())) +// axioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject())); if (botAnswers.contains(sub.toStringID())) inc(counter, factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), bot_ind, da.getObject())); -- cgit v1.2.3