@@ -426,8 +426,8 @@ public void init() throws ComponentInitException {
426426 maxNrOfFillers .put (op , 10 );
427427 } else {
428428 int maxFillers = Math .min (cardinalityLimit ,
429- reasoner .getPropertyMembers (op ).entrySet ().stream ()
430- .mapToInt (entry -> entry . getValue (). size () )
429+ reasoner .getPropertyMembers (op ).values ().stream ()
430+ .mapToInt (Set :: size )
431431 .max ().orElse (0 ));
432432 maxNrOfFillers .put (op , maxFillers );
433433
@@ -626,9 +626,9 @@ public Set<OWLClassExpression> refine(OWLClassExpression description, int maxLen
626626 refinements .add (operands .get (1 ));
627627 } else {
628628 // copy children list and remove a different element in each turn
629- for ( int i = 0 ; i < operands . size (); i ++ ) {
629+ for ( OWLClassExpression op : operands ) {
630630 List <OWLClassExpression > newChildren = new LinkedList <>(operands );
631- newChildren .remove (i );
631+ newChildren .remove (op );
632632 OWLObjectUnionOf md = new OWLObjectUnionOfImplExt (newChildren );
633633 refinements .add (md );
634634 }
@@ -639,7 +639,10 @@ public Set<OWLClassExpression> refine(OWLClassExpression description, int maxLen
639639 OWLObjectPropertyExpression role = ((OWLObjectSomeValuesFrom ) description ).getProperty ();
640640 OWLClassExpression filler = ((OWLObjectSomeValuesFrom ) description ).getFiller ();
641641
642- OWLClassExpression domain = role .isAnonymous () ? opDomains .get (role .getNamedProperty ()) : opRanges .get (role );
642+ // we need the context of the filler which is either the domain (in case of an inverse property) or the range of p
643+ OWLClassExpression domain = role .isAnonymous ()
644+ ? opDomains .get (role .getNamedProperty ()) // inv(p) -> D = domain(p)
645+ : opRanges .get (role .asOWLObjectProperty ()); // p -> D = range(p)
643646
644647 // rule 1: EXISTS r.D => EXISTS r.E
645648 tmp = refine (filler , maxLength -lengthMetric .objectSomeValuesLength -lengthMetric .objectProperyLength , null , domain );
@@ -657,11 +660,11 @@ public Set<OWLClassExpression> refine(OWLClassExpression description, int maxLen
657660
658661 // rule 3: EXISTS r.D => >= 2 r.D
659662 // (length increases by 1 so we have to check whether max length is sufficient)
660- if (useCardinalityRestrictions ) { // && !role.isAnonymous()) {
661- if ( maxLength > OWLClassExpressionUtils .getLength (description , lengthMetric ) && maxNrOfFillers . get ( role ) > 1 ) {
662- OWLObjectMinCardinality min = df . getOWLObjectMinCardinality ( 2 , role , filler );
663- refinements .add (min );
664- }
663+ if (useCardinalityRestrictions &&
664+ maxLength > OWLClassExpressionUtils .getLength (description , lengthMetric ) &&
665+ maxNrOfFillers . get ( role ) > 1 ) {
666+ refinements .add (df . getOWLObjectMinCardinality ( 2 , role , filler ) );
667+
665668 }
666669
667670 // rule 4: EXISTS r.TOP => EXISTS r.{value}
@@ -672,10 +675,12 @@ public Set<OWLClassExpression> refine(OWLClassExpression description, int maxLen
672675 for (OWLIndividual ind : frequentInds ) {
673676 OWLObjectHasValue ovr = df .getOWLObjectHasValue (role , ind );
674677 refinements .add (ovr );
675- if (useObjectValueNegation ){
676- refinements .add (df .getOWLObjectComplementOf (ovr ));
678+ // rule 4b : EXISTS r.TOP => EXISTS r.not {value}
679+ if (useObjectValueNegation ) {
680+ if (maxLength > OWLClassExpressionUtils .getLength (description , lengthMetric )) {
681+ refinements .add (df .getOWLObjectSomeValuesFrom (role , df .getOWLObjectComplementOf (df .getOWLObjectOneOf (ind ))));
682+ }
677683 }
678-
679684 }
680685 }
681686 }
0 commit comments