public void visit(SWRLDataRangeAtom atom) { if (atom.getArgument() instanceof SWRLVariable) throwVarError(atom); // dr(literal) :- // convert to: ClassAssertion(DataSomeValuesFrom(freshDP DataOneOf(literal)) freshIndividual) // and top -> \forall freshDP.dr OWLLiteral lit=((SWRLLiteralArgument)atom.getArgument()).getLiteral(); OWLDataRange dr=atom.getPredicate(); OWLNamedIndividual freshIndividual=getFreshIndividual(); OWLDataProperty freshDP=getFreshDataProperty(); OWLDataSomeValuesFrom some=m_factory.getOWLDataSomeValuesFrom(freshDP,m_factory.getOWLDataOneOf(lit)); OWLClassExpression definition=getDefinitionFor(some,m_alreadyExists); if (!m_alreadyExists[0]) m_newInclusions.add(new OWLClassExpression[] { negative(definition),some }); addFact(m_factory.getOWLClassAssertionAxiom(definition,freshIndividual)); m_newInclusions.add(new OWLClassExpression[] { m_factory.getOWLDataAllValuesFrom(freshDP,dr) }); }
public void visit(SWRLDataPropertyAtom atom) { if (!(atom.getSecondArgument() instanceof SWRLLiteralArgument)) throwVarError(atom); if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument)) throwVarError(atom); OWLIndividual ind=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual(); if (ind.isAnonymous()) throwAnonIndError(atom); OWLLiteral lit=((SWRLLiteralArgument)atom.getSecondArgument()).getLiteral(); addFact(m_factory.getOWLDataPropertyAssertionAxiom(atom.getPredicate().asOWLDataProperty(),ind.asOWLNamedIndividual(),lit)); }
public void visit(SWRLDataPropertyAtom at) { OWLDataProperty dp=at.getPredicate().asOWLDataProperty(); SWRLVariable variable1=getVariableFor(at.getFirstArgument()); SWRLDArgument argument2=at.getSecondArgument(); if (argument2 instanceof SWRLVariable) { SWRLVariable variable2=getVariableFor((SWRLVariable)argument2); if (m_isPositive) { m_normalizedHeadAtoms.add(m_factory.getSWRLDataPropertyAtom(dp,variable1,variable2)); m_headDataRangeVariables.add(variable2); } else { if (m_bodyDataRangeVariables.add(variable2)) m_normalizedBodyAtoms.add(m_factory.getSWRLDataPropertyAtom(dp,variable1,variable2)); else { SWRLVariable variable2Fresh=getFreshVariable(); m_normalizedBodyAtoms.add(m_factory.getSWRLDataPropertyAtom(dp,variable1,variable2Fresh)); m_normalizedHeadAtoms.add(m_factory.getSWRLDifferentIndividualsAtom(variable2,variable2Fresh)); } } } else { OWLLiteral literal=((SWRLLiteralArgument)argument2).getLiteral(); SWRLAtom newAtom=m_factory.getSWRLClassAtom(m_factory.getOWLDataHasValue(dp,literal),variable1); if (m_isPositive) m_headAtoms.add(newAtom); else m_bodyAtoms.add(newAtom); } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SWRLLiteralArgumentImpl)) { return false; } SWRLLiteralArgument other = (SWRLLiteralArgument) obj; return other.getLiteral().equals(getLiteral()); }
public void visit(SWRLLiteralArgument argument) { }
public void visit(SWRLLiteralArgument argument) { // nothing to do }
public Atom visit(SWRLLiteralArgument arg) { throw new IllegalStateException("Internal error: this part of the code is unused."); }
@Override public O visit(SWRLLiteralArgument node) { return doDefault(node); }
@Override public void visit(SWRLLiteralArgument node) { handleDefault(node); }
@Override public void visit(SWRLLiteralArgument node) { type = RULE_OBJECT_TYPE_INDEX_BASE + 8; }
@Override public void visit(SWRLLiteralArgument node) {}
@Override public void visit(SWRLLiteralArgument node) { hashCode = primes[69]; hashCode = hashCode * MULT + node.getLiteral().hashCode(); }
@Override protected int compareObjectOfSameType(OWLObject object) { return literal.compareTo(((SWRLLiteralArgument) object).getLiteral()); }
@Override public SWRLLiteralArgument visit(SWRLLiteralArgument node) { return node; }
@Override public void visit(@Nonnull SWRLLiteralArgument node) { node.getLiteral().accept(this); }
@Override protected void writeObject(SWRLLiteralArgument object, BinaryOWLOutputStream outputStream) throws IOException { outputStream.writeOWLObject(object.getLiteral()); }
@Override protected SWRLLiteralArgument readObject(BinaryOWLInputStream inputStream) throws IOException, BinaryOWLParseException { OWLLiteral literal = inputStream.readOWLObject(); return inputStream.getDataFactory().getSWRLLiteralArgument(literal); }