diff --git a/src/de/dfki/mycbr/core/Project.java b/src/de/dfki/mycbr/core/Project.java index 68b2b251c555667741d53bf4751035f0282def2e..5d6c787d3729e229aef000eca99f23457f0505c6 100644 --- a/src/de/dfki/mycbr/core/Project.java +++ b/src/de/dfki/mycbr/core/Project.java @@ -49,6 +49,7 @@ import de.dfki.mycbr.core.model.Concept; import de.dfki.mycbr.core.model.ConceptDesc; import de.dfki.mycbr.core.model.SpecialDesc; import de.dfki.mycbr.core.model.SymbolDesc; +import de.dfki.mycbr.core.rulebase.Rulebase; import de.dfki.mycbr.core.similarity.AmalgamationFct; import de.dfki.mycbr.core.similarity.ISimFct; import de.dfki.mycbr.core.similarity.Similarity; @@ -72,7 +73,7 @@ import de.dfki.mycbr.io.XMLImporter; * */ public final class Project extends Concept { - + /** * Maps the case bases for this project to their name. */ @@ -146,7 +147,10 @@ public final class Project extends Concept { * */ private XMLImporter importer; - + /** + * contains the ruleBase for this project. + */ + private Rulebase rulebase; /** * Default constructor. Initializes the containers for top concepts and case * bases @@ -158,10 +162,11 @@ public final class Project extends Concept { initSVDesc(); subConcepts = new HashMap(); caseBases = new HashMap(); - + setRulebase(new Rulebase(this)); explanationManager = new ExplanationManager(); this.prj = this; initFcts(); + rulebase = new Rulebase(this); } /** @@ -211,6 +216,7 @@ public final class Project extends Concept { } else { // try loading new project load(); } + rulebase = new Rulebase(this); } /** @@ -600,7 +606,20 @@ public final class Project extends Concept { public SpecialDesc getSpecialValueDesc() { return specialValueDesc; } - + /** + * @return the ruleBase of this project + */ + public Rulebase getRulebase() { + return rulebase; + } + /** + * + * @param Rulebase + * rulebase to set + */ + public void setRulebase(Rulebase rulebase) { + this.rulebase = rulebase; + } /** * * @param obj the string which is checked @@ -997,4 +1016,6 @@ public final class Project extends Concept { } return allInstForConcept; } + + } diff --git a/src/de/dfki/mycbr/core/rulebase/Conclusion.java b/src/de/dfki/mycbr/core/rulebase/Conclusion.java new file mode 100644 index 0000000000000000000000000000000000000000..c81b96093c846c61d41e8630eb9af90497e575f0 --- /dev/null +++ b/src/de/dfki/mycbr/core/rulebase/Conclusion.java @@ -0,0 +1,28 @@ +package de.dfki.mycbr.core.rulebase; + +public class Conclusion { + String left,symbol, right; + public Conclusion(String a, String b, String c){ + this.left = a; + this.symbol = b; + this.right = c; + } + public String getLeft() { + return left; + } + public void setLeft(String left) { + this.left = left; + } + public String getSymbol() { + return symbol; + } + public void setSymbol(String symbol) { + this.symbol = symbol; + } + public String getRight() { + return right; + } + public void setRight(String right) { + this.right = right; + } + } diff --git a/src/de/dfki/mycbr/core/rulebase/Condition.java b/src/de/dfki/mycbr/core/rulebase/Condition.java new file mode 100644 index 0000000000000000000000000000000000000000..44947de13dd8e56fc15c7abf639fab918a06c634 --- /dev/null +++ b/src/de/dfki/mycbr/core/rulebase/Condition.java @@ -0,0 +1,40 @@ +package de.dfki.mycbr.core.rulebase; + +import de.dfki.mycbr.core.model.AttributeDesc; + +public class Condition { +String link,left,symbol, right; +public Condition(String initLink,String a, String b, String c ){ + this.left = a; + this.symbol = b; + this.right = c; + this.link = initLink; +} + + +public String getLink() { + return link; +} +public void setLink(String link) { + this.link = link; +} +public String getLeft() { + return left; +} +public void setLeft(String left) { + this.left = left; +} +public String getSymbol() { + return symbol; +} +public void setSymbol(String symbol) { + this.symbol = symbol; +} +public String getRight() { + return right; +} +public void setRight(String right) { + this.right = right; +} + +} diff --git a/src/de/dfki/mycbr/core/rulebase/Rule.java b/src/de/dfki/mycbr/core/rulebase/Rule.java new file mode 100644 index 0000000000000000000000000000000000000000..1b367d02e64d020a91825f8e293bdc749d93d799 --- /dev/null +++ b/src/de/dfki/mycbr/core/rulebase/Rule.java @@ -0,0 +1,65 @@ + /** + * + */ +package de.dfki.mycbr.core.rulebase; + +import java.util.ArrayList; + +import de.dfki.mycbr.core.Project; +import de.dfki.mycbr.core.model.AttributeDesc; + +/** + * @author carstenwenzel + * + * auswahl zu welchen konzept + */ +public class Rule { + private String name; + private ArrayList casebase; + private ArrayList preconditiones; + private ArrayList conditiones; + private ArrayList conclusion; + + public ArrayList getCasebase() { + return casebase; + } + public void setCasebase(ArrayList casebase) { + this.casebase = casebase; + } + public ArrayList getConditiones() { + return conditiones; + } + public void setConditiones(ArrayList conditiones) { + this.conditiones = conditiones; + } + public ArrayList getConclusion() { + return conclusion; + } + public void setConclusion(ArrayList conclusion) { + this.conclusion = conclusion; + } + + public Rule(Project p,String initName) throws Exception { + this.name = initName; + this.casebase = new ArrayList(); + this.preconditiones = new ArrayList(); + this.conditiones = new ArrayList(); + this.conditiones.add(new Condition("","bitte Auswaehlen","bitte Auswaehlen", "bitte Auswaehlen")); + this.conclusion = new ArrayList(); + this.conclusion.add(new Conclusion("bitte Auswaehlen","=", "bitte Auswaehlen")); + } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public ArrayList getPreconditiones() { + return preconditiones; + } + public void setPreconditiones(ArrayList preconditiones) { + this.preconditiones = preconditiones; + } + + } diff --git a/src/de/dfki/mycbr/core/rulebase/Rulebase.java b/src/de/dfki/mycbr/core/rulebase/Rulebase.java new file mode 100644 index 0000000000000000000000000000000000000000..c25129c0cad93669d3ceb85d7572811b80f51c4e --- /dev/null +++ b/src/de/dfki/mycbr/core/rulebase/Rulebase.java @@ -0,0 +1,81 @@ +/** + * + */ +package de.dfki.mycbr.core.rulebase; + +import java.util.ArrayList; +import java.util.HashMap; + +import de.dfki.mycbr.core.Project; + +/** + * @author carstenwenzel + * + */ +public class Rulebase { + private Project prj; + private String rule; + private HashMap> ruleBase; + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } + public HashMap> getRuleBase() { + return ruleBase; + } + + public void setRuleBase(HashMap> ruleBase) { + this.ruleBase = ruleBase; + } + public Rulebase(Project p){ + this.prj = p; + ruleBase = new HashMap>(); + + + + ArrayList locL1 = new ArrayList(); + ArrayList locL2 = new ArrayList(); + ruleBase.put("completion", locL1); + ruleBase.put("adaption", locL2); + rule = "test Rule1"; + } + + public Boolean checkRB(String rulebase, String ruleName) { + Boolean locBool = false; + ArrayList locRules = ruleBase.get(rulebase); + for (Rule rule : locRules) { + if (rule.getName().equals(ruleName)) { + locBool = true; + } + } + return locBool; + } + + public void removeRule(String rulebase, String ruleName) { + ArrayList locRules = ruleBase.get(rulebase); + Rule locRule = null; + for (Rule rule : locRules) { + if (rule.getName().equals(ruleName)) { + locRule = rule; + } + + } + if (locRule != null) + + { + locRules.remove(locRule); + } + } + + public Project getPrj() { + return prj; + } + + public void setPrj(Project prj) { + this.prj = prj; + } + +}