From: <lor...@us...> - 2009-04-09 16:36:51
|
Revision: 1694 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1694&view=rev Author: lorenz_b Date: 2009-04-09 16:36:41 +0000 (Thu, 09 Apr 2009) Log Message: ----------- renamed Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java Copied: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java (from rev 1680, trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java 2009-04-09 16:36:41 UTC (rev 1694) @@ -0,0 +1,115 @@ + + +package org.dllearner.tools.ore.explanation; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataRange; +import org.semanticweb.owl.model.OWLDataValueRestriction; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; +import org.semanticweb.owl.model.OWLObjectUnionOf; + + + +public class Beta extends BaseDescriptionGenerator +{ + + public Beta(OWLDataFactory factory) + { + super(factory); + } + + public Set<OWLDescription> visit(OWLClass desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(3); + descs.add(desc); + descs.add(getDataFactory().getOWLNothing()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectComplementOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription d : computeTau(desc.getOperand())){ + descs.add(getDataFactory().getOWLObjectComplementOf(d)); + } + + return descs; + } + + protected Set<OWLDescription> compute(OWLDescription description) + { + return computeBeta(description); + } + + public Set<OWLDescription> visit(OWLObjectMaxCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeTau(desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + for(int n = desc.getCardinality(); n > 0; n--) + { + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), n, filler)); + } + } + + result.add(getLimit()); + return result; + } + + public Set<OWLDescription> visit(OWLObjectExactCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeBeta((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectExactCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + result.add(getLimit()); + return result; + } + + public Set<OWLDescription> visit(OWLObjectUnionOf desc) + { + return super.visit(desc); + } + + public Set<OWLDescription> visit(OWLObjectMinCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeBeta((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + result.add(getLimit()); + return result; + } + + protected OWLClass getLimit() + { + return getDataFactory().getOWLNothing(); + } + + protected OWLDataRange getDataLimit() + { + return getDataFactory().getOWLDataComplementOf(getDataFactory().getTopDataType()); + } + + public Set<OWLDescription> visit(OWLDataValueRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java (from rev 1680, trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java 2009-04-09 16:36:41 UTC (rev 1694) @@ -0,0 +1,82 @@ + +package org.dllearner.tools.ore.explanation; + +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataRange; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; + + +public class Tau extends BaseDescriptionGenerator +{ + + public Tau(OWLDataFactory factory) + { + super(factory); + } + + public Set<OWLDescription> visit(OWLClass desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + descs.add(desc); + descs.add(getDataFactory().getOWLThing()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectComplementOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription d : computeBeta(desc.getOperand())){ + descs.add(getDataFactory().getOWLObjectComplementOf(d)); + } + return descs; + } + + public Set<OWLDescription> visit(OWLObjectMaxCardinalityRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription filler : computeBeta(desc.getFiller())){ + descs.add(getDataFactory().getOWLObjectMaxCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectMinCardinalityRestriction desc) + { + Set<OWLDescription> weakenedFillers = computeTau((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + for(int n = desc.getCardinality(); n > 0; n--) + { + + for(OWLDescription filler : weakenedFillers ){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), n, filler)); + } + + } + + result.add(getLimit()); + return result; + } + + protected OWLClass getLimit() + { + return getDataFactory().getOWLThing(); + } + + protected OWLDataRange getDataLimit() + { + return getDataFactory().getTopDataType(); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |