@Override public HandlerResult visit(OWLObjectMinCardinality ce) { final OWLClassExpression filler = ce.getFiller(); final HandlerResult recursive = filler.accept(this); OWLObjectSomeValuesFrom newCE; if (recursive == null) { newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), filler); } else if (recursive.remove) { return HandlerResult.remove(); } else { newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), recursive.modified); } return HandlerResult.modified(newCE); }
@Override public OWLClassExpression visit(OWLObjectMinCardinality ce) { // >= 0 r.C \equiv \top int cardinality = ce.getCardinality(); if (cardinality == 0) { return df.getOWLThing(); } OWLClassExpression filler = ce.getFiller(); OWLClassExpression shortenedFiller = filler.accept(this); if(shortenedFiller.isOWLNothing()){// >= n r.\bot \equiv \bot if n != 0 return df.getOWLNothing(); } else if(!filler.equals(shortenedFiller)){ return df.getOWLObjectMinCardinality(ce.getCardinality(), ce.getProperty(), shortenedFiller); } return ce; }
@Nonnull @Override public OWLClassExpression visit(OWLObjectMinCardinality ce) { boolean neg = negated; int card = ce.getCardinality(); if (negated) { card = ce.getCardinality() - 1; if (card < 0) { card = 0; } } negated = false; OWLClassExpression filler = ce.getFiller().accept(this); OWLClassExpression nnf = null; if (neg) { nnf = dataFactory.getOWLObjectMaxCardinality(card, ce.getProperty(), filler); } else { nnf = dataFactory.getOWLObjectMinCardinality(card, ce.getProperty(), filler); } negated = neg; return nnf; }
@Override public void addToOntology() { OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMinCardinalityProperty"); OWLClass range = featurePool.getExclusiveClass(":ObjectMinCardinalityRange"); addToGenericDomainAndNewRange(property, range); OWLObjectMinCardinality minCardinality = factory.getOWLObjectMinCardinality(2, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, minCardinality)); }
@Override public void addToOntology() { OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMinCardinalityProperty_Lite"); OWLClass range = featurePool.getExclusiveClass(":ObjectMinCardinalityRange_Lite"); addToGenericDomainAndNewRange(property, range); OWLObjectMinCardinality minCardinality = factory.getOWLObjectMinCardinality(0, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, minCardinality)); }
@Override public void addToOntology() { OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMinQualifiedCardinalityProperty"); OWLClass range = featurePool.getExclusiveClass(":ObjectMinQualifiedCardinalityRange"); addToGenericDomainAndNewRange(property, range); OWLClass qualifier = featurePool.getExclusiveClass(":ObjectMinQualifiedCardinality_Qualifier"); OWLObjectMinCardinality minCardinality = factory.getOWLObjectMinCardinality(1, property, qualifier); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, minCardinality)); }
public void visit(OWLObjectMinCardinality arg0) { try { OWLClass c = Utils.ensureClass(arg0.getFiller()); OWLObjectProperty p = Utils.ensureObjectProperty(arg0.getProperty()); integrityConstraints.add(integrityConstraintFactory .MinObjectParticipationConstraint(subjClass, p, c, arg0.getCardinality())); } catch (UnsupportedICException e) { notSupported(arg0); } }
public OWLClassExpression visit(OWLObjectMinCardinality object) { m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty()); OWLClassExpression filler=object.getFiller(); if (isSimple(filler)) return object; else { OWLClassExpression definition=getDefinitionFor(filler,m_alreadyExists); if (!m_alreadyExists[0]) m_newInclusions.add(new OWLClassExpression[] { negative(definition),filler }); return m_factory.getOWLObjectMinCardinality(object.getCardinality(),object.getProperty(),definition); } }
public OWLClassExpression visit(OWLObjectMinCardinality d) { if (d.getCardinality()==0) return m_factory.getOWLNothing(); else { OWLClassExpression filler=getNNF(d.getFiller()); return m_factory.getOWLObjectMaxCardinality(d.getCardinality()-1,d.getProperty().getSimplified(),filler); } }
public OWLClassExpression visit(OWLObjectMinCardinality d) { OWLClassExpression filler=getSimplified(d.getFiller()); if (d.getCardinality()<=0) return m_factory.getOWLThing(); else if (filler.isOWLNothing()) return m_factory.getOWLNothing(); else if (d.getCardinality()==1) return m_factory.getOWLObjectSomeValuesFrom(d.getProperty().getSimplified(),filler); else return m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler); }
public OWLClassExpression visit(OWLObjectExactCardinality d) { OWLClassExpression filler=getSimplified(d.getFiller()); if (d.getCardinality()<0) return m_factory.getOWLNothing(); else if (d.getCardinality()==0) return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler)); else if (filler.isOWLNothing()) return m_factory.getOWLNothing(); else { OWLObjectMinCardinality minCardinality=m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler); OWLObjectMaxCardinality maxCardinality=m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler); return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality); } }
public void visit(OWLObjectMinCardinality object) { LiteralConcept toConcept=getLiteralConcept(object.getFiller()); Role onRole=getRole(object.getProperty()); AtLeastConcept atLeastConcept=AtLeastConcept.create(object.getCardinality(),onRole,toConcept); if (!atLeastConcept.isAlwaysFalse()) m_headAtoms.add(Atom.create(atLeastConcept,X)); }
@Override public OWLObjectMinCardinality visit( ElkObjectMinCardinalityQualified expression) { return owlFactory_.getOWLObjectMinCardinality( expression.getCardinality(), convert(expression.getProperty()), convert(expression.getFiller())); }
@SuppressWarnings("static-method") public ElkObjectMinCardinality convert( OWLObjectMinCardinality owlObjectMaxCardinality) { if (owlObjectMaxCardinality.isQualified()) return new ElkObjectMinCardinalityQualifiedWrap<OWLObjectMinCardinality>( owlObjectMaxCardinality); // else return new ElkObjectMinCardinalityUnqualifiedWrap<OWLObjectMinCardinality>( owlObjectMaxCardinality); }
@Override public OWLObjectMinCardinality visit(OWLObjectMinCardinality ce) { if (LOG.isDebugEnabled()) { LOG.debug("Unfolding min_cardinality: "+ce); } OWLClassExpression filler = ce.getFiller(); if (filler != null) { OWLClassExpression unfold = filler.accept(this); if (unfold != null) { return factory.getOWLObjectMinCardinality(ce.getCardinality(), ce.getProperty(), unfold); } } return null; }
/** * According to the naive translation:<br/> * <br/> * <code>naive(Exists r.A) := not r(X,Y), A(Y)</code> * * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom) */ public void visit(OWLObjectSomeValuesFrom objExistential) { // we require normalized axioms, therefore we can do the following OWLObjectPropertyExpression property = objExistential.getProperty(); OWLClassExpression fillerClass = objExistential.getFiller(); OWLObjectMinCardinality minCard = new OWLObjectMinCardinalityImpl(property, 1, fillerClass); visit(minCard); }
/** * Smth like * A subClassOf r min 5 B * But we have only a domain with 4 elements ... */ public void testUnsatisfiabilityDoToFixedDomain1() { OWLDataFactory factory = OWLManager.getOWLDataFactory(); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A"))); OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B"))); OWLObjectPropertyExpression roleR = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "r"))); OWLNamedIndividual indA = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a"))); OWLNamedIndividual indB = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "b"))); OWLNamedIndividual indC = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "c"))); OWLNamedIndividual indD = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "d"))); OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indA); OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(classA, indB); OWLIndividualAxiom fact3 = factory.getOWLClassAssertionAxiom(classA, indC); OWLIndividualAxiom fact4 = factory.getOWLClassAssertionAxiom(classA, indD); OWLObjectMinCardinality exprRmin5B = factory.getOWLObjectMinCardinality(5, roleR, classB); OWLSubClassOfAxiom axmAsubRsomeB = factory.getOWLSubClassOfAxiom(classA, exprRmin5B); try { OWLOntology ontology = manager.createOntology(); manager.addAxiom(ontology, fact1); manager.addAxiom(ontology, fact2); manager.addAxiom(ontology, fact3); manager.addAxiom(ontology, fact4); manager.addAxiom(ontology, axmAsubRsomeB); Wolpertinger wolpertinger = new Wolpertinger(ontology); assertFalse(wolpertinger.isConsistent()); } catch (OWLOntologyCreationException e) { e.printStackTrace(); fail(); } }
@Override public void visit(OWLObjectMinCardinality ce) { hashCode = primes[45]; hashCode = hashCode * MULT + ce.getProperty().hashCode(); hashCode = hashCode * MULT + ce.getCardinality(); hashCode = hashCode * MULT + ce.getFiller().hashCode(); }
@Override public Set<OWLClassExpression> visit(OWLObjectMinCardinality ce) { Set<OWLClassExpression> result = new HashSet<>(); result.add(ce); result.addAll(ce.getFiller().accept(this)); return result; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } return obj instanceof OWLObjectMinCardinality; }
public void visit(OWLObjectMinCardinality object) { visitProperty(object.getProperty()); object.getFiller().accept(this); }
public Boolean visit(OWLObjectMinCardinality object) { return object.getCardinality()>0; }
public OWLClassExpression visit(OWLObjectMinCardinality d) { OWLClassExpression filler=getNNF(d.getFiller()); return m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler); }
@Override public OWLObjectMinCardinality visit( ElkObjectMinCardinalityUnqualified expression) { return owlFactory_.getOWLObjectMinCardinality( expression.getCardinality(), convert(expression.getProperty())); }
@Override public ElkObjectMinCardinality visit( OWLObjectMinCardinality owlObjectMaxCardinality) { return CONVERTER.convert(owlObjectMaxCardinality); }