Ejemplo n.º 1
0
 public void visit(OWLClassAssertionAxiom object) {
   OWLClassExpression description = object.getClassExpression();
   if (description instanceof OWLClass) {
     AtomicConcept atomicConcept =
         AtomicConcept.create(((OWLClass) description).getIRI().toString());
     Atom atom = Atom.create(atomicConcept, getIndividual(object.getIndividual()));
     Collection<OWLAxiom> originalAxioms = m_positiveFacts_map.get(atom);
     if (originalAxioms == null) {
       originalAxioms = new ArrayList<OWLAxiom>();
       m_positiveFacts_map.put(atom, originalAxioms);
     }
     if (originalAxiom != null) originalAxioms.add(originalAxiom);
   } else if (description instanceof OWLObjectComplementOf
       && ((OWLObjectComplementOf) description).getOperand() instanceof OWLClass) {
     AtomicConcept atomicConcept =
         AtomicConcept.create(
             ((OWLClass) ((OWLObjectComplementOf) description).getOperand())
                 .getIRI()
                 .toString());
     Atom atom = Atom.create(atomicConcept, getIndividual(object.getIndividual()));
     Collection<OWLAxiom> originalAxioms = m_negativeFacts_map.get(atom);
     if (originalAxioms == null) {
       originalAxioms = new ArrayList<OWLAxiom>();
       m_negativeFacts_map.put(atom, originalAxioms);
     }
     if (originalAxiom != null) originalAxioms.add(originalAxiom);
   } else if (description instanceof OWLObjectHasSelf) {
     OWLObjectHasSelf self = (OWLObjectHasSelf) description;
     Atom atom =
         getRoleAtom(
             self.getProperty(),
             getIndividual(object.getIndividual()),
             getIndividual(object.getIndividual()));
     Collection<OWLAxiom> originalAxioms = m_positiveFacts_map.get(atom);
     if (originalAxioms == null) {
       originalAxioms = new ArrayList<OWLAxiom>();
       m_positiveFacts_map.put(atom, originalAxioms);
     }
     if (originalAxiom != null) originalAxioms.add(originalAxiom);
   } else if (description instanceof OWLObjectComplementOf
       && ((OWLObjectComplementOf) description).getOperand() instanceof OWLObjectHasSelf) {
     OWLObjectHasSelf self =
         (OWLObjectHasSelf) (((OWLObjectComplementOf) description).getOperand());
     Atom atom =
         getRoleAtom(
             self.getProperty(),
             getIndividual(object.getIndividual()),
             getIndividual(object.getIndividual()));
     Collection<OWLAxiom> originalAxioms = m_negativeFacts_map.get(atom);
     if (originalAxioms == null) {
       originalAxioms = new ArrayList<OWLAxiom>();
       m_negativeFacts_map.put(atom, originalAxioms);
     }
     if (originalAxiom != null) originalAxioms.add(originalAxiom);
   } else throw new IllegalStateException("Internal error: invalid normal form.");
 }
Ejemplo n.º 2
0
 public Atom visit(SWRLClassAtom atom) {
   if (atom.getPredicate().isAnonymous())
     throw new IllegalStateException(
         "Internal error: SWRL rule class atoms should be normalized to contain only named classes, but this class atom has a complex concept: "
             + atom.getPredicate());
   Variable variable = toVariable(atom.getArgument());
   m_abstractVariables.add(variable);
   return Atom.create(
       AtomicConcept.create(atom.getPredicate().asOWLClass().getIRI().toString()), variable);
 }