diff --git a/src/main/java/ru/ulstu/fc/config/FuzzyEngine.java b/src/main/java/ru/ulstu/fc/config/FuzzyEngine.java new file mode 100644 index 0000000..15b1e76 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/config/FuzzyEngine.java @@ -0,0 +1,16 @@ +package ru.ulstu.fc.config; + +import com.fuzzylite.Engine; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class FuzzyEngine { + @Bean + public Engine getFuzzyEngine() { + Engine engine = new Engine(); + engine.setName("Fuzzy rules"); + engine.setDescription(""); + return engine; + } +} diff --git a/src/main/java/ru/ulstu/fc/core/BaseEntity.java b/src/main/java/ru/ulstu/fc/core/BaseEntity.java new file mode 100644 index 0000000..55542dc --- /dev/null +++ b/src/main/java/ru/ulstu/fc/core/BaseEntity.java @@ -0,0 +1,86 @@ +package ru.ulstu.fc.core; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import javax.persistence.Version; +import java.io.Serializable; + +@MappedSuperclass +public abstract class BaseEntity implements Serializable, Comparable { + @Id + @GeneratedValue(strategy = GenerationType.TABLE) + private Integer id; + + @Version + private Integer version; + + public BaseEntity() { + } + + public BaseEntity(Integer id, Integer version) { + this.id = id; + this.version = version; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getVersion() { + return version; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!getClass().isAssignableFrom(obj.getClass())) { + return false; + } + BaseEntity other = (BaseEntity) obj; + if (id == null) { + if (other.getId() != null) { + return false; + } + } else if (!id.equals(other.getId())) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (id == null ? 0 : id.hashCode()); + return result; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "{" + + "id=" + id + + ", version=" + version + + '}'; + } + + @Override + public int compareTo(BaseEntity o) { + return id != null ? id.compareTo(o.getId()) : -1; + } + + public void reset() { + this.id = null; + this.version = null; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java b/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java new file mode 100644 index 0000000..628a315 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java @@ -0,0 +1,96 @@ +package ru.ulstu.fc.rule.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import ru.ulstu.fc.rule.model.AddRuleForm; +import ru.ulstu.fc.rule.model.AddTermForm; +import ru.ulstu.fc.rule.model.AddVariableForm; +import ru.ulstu.fc.rule.service.RuleParseService; +import ru.ulstu.fc.rule.service.RuleService; +import ru.ulstu.fc.rule.service.TermsService; +import ru.ulstu.fc.rule.service.VariableService; + +import java.util.List; + +@Controller +public class RuleController { + private final RuleParseService ruleParseService; + private final RuleService ruleService; + private final TermsService termService; + private final VariableService variableService; + + public RuleController(RuleParseService ruleParseService, + RuleService ruleService, + TermsService termService, + VariableService variableService) { + this.ruleParseService = ruleParseService; + this.ruleService = ruleService; + this.termService = termService; + this.variableService = variableService; + } + + @GetMapping("listRules") + public String listRules(Model model) { + model.addAttribute("rules", ruleService.getRules()); + return "listRules"; + } + + @GetMapping("listTerms") + public String listTerms(Model model) { + model.addAttribute("terms", termService.getTerms()); + return "listTerms"; + } + + @GetMapping("listVars") + public String listVariables(Model model) { + model.addAttribute("vars", variableService.getVars()); + return "listVars"; + } + + @GetMapping("addRule") + public String addRule(Model model) { + model.addAttribute("addRuleForm", new AddRuleForm()); + return "addRule"; + } + + @PostMapping("addRule") + public String parse(@ModelAttribute AddRuleForm addRuleForm, Model model) { + try { + System.out.println(ruleParseService.parseRules(List.of(addRuleForm.getRule()))); + } catch (Exception ex) { + return "addRule"; + } + model.addAttribute("addRuleForm", addRuleForm); + return "listRules"; + } + + @GetMapping("addVariable") + public String addVariable(Model model, @RequestParam(required = false) Integer id) { + model.addAttribute("addVariableForm", variableService.getAddVariableFormOrDefault(id)); + return "addVariable"; + } + + @PostMapping("addVariable") + public String addVariable(@ModelAttribute AddVariableForm addVariableForm, Model model) { + model.addAttribute("addVariableForm", addVariableForm); + variableService.save(addVariableForm); + model.addAttribute("vars", variableService.getVars()); + return "listVars"; + } + + @GetMapping("addTerm") + public String addTerm(Model model) { + model.addAttribute("addTermForm", new AddTermForm()); + return "addTerm"; + } + + @PostMapping("addTerm") + public String addTerm(@ModelAttribute AddTermForm addTermForm, Model model) { + model.addAttribute("addTermForm", addTermForm); + return "listTerms"; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/AddRuleForm.java b/src/main/java/ru/ulstu/fc/rule/model/AddRuleForm.java new file mode 100644 index 0000000..4ddac74 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/AddRuleForm.java @@ -0,0 +1,13 @@ +package ru.ulstu.fc.rule.model; + +public class AddRuleForm { + private String rule; + + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java b/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java new file mode 100644 index 0000000..28924d5 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java @@ -0,0 +1,40 @@ +package ru.ulstu.fc.rule.model; + +public class AddTermForm { + private String variable; + private String term; + private String min; + private String max; + + public String getVariable() { + return variable; + } + + public void setVariable(String variable) { + this.variable = variable; + } + + public String getTerm() { + return term; + } + + public void setTerm(String term) { + this.term = term; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/AddVariableForm.java b/src/main/java/ru/ulstu/fc/rule/model/AddVariableForm.java new file mode 100644 index 0000000..b6e5619 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/AddVariableForm.java @@ -0,0 +1,31 @@ +package ru.ulstu.fc.rule.model; + +public class AddVariableForm { + private Integer id; + private String name; + + public AddVariableForm(Variable variable) { + this.id = variable.getId(); + this.name = variable.getName(); + } + + public AddVariableForm() { + + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/Rule.java b/src/main/java/ru/ulstu/fc/rule/model/Rule.java new file mode 100644 index 0000000..22c3b3a --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/Rule.java @@ -0,0 +1,18 @@ +package ru.ulstu.fc.rule.model; + +import ru.ulstu.fc.core.BaseEntity; + +import javax.persistence.Entity; + +@Entity +public class Rule extends BaseEntity { + private String value; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/Term.java b/src/main/java/ru/ulstu/fc/rule/model/Term.java new file mode 100644 index 0000000..6b7b917 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/Term.java @@ -0,0 +1,45 @@ +package ru.ulstu.fc.rule.model; + +import ru.ulstu.fc.core.BaseEntity; + +import javax.persistence.Entity; + +@Entity +public class Term extends BaseEntity { + private String name; + private double min; + private double max; + + public Term() { + } + + public Term(String name, double min, double max) { + this.name = name; + this.min = min; + this.max = max; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getMin() { + return min; + } + + public void setMin(double min) { + this.min = min; + } + + public double getMax() { + return max; + } + + public void setMax(double max) { + this.max = max; + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/model/Variable.java b/src/main/java/ru/ulstu/fc/rule/model/Variable.java index ebbc115..265e189 100644 --- a/src/main/java/ru/ulstu/fc/rule/model/Variable.java +++ b/src/main/java/ru/ulstu/fc/rule/model/Variable.java @@ -1,24 +1,42 @@ package ru.ulstu.fc.rule.model; +import ru.ulstu.fc.core.BaseEntity; + +import javax.persistence.Entity; +import javax.persistence.OneToMany; import java.util.List; -public class Variable { +@Entity +public class Variable extends BaseEntity { private String name; - private List values; + @OneToMany + private List terms; public Variable() { } - public Variable(String name, List values) { + public Variable(String name) { this.name = name; - this.values = values; + } + + public Variable(String name, List terms) { + this.name = name; + this.terms = terms; } public String getName() { return name; } - public List getValues() { - return values; + public void setName(String name) { + this.name = name; } -} + + public List getTerms() { + return terms; + } + + public void setTerms(List terms) { + this.terms = terms; + } +} \ No newline at end of file diff --git a/src/main/java/ru/ulstu/fc/rule/repository/RuleRepository.java b/src/main/java/ru/ulstu/fc/rule/repository/RuleRepository.java new file mode 100644 index 0000000..eeac0e9 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/repository/RuleRepository.java @@ -0,0 +1,7 @@ +package ru.ulstu.fc.rule.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.fc.rule.model.Rule; + +public interface RuleRepository extends JpaRepository { +} diff --git a/src/main/java/ru/ulstu/fc/rule/repository/TermRepository.java b/src/main/java/ru/ulstu/fc/rule/repository/TermRepository.java new file mode 100644 index 0000000..00efd09 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/repository/TermRepository.java @@ -0,0 +1,7 @@ +package ru.ulstu.fc.rule.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.fc.rule.model.Term; + +public interface TermRepository extends JpaRepository { +} diff --git a/src/main/java/ru/ulstu/fc/rule/repository/VariableRepository.java b/src/main/java/ru/ulstu/fc/rule/repository/VariableRepository.java new file mode 100644 index 0000000..29d1231 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/repository/VariableRepository.java @@ -0,0 +1,7 @@ +package ru.ulstu.fc.rule.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.fc.rule.model.Variable; + +public interface VariableRepository extends JpaRepository { +} diff --git a/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java b/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java index 5f1b72c..17257e4 100644 --- a/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java +++ b/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java @@ -15,8 +15,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import ru.ulstu.fc.rule.model.OutputValue; +import ru.ulstu.fc.rule.model.Term; import ru.ulstu.fc.rule.model.Variable; -import ru.ulstu.fc.rule.model.VariableValue; import java.util.List; import java.util.Map; @@ -30,14 +30,17 @@ public class FuzzyInferenceService { + OUTPUT_VARIABLE_NAME + " is %s"; private final static String NO_RESULT = "Нет результата"; + private final Engine fuzzyEngine; + + public FuzzyInferenceService(Engine fuzzyEngine) { + this.fuzzyEngine = fuzzyEngine; + } private List getDemoRules() { return List.of( - String.format(RULE_TEMPLATE, "возраст", "молодой", "доход", "высокий", "большой"), - String.format(RULE_TEMPLATE, "возраст", "средний", "доход", "высокий", "средний"), - String.format(RULE_TEMPLATE, "возраст", "старый", "доход", "высокий", "средний"), - String.format(RULE_TEMPLATE, "возраст", "старый", "доход", "небольшой", "небольшой"), - String.format(RULE_TEMPLATE, "возраст", "молодой", "доход", "небольшой", "небольшой") + String.format(RULE_TEMPLATE, "возраст", "молодой", "доход", "высокий", "средний"), + String.format(RULE_TEMPLATE, "возраст", "средний", "доход", "высокий", "большой"), + String.format(RULE_TEMPLATE, "возраст", "старый", "доход", "средний", "средний") ); } @@ -45,16 +48,13 @@ public class FuzzyInferenceService { final InputVariable input = new InputVariable(); input.setName(variable.getName()); input.setDescription(""); - input.setRange(0, variable.getValues().get(variable.getValues().size() - 1).getValue()); + input.setRange(0, variable.getTerms().get(variable.getTerms().size() - 1).getMax()); input.setEnabled(true); input.setLockValueInRange(false); - double prev = 0; - for (int i = 0; i < variable.getValues().size(); i++) { - Triangle term = new Triangle(variable.getValues().get(i).getFuzzyTerm(), - prev, - variable.getValues().get(i).getValue(), - variable.getValues().get(i).getValue() + variable.getValues().get(i).getValue() - prev); - prev = term.getVertexB(); + for (int i = 0; i < variable.getTerms().size(); i++) { + Triangle term = new Triangle(variable.getTerms().get(i).getName(), + variable.getTerms().get(i).getMin(), + variable.getTerms().get(i).getMax()); input.addTerm(term); } return input; @@ -64,20 +64,16 @@ public class FuzzyInferenceService { final OutputVariable output = new OutputVariable(); output.setName(variable.getName()); output.setDescription(""); - output.setRange(0, variable.getValues().get(variable.getValues().size() - 1).getValue()); + output.setRange(0, variable.getTerms().get(variable.getTerms().size() - 1).getMax()); output.setEnabled(true); output.setAggregation(new Maximum()); output.setDefuzzifier(new WeightedAverage()); output.setDefaultValue(Double.NaN); output.setLockValueInRange(false); - double prev = 0; - for (int i = 0; i < variable.getValues().size(); i++) { - Triangle term = new Triangle( - variable.getValues().get(i).getFuzzyTerm(), - prev, - variable.getValues().get(i).getValue(), - variable.getValues().get(i).getValue() + variable.getValues().get(i).getValue() - prev); - prev = term.getVertexB(); + for (int i = 0; i < variable.getTerms().size(); i++) { + Triangle term = new Triangle(variable.getTerms().get(i).getName(), + variable.getTerms().get(i).getMin(), + variable.getTerms().get(i).getMax()); output.addTerm(term); } return output; @@ -101,13 +97,6 @@ public class FuzzyInferenceService { return mamdani; } - private Engine getFuzzyEngine() { - Engine engine = new Engine(); - engine.setName("Fuzzy rules"); - engine.setDescription(""); - return engine; - } - private List getConsequent(Engine engine, Map variableValues) { OutputVariable outputVariable = engine.getOutputVariable(OUTPUT_VARIABLE_NAME); for (Map.Entry variableValue : variableValues.entrySet()) { @@ -130,20 +119,21 @@ public class FuzzyInferenceService { public List getFuzzyInference(Map vals) { return getFuzzyInference(getDemoRules(), vals, List.of(new Variable("возраст", List.of( - new VariableValue("молодой", 35.0), - new VariableValue("средний", 60.0), - new VariableValue("старый", 100.0)) + new Term("молодой", 0.0, 40.0), + new Term("средний", 20.0, 60.0), + new Term("старый", 50.0, 100.0)) ), new Variable("доход", List.of( - new VariableValue("небольшой", 35000.0), - new VariableValue("средний", 100000.0), - new VariableValue("высокий", 500000.0)) + new Term("небольшой", 0.0, 35000.0), + new Term("средний", 20000.0, 100000.0), + new Term("высокий", 80000.0, 500000.0)) ) ), new Variable("кредит", List.of( - new VariableValue("небольшой", 20000.0), - new VariableValue("средний", 100000.0), - new VariableValue("большой", 1000000.0))) + new Term("не_выдавать_кредит", 0.0, 1.0), + new Term("небольшой", 1.0, 50000.0), + new Term("средний", 25000.0, 100000.0), + new Term("большой", 75000.0, 1000000.0))) ); } @@ -151,8 +141,8 @@ public class FuzzyInferenceService { Map values, List inputVariables, Variable outputVariable) { - Engine engine = getFuzzyEngine(); - engine.addRuleBlock(getRuleBlock(engine, rules, inputVariables, outputVariable)); - return getConsequent(engine, values); + fuzzyEngine.getRuleBlocks().clear(); + fuzzyEngine.addRuleBlock(getRuleBlock(fuzzyEngine, rules, inputVariables, outputVariable)); + return getConsequent(fuzzyEngine, values); } } diff --git a/src/main/java/ru/ulstu/fc/rule/service/RuleParseService.java b/src/main/java/ru/ulstu/fc/rule/service/RuleParseService.java new file mode 100644 index 0000000..7461a17 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/service/RuleParseService.java @@ -0,0 +1,44 @@ +package ru.ulstu.fc.rule.service; + +import com.fuzzylite.Engine; +import com.fuzzylite.rule.Rule; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class RuleParseService { + private final static String RU_IF_STATEMENT = "если"; + private final static String ENG_IF_STATEMENT = "if"; + private final static String RU_THEN_STATEMENT = "то"; + private final static String ENG_THEN_STATEMENT = "then"; + private final static String RU_AND_STATEMENT = "и"; + private final static String ENG_AND_STATEMENT = "and"; + private final static String RU_IS_STATEMENT = "является"; + private final static String RU_EQ_STATEMENT = "равно"; + private final static String ENG_IS_STATEMENT = "is"; + + private final Engine fuzzyEngine; + + public RuleParseService(Engine fuzzyEngine) { + this.fuzzyEngine = fuzzyEngine; + } + + public List parseRules(List stringRules) { + return stringRules + .stream() + .map(s -> Rule.parse(replaceEnglishKeywords(s), fuzzyEngine)) + .collect(Collectors.toList()); + } + + private String replaceEnglishKeywords(String stringRule) { + stringRule = stringRule.toLowerCase(); + return stringRule + .replaceFirst(RU_IF_STATEMENT, ENG_IF_STATEMENT) + .replaceFirst(RU_AND_STATEMENT, ENG_AND_STATEMENT) + .replaceFirst(RU_IS_STATEMENT, ENG_IS_STATEMENT) + .replaceFirst(RU_EQ_STATEMENT, ENG_IS_STATEMENT) + .replaceAll(RU_THEN_STATEMENT, ENG_THEN_STATEMENT); + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/service/RuleService.java b/src/main/java/ru/ulstu/fc/rule/service/RuleService.java new file mode 100644 index 0000000..0969087 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/service/RuleService.java @@ -0,0 +1,20 @@ +package ru.ulstu.fc.rule.service; + +import org.springframework.stereotype.Service; +import ru.ulstu.fc.rule.model.Rule; +import ru.ulstu.fc.rule.repository.RuleRepository; + +import java.util.List; + +@Service +public class RuleService { + private final RuleRepository ruleRepository; + + public RuleService(RuleRepository ruleRepository) { + this.ruleRepository = ruleRepository; + } + + public List getRules() { + return ruleRepository.findAll(); + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/service/TermService.java b/src/main/java/ru/ulstu/fc/rule/service/TermService.java new file mode 100644 index 0000000..a475aab --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/service/TermService.java @@ -0,0 +1,20 @@ +package ru.ulstu.fc.rule.service; + +import org.springframework.stereotype.Service; +import ru.ulstu.fc.rule.model.Term; +import ru.ulstu.fc.rule.repository.TermRepository; + +import java.util.List; + +@Service +public class TermService { + private final TermRepository termRepository; + + public TermService(TermRepository termRepository) { + this.termRepository = termRepository; + } + + public List getTerms() { + return termRepository.findAll(); + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/service/TermsService.java b/src/main/java/ru/ulstu/fc/rule/service/TermsService.java new file mode 100644 index 0000000..273e0fa --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/service/TermsService.java @@ -0,0 +1,20 @@ +package ru.ulstu.fc.rule.service; + +import org.springframework.stereotype.Service; +import ru.ulstu.fc.rule.model.Term; +import ru.ulstu.fc.rule.repository.TermRepository; + +import java.util.List; + +@Service +public class TermsService { + private final TermRepository termRepository; + + public TermsService(TermRepository termRepository) { + this.termRepository = termRepository; + } + + public List getTerms() { + return termRepository.findAll(); + } +} diff --git a/src/main/java/ru/ulstu/fc/rule/service/VariableService.java b/src/main/java/ru/ulstu/fc/rule/service/VariableService.java new file mode 100644 index 0000000..7837533 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/service/VariableService.java @@ -0,0 +1,38 @@ +package ru.ulstu.fc.rule.service; + +import org.springframework.stereotype.Service; +import ru.ulstu.fc.rule.model.AddVariableForm; +import ru.ulstu.fc.rule.model.Variable; +import ru.ulstu.fc.rule.repository.VariableRepository; + +import java.util.List; + +@Service +public class VariableService { + private final VariableRepository variableRepository; + + public VariableService(VariableRepository variableRepository) { + this.variableRepository = variableRepository; + } + + + public List getVars() { + return variableRepository.findAll(); + } + + public void save(AddVariableForm addVariableForm) { + if (addVariableForm.getId() == null) { + variableRepository.save(new Variable(addVariableForm.getName())); + } else { + Variable dbVar = variableRepository.findById(addVariableForm.getId()).orElseThrow(() -> new RuntimeException("Variable not found by id")); + dbVar.setName(addVariableForm.getName()); + variableRepository.save(dbVar); + } + } + + public AddVariableForm getAddVariableFormOrDefault(Integer id) { + return id == null + ? new AddVariableForm() + : new AddVariableForm(variableRepository.findById(id).orElseThrow(() -> new RuntimeException("Var not foubd by id"))); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index da111f9..7c1eddc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -10,6 +10,7 @@ extractor.custom-projects-dir= server.error.include-stacktrace=always server.error.include-exception=true server.error.include-message=always +# go to http://localhost:8080/h2-console spring.datasource.url=jdbc:h2:file:./data/db spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa diff --git a/src/main/resources/templates/addRule.html b/src/main/resources/templates/addRule.html index 0abb1e8..8d407a4 100644 --- a/src/main/resources/templates/addRule.html +++ b/src/main/resources/templates/addRule.html @@ -3,79 +3,20 @@ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml" layout:decorate="~{default}"> - Простая обработка формы на Spring MVC + Добавить правило
-
- +
- Если -
-
- -
-
- имеет тенденцию -
-
- -
-
- и -
-
- -
-
- имеет тенденцию -
-
- -
-
- то: -
-
- +
+
-
- - +
diff --git a/src/main/resources/templates/addTerm.html b/src/main/resources/templates/addTerm.html new file mode 100644 index 0000000..bfb1cee --- /dev/null +++ b/src/main/resources/templates/addTerm.html @@ -0,0 +1,41 @@ + + + + Добавить терм + + +
+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ diff --git a/src/main/resources/templates/addVariable.html b/src/main/resources/templates/addVariable.html new file mode 100644 index 0000000..ec3ad83 --- /dev/null +++ b/src/main/resources/templates/addVariable.html @@ -0,0 +1,25 @@ + + + + Добавить переменную + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 9029445..eea7eff 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -21,12 +21,18 @@ diff --git a/src/main/resources/templates/listRules.html b/src/main/resources/templates/listRules.html index 49ad708..2b93617 100644 --- a/src/main/resources/templates/listRules.html +++ b/src/main/resources/templates/listRules.html @@ -3,7 +3,7 @@ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml" layout:decorate="~{default}"> - Простая обработка формы на Spring MVC + Список правил
diff --git a/src/main/resources/templates/listTerms.html b/src/main/resources/templates/listTerms.html new file mode 100644 index 0000000..d35960e --- /dev/null +++ b/src/main/resources/templates/listTerms.html @@ -0,0 +1,35 @@ + + + + Список термов + + +
+ + + + + + + + + + + + + +
Термы
+ + + + + + + +
+ Добавить терм +
+ diff --git a/src/main/resources/templates/listVars.html b/src/main/resources/templates/listVars.html new file mode 100644 index 0000000..90d97ab --- /dev/null +++ b/src/main/resources/templates/listVars.html @@ -0,0 +1,35 @@ + + + + Список переменных + + +
+ + + + + + + + + + + + + +
Переменные
+ + + + + + + +
+ Добавить переменную +
+