1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| package org.deri.wsmo4j.validator; |
17 |
| |
18 |
| |
19 |
| import java.util.*; |
20 |
| |
21 |
| import org.omwg.logicalexpression.*; |
22 |
| import org.omwg.ontology.*; |
23 |
| import org.wsmo.common.WSML; |
24 |
| import org.wsmo.common.exception.*; |
25 |
| import org.wsmo.factory.LogicalExpressionFactory; |
26 |
| import org.wsmo.validator.ValidationError; |
27 |
| import org.wsmo.validator.ValidationWarning; |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
| |
43 |
| public class WsmlFlightValidator |
44 |
| extends WsmlRuleValidator { |
45 |
| |
46 |
0
| public WsmlFlightValidator(LogicalExpressionFactory leFactory) {
|
47 |
0
| super(leFactory);
|
48 |
| } |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
0
| protected void visitAxiom(Axiom axiom) {
|
56 |
0
| WsmlFlightExpressionValidator flightExprVal = new WsmlFlightExpressionValidator(axiom, leFactory, errors, this);
|
57 |
0
| WsmlRuleExpressionValidator ruleExprVal = new WsmlRuleExpressionValidator(axiom, errors, this);
|
58 |
0
| WsmlFullExpressionValidator fullExprVal = new WsmlFullExpressionValidator(axiom, errors);
|
59 |
0
| FunctionSymbolHelper fsHelper = new FunctionSymbolHelper(
|
60 |
| axiom, errors, WSML.WSML_FLIGHT, this); |
61 |
0
| Iterator axioms = axiom.listDefinitions().iterator();
|
62 |
0
| while (axioms.hasNext()) {
|
63 |
0
| LogicalExpression le = (LogicalExpression) axioms.next();
|
64 |
0
| le.accept(fsHelper);
|
65 |
| |
66 |
0
| le.accept(fullExprVal);
|
67 |
0
| ruleExprVal.setup();
|
68 |
0
| le.accept(ruleExprVal);
|
69 |
0
| flightExprVal.setup();
|
70 |
0
| le.accept(flightExprVal);
|
71 |
| } |
72 |
| } |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
0
| protected void visitConcept(Concept concept) {
|
80 |
0
| super.visitConcept(concept);
|
81 |
| } |
82 |
| |
83 |
| |
84 |
| |
85 |
| |
86 |
| |
87 |
| |
88 |
0
| protected void visitInstance(Instance instance) {
|
89 |
0
| super.visitInstance(instance);
|
90 |
| } |
91 |
| |
92 |
| |
93 |
| |
94 |
| |
95 |
| |
96 |
| |
97 |
0
| protected void visitRelation(Relation relation) {
|
98 |
0
| super.visitRelation(relation);
|
99 |
| } |
100 |
| |
101 |
| |
102 |
| |
103 |
| |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
0
| protected void visitRelationInstance(RelationInstance relationInstance)
|
109 |
| throws SynchronisationException, InvalidModelException { |
110 |
0
| super.visitRelationInstance(relationInstance);
|
111 |
| } |
112 |
| |
113 |
0
| public boolean isValid(LogicalExpression logExpr, List <ValidationError> errorMessages, List <ValidationWarning> warningMessages) {
|
114 |
0
| super.isValid(logExpr, errorMessages, warningMessages);
|
115 |
0
| errors = errorMessages;
|
116 |
0
| warnings = warningMessages;
|
117 |
0
| WsmlFlightExpressionValidator flightExprVal = new WsmlFlightExpressionValidator(null, leFactory, errors, this);
|
118 |
0
| WsmlRuleExpressionValidator ruleExprVal = new WsmlRuleExpressionValidator(null, errors, this);
|
119 |
0
| WsmlFullExpressionValidator fullExprVal = new WsmlFullExpressionValidator(null, errors);
|
120 |
0
| FunctionSymbolHelper fsHelper = new FunctionSymbolHelper(
|
121 |
| null, errors, WSML.WSML_FLIGHT, this); |
122 |
| |
123 |
0
| logExpr.accept(fsHelper);
|
124 |
0
| logExpr.accept(fullExprVal);
|
125 |
0
| ruleExprVal.setup();
|
126 |
0
| logExpr.accept(ruleExprVal);
|
127 |
0
| flightExprVal.setup();
|
128 |
0
| logExpr.accept(flightExprVal);
|
129 |
0
| return (errors.isEmpty());
|
130 |
| } |
131 |
| |
132 |
0
| public void setErrors(List <ValidationError> errors) {
|
133 |
0
| this.errors = errors;
|
134 |
| } |
135 |
| |
136 |
0
| public void setWarnings(List <ValidationWarning> warnings) {
|
137 |
0
| this.warnings = warnings;
|
138 |
| } |
139 |
| |
140 |
| } |