public void visit(SWRLClassAtom atom) { if (!(atom.getArgument() instanceof SWRLIndividualArgument)) throw new IllegalArgumentException("A SWRL rule contains a head atom "+atom+" with a variable that does not occur in the body. "); OWLIndividual ind=((SWRLIndividualArgument)atom.getArgument()).getIndividual(); if (ind.isAnonymous()) throwAnonIndError(atom); if (!isSimple(atom.getPredicate())) { OWLClassExpression definition=getDefinitionFor(atom.getPredicate(),m_alreadyExists); if (!m_alreadyExists[0]) m_newInclusions.add(new OWLClassExpression[] { negative(definition),atom.getPredicate() }); addFact(m_factory.getOWLClassAssertionAxiom(definition,ind.asOWLNamedIndividual())); } else addFact(m_factory.getOWLClassAssertionAxiom(atom.getPredicate(),ind.asOWLNamedIndividual())); }
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); }
public void visit(SWRLClassAtom at) { OWLClassExpression c=m_expressionManager.getSimplified(m_expressionManager.getNNF(at.getPredicate())); SWRLIArgument argument=at.getArgument(); if (m_isPositive) { // head if (c instanceof OWLClass) m_normalizedHeadAtoms.add(m_factory.getSWRLClassAtom(c,argument)); else { /* OWLClass definition=getClassFor(at.getPredicate(),m_alreadyExists); if (!m_alreadyExists[0]) m_classExpressionInclusions.add(new OWLClassExpression[] { negative(definition),at.getPredicate() }); m_normalizedHeadAtoms.add(m_factory.getSWRLClassAtom(definition,argument)); */ } } else { // body if (c instanceof OWLClass) m_normalizedBodyAtoms.add(m_factory.getSWRLClassAtom(c,argument)); else { /* OWLClass definition=getClassFor(at.getPredicate(),m_alreadyExists); if (!m_alreadyExists[0]) m_classExpressionInclusions.add(new OWLClassExpression[] { negative(at.getPredicate()),definition }); m_normalizedBodyAtoms.add(m_factory.getSWRLClassAtom(definition,argument)); */ } } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SWRLClassAtom)) { return false; } SWRLClassAtom other = (SWRLClassAtom) obj; return other.getArgument().equals(getArgument()) && other.getPredicate().equals(getPredicate()); }
@Override protected int compareObjectOfSameType(OWLObject object) { SWRLClassAtom other = (SWRLClassAtom) object; int diff = getPredicate().compareTo(other.getPredicate()); if (diff != 0) { return diff; } return getArgument().compareTo(other.getArgument()); }
@Override public O visit(SWRLClassAtom node) { return doDefault(node); }
@Override public void visit(SWRLClassAtom node) { handleDefault(node); }
@Override public void visit(SWRLClassAtom node) { type = RULE_OBJECT_TYPE_INDEX_BASE + 1; }
@Override public void visit(SWRLClassAtom node) { node.getArgument().accept(this); }
@Override public void visit(SWRLClassAtom node) { hashCode = primes[62]; hashCode = hashCode * MULT + node.getArgument().hashCode(); hashCode = hashCode * MULT + node.getPredicate().hashCode(); }
@Override public Set<OWLClassExpression> visit(SWRLClassAtom node) { return node.getPredicate().accept(this); }
@Override public SWRLClassAtom visit(SWRLClassAtom node) { return node; }
@Override public void visit(@Nonnull SWRLClassAtom node) { node.getArgument().accept(this); node.getPredicate().accept(this); }
@Override protected void writeObject(SWRLClassAtom object, BinaryOWLOutputStream outputStream) throws IOException { outputStream.writeOWLObject(object.getPredicate()); outputStream.writeOWLObject(object.getArgument()); }
@Override protected SWRLClassAtom readObject(BinaryOWLInputStream inputStream) throws IOException, BinaryOWLParseException { OWLClassExpression predicate = inputStream.readOWLObject(); SWRLIArgument arg = inputStream.readOWLObject(); return inputStream.getDataFactory().getSWRLClassAtom(predicate, arg); }