aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
diff options
context:
space:
mode:
authoryzhou <yzhou@krr-linux.cs.ox.ac.uk>2015-04-28 17:13:55 +0100
committeryzhou <yzhou@krr-linux.cs.ox.ac.uk>2015-04-28 17:13:55 +0100
commit4013a9d33d0f1a06b87d12dd0543912c53bba137 (patch)
tree717d2ef6f8743031af689b2cd6f94ffc55fd5e70 /src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
parent30b5afef93bdb4f0ee0e7647fb0dd3d9c84e452a (diff)
downloadACQuA-4013a9d33d0f1a06b87d12dd0543912c53bba137.tar.gz
ACQuA-4013a9d33d0f1a06b87d12dd0543912c53bba137.zip
pass the wine realisation
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
index a43d9af..a60b664 100644
--- a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
+++ b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
@@ -31,6 +31,8 @@ import org.semanticweb.owlapi.model.OWLDataMinCardinality;
31import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; 31import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
32import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom; 32import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom;
33import org.semanticweb.owlapi.model.OWLDatatype; 33import org.semanticweb.owlapi.model.OWLDatatype;
34import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom;
35import org.semanticweb.owlapi.model.OWLIndividual;
34import org.semanticweb.owlapi.model.OWLNamedIndividual; 36import org.semanticweb.owlapi.model.OWLNamedIndividual;
35import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; 37import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom;
36import org.semanticweb.owlapi.model.OWLObjectComplementOf; 38import org.semanticweb.owlapi.model.OWLObjectComplementOf;
@@ -46,6 +48,7 @@ import org.semanticweb.owlapi.model.OWLOntology;
46import org.semanticweb.owlapi.model.OWLOntologyCreationException; 48import org.semanticweb.owlapi.model.OWLOntologyCreationException;
47import org.semanticweb.owlapi.model.OWLOntologyManager; 49import org.semanticweb.owlapi.model.OWLOntologyManager;
48import org.semanticweb.owlapi.model.OWLOntologyStorageException; 50import org.semanticweb.owlapi.model.OWLOntologyStorageException;
51import org.semanticweb.owlapi.model.OWLSameIndividualAxiom;
49import org.semanticweb.owlapi.profiles.OWL2RLProfile; 52import org.semanticweb.owlapi.profiles.OWL2RLProfile;
50import org.semanticweb.owlapi.profiles.OWLProfileReport; 53import org.semanticweb.owlapi.profiles.OWLProfileReport;
51import org.semanticweb.owlapi.profiles.OWLProfileViolation; 54import org.semanticweb.owlapi.profiles.OWLProfileViolation;
@@ -360,6 +363,9 @@ public class RLPlusOntology implements KnowledgeBase {
360 Map<OWLClassExpression, OWLClass> complex2atomic= new HashMap<OWLClassExpression, OWLClass>(); 363 Map<OWLClassExpression, OWLClass> complex2atomic= new HashMap<OWLClassExpression, OWLClass>();
361 364
362 OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI")); 365 OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI"));
366 OWLObjectProperty sameAs = factory.getOWLObjectProperty(IRI.create(Namespace.EQUALITY));
367 OWLObjectProperty differentFrom = factory.getOWLObjectProperty(IRI.create(Namespace.INEQUALITY));
368
363 for (OWLOntology imported: inputOntology.getImportsClosure()) 369 for (OWLOntology imported: inputOntology.getImportsClosure())
364 for (OWLAxiom axiom: imported.getAxioms()) { 370 for (OWLAxiom axiom: imported.getAxioms()) {
365 if (axiom instanceof OWLClassAssertionAxiom) { 371 if (axiom instanceof OWLClassAssertionAxiom) {
@@ -381,10 +387,33 @@ public class RLPlusOntology implements KnowledgeBase {
381 } 387 }
382 } 388 }
383 else if (axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) { 389 else if (axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) {
384 if (axiom.containsEntityInSignature(anyURI)) continue; 390 if (axiom.getDataPropertiesInSignature().contains(anyURI)) continue;
385 flag = true; 391 flag = true;
386 manager.addAxiom(aBox, axiom); 392 manager.addAxiom(aBox, axiom);
387 } 393 }
394 else if (axiom instanceof OWLSameIndividualAxiom) {
395 OWLIndividual firstIndividual = null, previousIndividual = null, lastIndividual = null;
396 for (OWLIndividual next: ((OWLSameIndividualAxiom) axiom).getIndividuals()) {
397 if (firstIndividual == null) firstIndividual = previousIndividual = next;
398 else
399 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, previousIndividual, next));
400 previousIndividual = lastIndividual = next;
401 }
402 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, lastIndividual, firstIndividual));
403 }
404 else if (axiom instanceof OWLDifferentIndividualsAxiom) {
405 int index1 = 0, index2;
406 for (OWLIndividual individual1: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) {
407 ++index1;
408 index2 = 0;
409 for (OWLIndividual individual2: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) {
410 if (index2++ < index1) {
411 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(differentFrom, individual1, individual2));
412 }
413 else break;
414 }
415 }
416 }
388 else 417 else
389 manager.addAxiom(tBox, axiom); 418 manager.addAxiom(tBox, axiom);
390 } 419 }