From: <sha...@us...> - 2011-08-24 11:17:39
|
Revision: 3111 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3111&view=rev Author: shadowtm Date: 2011-08-24 11:17:33 +0000 (Wed, 24 Aug 2011) Log Message: ----------- Added back forAllSemantics option to fast instance checker. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-08-24 11:12:08 UTC (rev 3110) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-08-24 11:17:33 UTC (rev 3111) @@ -67,6 +67,7 @@ import org.dllearner.parser.ParseException; import org.dllearner.utilities.Helper; import org.dllearner.utilities.owl.ConceptTransformation; +import org.springframework.beans.propertyeditors.StringTrimmerEditor; import sun.beans.editors.BoolEditor; /** @@ -127,6 +128,12 @@ @ConfigOption(name="defaultNegation", description = "Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.", defaultValue = "true", required = false, propertyEditorClass = BoolEditor.class) private boolean defaultNegation = true; + @ConfigOption(name = "forAllRetrievalSemantics", description = "This option controls how to interpret the all quantifier in forall r.C. The standard option is" + + "to return all those which do not have an r-filler not in C. The domain semantics is to use those" + + "which are in the domain of r and do not have an r-filler not in C. The forallExists semantics is to"+ + "use those which have at least one r-filler and do not have an r-filler not in C.",defaultValue = "standard",propertyEditorClass = StringTrimmerEditor.class) + private String forAllSemantics; + /** * Creates an instance of the fast instance checker. */ @@ -1037,4 +1044,12 @@ public void setDefaultNegation(boolean defaultNegation) { this.defaultNegation = defaultNegation; } + + public String getForAllSemantics() { + return forAllSemantics; + } + + public void setForAllSemantics(String forAllSemantics) { + this.forAllSemantics = forAllSemantics; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2012-01-26 13:43:24
|
Revision: 3557 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3557&view=rev Author: lorenz_b Date: 2012-01-26 13:43:13 +0000 (Thu, 26 Jan 2012) Log Message: ----------- Added constructor to give some basic datastructures as arguments. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2012-01-25 13:31:24 UTC (rev 3556) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2012-01-26 13:43:13 UTC (rev 3557) @@ -20,6 +20,7 @@ package org.dllearner.reasoning; import java.io.File; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -143,7 +144,65 @@ public FastInstanceChecker() { } - public FastInstanceChecker(Set<AbstractKnowledgeSource> sources) { + public FastInstanceChecker(TreeSet<Individual> individuals, + Map<NamedClass, TreeSet<Individual>> classInstancesPos, + Map<ObjectProperty, Map<Individual, SortedSet<Individual>>> opPos, + Map<DatatypeProperty, Map<Individual, SortedSet<Integer>>> id, + Map<DatatypeProperty, TreeSet<Individual>> bdPos, + Map<DatatypeProperty, TreeSet<Individual>> bdNeg, + AbstractKnowledgeSource... sources) { + super(new HashSet<AbstractKnowledgeSource>(Arrays.asList(sources))); + this.individuals = individuals; + this.classInstancesPos = classInstancesPos; + this.opPos = opPos; + this.id = id; + this.bdPos = bdPos; + this.bdNeg = bdNeg; + + if(rc == null){ + rc = new OWLAPIReasoner(new HashSet<AbstractKnowledgeSource>(Arrays.asList(sources))); + try { + rc.init(); + } catch (ComponentInitException e) { + e.printStackTrace(); + } + } + + atomicConcepts = rc.getNamedClasses(); + datatypeProperties = rc.getDatatypeProperties(); + booleanDatatypeProperties = rc.getBooleanDatatypeProperties(); + doubleDatatypeProperties = rc.getDoubleDatatypeProperties(); + intDatatypeProperties = rc.getIntDatatypeProperties(); + stringDatatypeProperties = rc.getStringDatatypeProperties(); + atomicRoles = rc.getObjectProperties(); + + for (NamedClass atomicConcept : rc.getNamedClasses()) { + TreeSet<Individual> pos = classInstancesPos.get(atomicConcept); + if(pos != null){ + classInstancesNeg.put(atomicConcept, (TreeSet<Individual>) Helper.difference(individuals, pos)); + } else { + classInstancesPos.put(atomicConcept, new TreeSet<Individual>()); + classInstancesNeg.put(atomicConcept, individuals); + } + } + for(ObjectProperty p : atomicRoles){ + if(opPos.get(p) == null){ + opPos.put(p, new HashMap<Individual, SortedSet<Individual>>()); + } + } + + for (DatatypeProperty dp : booleanDatatypeProperties) { + if(bdPos.get(dp) == null){ + bdPos.put(dp, new TreeSet<Individual>()); + } + if(bdNeg.get(dp) == null){ + bdNeg.put(dp, new TreeSet<Individual>()); + } + + } + } + + public FastInstanceChecker(Set<AbstractKnowledgeSource> sources) { super(sources); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2013-06-13 10:28:13
|
Revision: 3994 http://sourceforge.net/p/dl-learner/code/3994 Author: jenslehmann Date: 2013-06-13 10:28:10 +0000 (Thu, 13 Jun 2013) Log Message: ----------- configurable semantics for all quantor in fast instance checker Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2013-06-13 07:46:18 UTC (rev 3993) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2013-06-13 10:28:10 UTC (rev 3994) @@ -137,8 +137,10 @@ "to return all those which do not have an r-filler not in C. The domain semantics is to use those" + "which are in the domain of r and do not have an r-filler not in C. The forallExists semantics is to"+ "use those which have at least one r-filler and do not have an r-filler not in C.",defaultValue = "standard",propertyEditorClass = StringTrimmerEditor.class) - private String forAllSemantics; + private ForallSemantics forallSemantics = ForallSemantics.Standard; + public enum ForallSemantics { Standard, SomeOnly } + /** * Creates an instance of the fast instance checker. */ @@ -400,7 +402,11 @@ } SortedSet<Individual> roleFillers = opPos.get(op).get(individual); if (roleFillers == null) { - return true; + if(forallSemantics == ForallSemantics.Standard) { + return true; + } else { + return false; + } } for (Individual roleFiller : roleFillers) { if (!hasTypeImpl(child, roleFiller)) { @@ -1124,11 +1130,13 @@ this.defaultNegation = defaultNegation; } - public String getForAllSemantics() { - return forAllSemantics; - } + public ForallSemantics getForAllSemantics() { + return forallSemantics; + } - public void setForAllSemantics(String forAllSemantics) { - this.forAllSemantics = forAllSemantics; - } + public void setForAllSemantics(ForallSemantics forallSemantics) { + this.forallSemantics = forallSemantics; + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |