/** * Create an all values restriction. * * @param r property term * @param c class or datatype term * @return an ATermAppl in the form all(r,c) */ public static ATermAppl all(ATermAppl r, ATermAppl c) { return ATermUtils.makeAllValues( r, c ); }
/** * Create an all values restriction. * * @param r property term * @param c class or datatype term * @return an ATermAppl in the form all(r,c) */ public static ATermAppl all(ATermAppl r, ATermAppl c) { return ATermUtils.makeAllValues( r, c ); }
@Override public void visit(OWLObjectAllValuesFrom restriction) { restriction.getProperty().accept( this ); ATerm p = term; restriction.getFiller().accept( this ); ATerm c = term; term = ATermUtils.makeAllValues( p, c ); }
public boolean hasRange(ATermAppl p, ATermAppl c) { if( !isClass( c ) && !isDatatype( c ) ) { handleUndefinedEntity( c + " is not a valid class expression" ); return false; } ATermAppl allValues = ATermUtils.makeAllValues( p, c ); return isSubClassOf( ATermUtils.TOP, allValues ); }
public boolean hasRange(ATermAppl p, ATermAppl c) { if( !isClass( c ) && !isDatatype( c ) ) { handleUndefinedEntity( c + " is not a valid class expression" ); return false; } ATermAppl allValues = ATermUtils.makeAllValues( p, c ); return isSubClassOf( ATermUtils.TOP, allValues ); }
@Override public void visit(OWLDataAllValuesFrom restriction) { restriction.getProperty().accept( this ); ATerm p = term; restriction.getFiller().accept( this ); ATerm c = term; term = ATermUtils.makeAllValues( p, c ); }
public void visit(OWLObjectAllValuesFrom restriction) { restriction.getProperty().accept( this ); ATerm p = term; restriction.getFiller().accept( this ); ATerm c = term; term = ATermUtils.makeAllValues( p, c ); }
public void visit(OWLDataAllValuesFrom restriction) { restriction.getProperty().accept( this ); ATerm p = term; restriction.getFiller().accept( this ); ATerm c = term; term = ATermUtils.makeAllValues( p, c ); }
protected boolean isBlockedByChain(BlockingContext cxt, ATermList chain, ATermAppl c) { Role firstRole = cxt.blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt.blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
protected boolean isBlockedByChain(BlockingContext cxt, ATermList chain, ATermAppl c) { Role firstRole = cxt.blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt.blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
public boolean absorb(Set<ATermAppl> terms, Set<ATermAppl> explanation) { if( !PelletOptions.USE_HASVALUE_ABSORPTION ) return false; for( Iterator<ATermAppl> i = terms.iterator(); i.hasNext(); ) { ATermAppl term = i.next(); if( isHasValue( term ) ) { ATermAppl p = (ATermAppl) term.getArgument( 0 ); if( !kb.isObjectProperty( p ) ) continue; i.remove(); ATermAppl c = disjunction( terms ); ATermAppl nominal = (ATermAppl) term.getArgument( 1 ); ATermAppl ind = (ATermAppl) nominal.getArgument( 0 ); ATermAppl invP = kb.getProperty( p ).getInverse().getName(); ATermAppl allInvPC = ATermUtils.makeAllValues( invP, c ); if( log.isLoggable( Level.FINER ) ) log.finer( "Absorb into " + ATermUtils.toString( ind ) + " with inverse of " + ATermUtils.toString( p ) + " for " + ATermUtils.toString( c ) ); absorbedAxioms.addAll( explanation ); kb.addIndividual( ind ); kb.addType( ind, allInvPC, new DependencySet( explanation ) ); return true; } } return false; } }
public boolean absorb(Set<ATermAppl> terms, Set<ATermAppl> explanation) { if( !PelletOptions.USE_HASVALUE_ABSORPTION ) return false; for( Iterator<ATermAppl> i = terms.iterator(); i.hasNext(); ) { ATermAppl term = i.next(); if( isHasValue( term ) ) { ATermAppl p = (ATermAppl) term.getArgument( 0 ); if( !kb.isObjectProperty( p ) ) continue; i.remove(); ATermAppl c = disjunction( terms ); ATermAppl nominal = (ATermAppl) term.getArgument( 1 ); ATermAppl ind = (ATermAppl) nominal.getArgument( 0 ); ATermAppl invP = kb.getProperty( p ).getInverse().getName(); ATermAppl allInvPC = ATermUtils.makeAllValues( invP, c ); if( log.isLoggable( Level.FINER ) ) log.finer( "Absorb into " + ATermUtils.toString( ind ) + " with inverse of " + ATermUtils.toString( p ) + " for " + ATermUtils.toString( c ) ); absorbedAxioms.addAll( explanation ); kb.addIndividual( ind ); kb.addType( ind, allInvPC, new DependencySet( explanation ) ); return true; } } return false; } }
public boolean isInverse(ATermAppl r1, ATermAppl r2) { Role role1 = getRole( r1 ); Role role2 = getRole( r2 ); if( role1 == null ) { handleUndefinedEntity( r1 + " is not a known property" ); return false; } if( role2 == null ) { handleUndefinedEntity( r2 + " is not a known property" ); return false; } // the following condition is wrong due to nominals, see OWL test // cases SymmetricProperty-002 // if( !role1.hasNamedInverse() ) // return false; if( !role1.isObjectRole() || !role2.isObjectRole() ) return false; if( role1.getInverse().equals( role2 ) ) { return true; } ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( c, ATermUtils.makeOr( ATermUtils.makeSomeValues( r1, ATermUtils.makeAllValues( r2, notC ) ), ATermUtils.makeSomeValues( r2, ATermUtils .makeAllValues( r1, notC ) ) ) ); return !abox.isSatisfiable( test ); }
public boolean isInverse(ATermAppl r1, ATermAppl r2) { Role role1 = getRole( r1 ); Role role2 = getRole( r2 ); if( role1 == null ) { handleUndefinedEntity( r1 + " is not a known property" ); return false; } if( role2 == null ) { handleUndefinedEntity( r2 + " is not a known property" ); return false; } // the following condition is wrong due to nominals, see OWL test // cases SymmetricProperty-002 // if( !role1.hasNamedInverse() ) // return false; if( !role1.isObjectRole() || !role2.isObjectRole() ) return false; if( role1.getInverse().equals( role2 ) ) { return true; } ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( c, ATermUtils.makeOr( ATermUtils.makeSomeValues( r1, ATermUtils.makeAllValues( r2, notC ) ), ATermUtils.makeSomeValues( r2, ATermUtils .makeAllValues( r1, notC ) ) ) ); return !abox.isSatisfiable( test ); }
public boolean isReflexiveProperty(ATermAppl p) { Role role = getRole( p ); if( role == null ) { handleUndefinedEntity( p + " is not a known property" ); return false; } if( !role.isObjectRole() || role.isIrreflexive() ) return false; else if( role.isReflexive() ) { if( doExplanation() ) abox.setExplanation( role.getExplainReflexive() ); return true; } ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( c, ATermUtils.makeAllValues( p, notC ) ); return !abox.isSatisfiable( test ); }
public boolean isReflexiveProperty(ATermAppl p) { Role role = getRole( p ); if( role == null ) { handleUndefinedEntity( p + " is not a known property" ); return false; } if( !role.isObjectRole() || role.isIrreflexive() ) return false; else if( role.isReflexive() ) { if( doExplanation() ) abox.setExplanation( role.getExplainReflexive() ); return true; } ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( c, ATermUtils.makeAllValues( p, notC ) ); return !abox.isSatisfiable( test ); }
protected boolean applyAllValuesPropertyChain( Individual x, ATermList chain, ATermAppl c, DependencySet ds ) { Role r = strategy.getABox().getRole( chain.getFirst() ); EdgeList edges = x.getRNeighborEdges( r ); if( !edges.isEmpty() ) { ATermAppl allRC = ATermUtils.makeAllValues( chain.getNext(), c ); for( int e = 0; e < edges.size(); e++ ) { Edge edgeToY = edges.edgeAt( e ); Node y = edgeToY.getNeighbor( x ); DependencySet finalDS = ds.union( edgeToY.getDepends(), strategy.getABox().doExplanation() ); applyAllValues( x, r, y, allRC, finalDS ); if( x.isMerged() || strategy.getABox().isClosed() ) return false; } } return true; }
protected boolean applyAllValuesPropertyChain( Individual x, ATermList chain, ATermAppl c, DependencySet ds ) { Role r = strategy.getABox().getRole( chain.getFirst() ); EdgeList edges = x.getRNeighborEdges( r ); if( !edges.isEmpty() ) { ATermAppl allRC = ATermUtils.makeAllValues( chain.getNext(), c ); for( int e = 0; e < edges.size(); e++ ) { Edge edgeToY = edges.edgeAt( e ); Node y = edgeToY.getNeighbor( x ); DependencySet finalDS = ds.union( edgeToY.getDepends(), strategy.getABox().doExplanation() ); applyAllValues( x, r, y, allRC, finalDS ); if( x.isMerged() || strategy.getABox().isClosed() ) return false; } } return true; }
public boolean isTransitiveProperty(ATermAppl r) { Role role = getRole( r ); if( role == null ) { handleUndefinedEntity( r + " is not a known property" ); return false; } if( role.isTransitive() ) { if( doExplanation() ) abox.setExplanation( role.getExplainTransitive() ); return true; } else if( !role.isObjectRole() || role.isFunctional() || role.isInverseFunctional() ) return false; ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( ATermUtils.makeSomeValues( r, ATermUtils .makeSomeValues( r, c ) ), ATermUtils.makeAllValues( r, notC ) ); return !abox.isSatisfiable( test ); }
public boolean isTransitiveProperty(ATermAppl r) { Role role = getRole( r ); if( role == null ) { handleUndefinedEntity( r + " is not a known property" ); return false; } if( role.isTransitive() ) { if( doExplanation() ) abox.setExplanation( role.getExplainTransitive() ); return true; } else if( !role.isObjectRole() || role.isFunctional() || role.isInverseFunctional() ) return false; ensureConsistency(); ATermAppl c = ATermUtils.makeTermAppl( "_C_" ); ATermAppl notC = ATermUtils.makeNot( c ); ATermAppl test = ATermUtils.makeAnd( ATermUtils.makeSomeValues( r, ATermUtils .makeSomeValues( r, c ) ), ATermUtils.makeAllValues( r, notC ) ); return !abox.isSatisfiable( test ); }