From: <jen...@us...> - 2008-12-21 12:30:16
|
Revision: 1560 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1560&view=rev Author: jenslehmann Date: 2008-12-21 12:30:08 +0000 (Sun, 21 Dec 2008) Log Message: ----------- - FastInstanceChecker: negation by failure added - ConceptTransformation: transformation of cardinality restrictions added Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-12-19 16:04:45 UTC (rev 1559) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-12-21 12:30:08 UTC (rev 1560) @@ -261,9 +261,14 @@ if (child instanceof NamedClass) { return classInstancesNeg.get((NamedClass) child).contains(individual); } else { - logger.debug("Converting description to negation normal form in fast instance check (should be avoided if possible)."); - Description nnf = ConceptTransformation.transformToNegationNormalForm(child); - return hasTypeImpl(nnf, individual); + // default negation + if(configurator.getDefaultNegation()) { + return !hasTypeImpl(child, individual); + } else { + logger.debug("Converting description to negation normal form in fast instance check (should be avoided if possible)."); + Description nnf = ConceptTransformation.transformToNegationNormalForm(child); + return hasTypeImpl(nnf, individual); + } // throw new ReasoningMethodUnsupportedException("Instance check for description " // + description // + " unsupported. Description needs to be in negation normal form."); Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-12-19 16:04:45 UTC (rev 1559) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-12-21 12:30:08 UTC (rev 1560) @@ -33,6 +33,9 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectCardinalityRestriction; +import org.dllearner.core.owl.ObjectMaxCardinalityRestriction; +import org.dllearner.core.owl.ObjectMinCardinalityRestriction; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Intersection; @@ -161,6 +164,21 @@ // All else return new ObjectSomeRestriction(r,transformToNegationNormalForm(c)); + } else if(child instanceof ObjectCardinalityRestriction) { + ObjectCardinalityRestriction card = (ObjectCardinalityRestriction)child; + ObjectPropertyExpression r = card.getRole(); + int number = card.getCardinality(); + // Negation nach innen + Description c = new Negation(child.getChild(0)); + // <= n is transformed to >= n+1 + if(child instanceof ObjectMaxCardinalityRestriction) + return new ObjectMinCardinalityRestriction(number+1,r,transformToNegationNormalForm(c)); + // >= n is transformed to <= n-1 + else if(child instanceof ObjectMinCardinalityRestriction) + return new ObjectMinCardinalityRestriction(number+1,r,transformToNegationNormalForm(c)); + // >= n is transformed to <= n-1 + else + throw new RuntimeException("Conversion to negation normal form not supported for " + concept); } else if(child instanceof Intersection) { // wg. Negation wird Konjunktion zu Disjunktion Union md = new Union(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |