diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java | 31 |
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; | |||
| 31 | import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; | 31 | import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; |
| 32 | import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom; | 32 | import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom; |
| 33 | import org.semanticweb.owlapi.model.OWLDatatype; | 33 | import org.semanticweb.owlapi.model.OWLDatatype; |
| 34 | import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom; | ||
| 35 | import org.semanticweb.owlapi.model.OWLIndividual; | ||
| 34 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | 36 | import org.semanticweb.owlapi.model.OWLNamedIndividual; |
| 35 | import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; | 37 | import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; |
| 36 | import org.semanticweb.owlapi.model.OWLObjectComplementOf; | 38 | import org.semanticweb.owlapi.model.OWLObjectComplementOf; |
| @@ -46,6 +48,7 @@ import org.semanticweb.owlapi.model.OWLOntology; | |||
| 46 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; | 48 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; |
| 47 | import org.semanticweb.owlapi.model.OWLOntologyManager; | 49 | import org.semanticweb.owlapi.model.OWLOntologyManager; |
| 48 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; | 50 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; |
| 51 | import org.semanticweb.owlapi.model.OWLSameIndividualAxiom; | ||
| 49 | import org.semanticweb.owlapi.profiles.OWL2RLProfile; | 52 | import org.semanticweb.owlapi.profiles.OWL2RLProfile; |
| 50 | import org.semanticweb.owlapi.profiles.OWLProfileReport; | 53 | import org.semanticweb.owlapi.profiles.OWLProfileReport; |
| 51 | import org.semanticweb.owlapi.profiles.OWLProfileViolation; | 54 | import 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 | } |
