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(SWRLDataRangeAtom at) { OWLDataRange dr=at.getPredicate(); SWRLDArgument argument=at.getArgument(); if (!(argument instanceof SWRLVariable)) throw new IllegalArgumentException("A SWRL rule contains a data range with an argument that is not a literal, and such rules are not supported."); if (!m_isPositive) dr=m_factory.getOWLDataComplementOf(dr); dr=m_expressionManager.getNNF(m_expressionManager.getSimplified(dr)); if (dr instanceof OWLDataIntersectionOf || dr instanceof OWLDataUnionOf) { OWLDatatype definition=getDefinitionFor(dr,m_alreadyExists); if (!m_alreadyExists[0]) m_dataRangeInclusions.add(new OWLDataRange[] { negative(definition),dr }); dr=definition; } SWRLAtom atom=m_factory.getSWRLDataRangeAtom(dr,argument); m_normalizedHeadAtoms.add(atom); m_headDataRangeVariables.add((SWRLVariable)argument); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SWRLDataRangeAtom)) { return false; } SWRLDataRangeAtom other = (SWRLDataRangeAtom) obj; return other.getArgument().equals(getArgument()) && other.getPredicate().equals(getPredicate()); }
@Override protected int compareObjectOfSameType(OWLObject object) { SWRLDataRangeAtom other = (SWRLDataRangeAtom) object; int diff = getPredicate().compareTo(other.getPredicate()); if (diff != 0) { return diff; } return getArgument().compareTo(other.getArgument()); }
public Atom visit(SWRLDataRangeAtom atom) { Variable variable=toVariable(atom.getArgument()); LiteralDataRange literalRange=m_dataRangeConverter.convertDataRange(atom.getPredicate()); return Atom.create((DLPredicate)literalRange,variable); }
@Override public O visit(SWRLDataRangeAtom node) { return doDefault(node); }
@Override public void visit(SWRLDataRangeAtom node) { handleDefault(node); }
@Override public void visit(SWRLDataRangeAtom node) { type = RULE_OBJECT_TYPE_INDEX_BASE + 2; }
@Override public void visit(SWRLDataRangeAtom node) { node.getArgument().accept(this); }
@Override public void visit(SWRLDataRangeAtom node) { hashCode = primes[63]; hashCode = hashCode * MULT + node.getArgument().hashCode(); hashCode = hashCode * MULT + node.getPredicate().hashCode(); }
@Override public SWRLDataRangeAtom visit(SWRLDataRangeAtom node) { return node; }
@Override public void visit(@Nonnull SWRLDataRangeAtom node) { node.getArgument().accept(this); node.getPredicate().accept(this); }
@Override protected void writeObject(SWRLDataRangeAtom object, BinaryOWLOutputStream outputStream) throws IOException { outputStream.writeOWLObject(object.getPredicate()); outputStream.writeOWLObject(object.getArgument()); }
@Override protected SWRLDataRangeAtom readObject(BinaryOWLInputStream inputStream) throws IOException, BinaryOWLParseException { OWLDataRange predicate = inputStream.readOWLObject(); SWRLDArgument argument = inputStream.readOWLObject(); return inputStream.getDataFactory().getSWRLDataRangeAtom(predicate, argument); }