*/
if (rTerm instanceof ATermList)
continue;
final ATermAppl r = (ATermAppl)rTerm;
final Role role = strategy.getABox().getRole( r );
/*
* Skip any roles that are not datatype properties
*/
if (!role.isDatatypeRole())
continue;
/*
* Collect the data range and its dependency set
*/
Collection<ATermAppl> existing = dataranges.get( r );
DependencySet ds = x.getDepends( allDesc );
if (existing == null) {
existing = new ArrayList<ATermAppl>();
dataranges.put( r, existing );
} else {
ds = ds.union( rangeDepends.get( r ), strategy.getABox().doExplanation() );
}
existing.add( (ATermAppl) allDesc.getArgument(1) );
rangeDepends.put( r, ds );
}
/*
* Get the ranges of any data properties that have min cardinality restrictions
*/
for (ATermAppl minDesc : x.getTypes( Node.MIN )) {
/*
* TODO: Verify that minDesc will never have a property chain
*/
final ATermAppl r = (ATermAppl)minDesc.getArgument( 0 );
final Role role = strategy.getABox().getRole( r );
/*
* Skip any roles that are not datatype properties
*/
if (!role.isDatatypeRole())
continue;
final Set<ATermAppl> ranges = role.getRanges();
if( !ranges.isEmpty() ) {
Collection<ATermAppl> existing = dataranges.get( r );
DependencySet ds;
if( existing == null ) {
existing = new ArrayList<ATermAppl>();
dataranges.put( r, existing );
ds = DependencySet.EMPTY;
} else
ds = rangeDepends.get( r );
for( ATermAppl dataRange : role.getRanges() ) {
/*
* TODO: Verify the dependency set handling here. The old
* implementation just used independent (thus could avoid
* this loop and call addAll)
*/
existing.add( dataRange );
ds = ds.union( role.getExplainRange( dataRange ), strategy.getABox().doExplanation() );
rangeDepends.put( r, ds );
}
}
}
/*
* For each of the min cardinality restrictions, verify that the data range is large enough
*/
for (ATermAppl minDesc : x.getTypes( Node.MIN )) {
final ATermAppl r = (ATermAppl)minDesc.getArgument( 0 );
final Role role = strategy.getABox().getRole( r );
Set<ATermAppl> drs = new HashSet<ATermAppl>();
Collection<ATermAppl> direct = dataranges.get( r );
DependencySet ds;
if (direct != null) {
drs.addAll(direct);
ds = rangeDepends.get( r );
} else
ds = DependencySet.EMPTY;
for (Role superRole : role.getSuperRoles()) {
final ATermAppl s = superRole.getName();
Collection<ATermAppl> inherited = dataranges.get( s );
if( inherited != null ) {
drs.addAll( inherited );
ds = ds.union( rangeDepends.get( s ), strategy.getABox().doExplanation() ).union(
role.getExplainSuper( s ), strategy.getABox().doExplanation() );
}
}
if( !drs.isEmpty() ) {
final int n = ((ATermInt)minDesc.getArgument( 1 )).getInt();