diff options
Diffstat (limited to 'Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java')
-rw-r--r-- | Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java | 210 |
1 files changed, 106 insertions, 104 deletions
diff --git a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java index 7f19d2a8..2d866e85 100644 --- a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java +++ b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java | |||
@@ -1,111 +1,113 @@ | |||
1 | package crossingScenario.run; | 1 | package crossingScenario.run; |
2 | 2 | ||
3 | import java.util.ArrayList; | ||
4 | import java.util.HashMap; | ||
5 | import java.util.List; | ||
6 | import java.util.Map; | ||
7 | import java.util.regex.Matcher; | ||
8 | import java.util.regex.Pattern; | ||
9 | |||
10 | public class QueryDebug { | 3 | public class QueryDebug { |
11 | /* | 4 | |
12 | public static void main(String[] args) { | 5 | // public static void main(String[] args) { |
13 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); | 6 | // Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); |
14 | EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); | 7 | // EPackage.Registry.INSTANCE.put(CrossingScenarioPackage.eNS_URI, CrossingScenarioPackage.eINSTANCE); |
15 | ResourceSet rs = new ResourceSetImpl(); | 8 | // ResourceSet rs = new ResourceSetImpl(); |
16 | rs.getResource(URI.createFileURI("inputs/sample.xmi"), true); | 9 | // rs.getResource(URI.createFileURI("outputs/models/1.xmi"), true); |
17 | 10 | // | |
18 | ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); | 11 | // ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); |
19 | // Access pattern matcher | 12 | // // Access pattern matcher |
20 | 13 | // | |
21 | 14 | // | |
22 | 15 | // | |
23 | SimpleScenarioQueries.instance().prepare(engine); | 16 | // CrossingScenarioQueries.instance().prepare(engine); |
24 | RefSpec.Matcher matcher = RefSpec.Matcher.on(engine); | 17 | // Define_numWidth_medium.Matcher matcher = Define_numWidth_medium.Matcher.on(engine); |
25 | // Get and iterate over all matches | 18 | // // Get and iterate over all matches |
26 | for (RefSpec.Match match : matcher.getAllMatches()) { | 19 | // System.out.println("MATCHES:"); |
27 | // Print all the matches to the standard output | 20 | // for (Define_numWidth_medium.Match match : matcher.getAllMatches()) { |
28 | System.out.println(match.getL()); | 21 | // // Print all the matches to the standard output |
29 | } | 22 | // System.out.println(match.getL()); |
30 | } | 23 | // } |
31 | */ | 24 | // } |
25 | |||
32 | 26 | ||
33 | /* | 27 | // public static void main(String[] args) { |
34 | public static void main(String[] args) { | 28 | // //Add xmi resource |
35 | //Add xmi resource | 29 | // Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); |
36 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); | 30 | // //Add required EPackages |
37 | //Add required EPackages | 31 | //// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); |
38 | // EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); | 32 | // EPackage.Registry.INSTANCE.put(LogiclanguagePackage.eNS_URI, LogiclanguagePackage.eINSTANCE); |
39 | EPackage.Registry.INSTANCE.put(LogiclanguagePackage.eNS_URI, LogiclanguagePackage.eINSTANCE); | 33 | // EPackage.Registry.INSTANCE.put(LogicproblemPackage.eNS_URI, LogicproblemPackage.eINSTANCE); |
40 | EPackage.Registry.INSTANCE.put(LogicproblemPackage.eNS_URI, LogicproblemPackage.eINSTANCE); | 34 | // EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, PartialinterpretationPackage.eINSTANCE); |
41 | EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, PartialinterpretationPackage.eINSTANCE); | 35 | // EPackage.Registry.INSTANCE.put(Ecore2logicannotationsPackage.eNS_URI, Ecore2logicannotationsPackage.eINSTANCE); |
42 | EPackage.Registry.INSTANCE.put(Ecore2logicannotationsPackage.eNS_URI, Ecore2logicannotationsPackage.eINSTANCE); | 36 | // EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, Partial2logicannotationsPackage.eINSTANCE); |
43 | EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, Partial2logicannotationsPackage.eINSTANCE); | 37 | // EPackage.Registry.INSTANCE.put(Viatra2LogicAnnotationsPackage.eNS_URI, Viatra2LogicAnnotationsPackage.eINSTANCE); |
44 | EPackage.Registry.INSTANCE.put(Viatra2LogicAnnotationsPackage.eNS_URI, Viatra2LogicAnnotationsPackage.eINSTANCE); | 38 | // EPackage.Registry.INSTANCE.put(LogicresultPackage.eNS_URI, LogicresultPackage.eINSTANCE); |
45 | EPackage.Registry.INSTANCE.put(LogicresultPackage.eNS_URI, LogicresultPackage.eINSTANCE); | 39 | // |
46 | 40 | // //Get res | |
47 | //Get res | 41 | // ResourceSet rs = new ResourceSetImpl(); |
48 | ResourceSet rs = new ResourceSetImpl(); | 42 | // rs.getResource(URI.createFileURI("inputs/Debug/state000000019.xmi"), true); |
49 | rs.getResource(URI.createFileURI("inputs/partial-int.xmi"), true); | 43 | // |
50 | 44 | // ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); | |
51 | ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); | 45 | // // Access pattern matcher |
52 | // Access pattern matcher | 46 | // |
53 | 47 | // | |
54 | 48 | // | |
55 | 49 | // LogProb.instance().prepare(engine); | |
56 | LogProb.instance().prepare(engine); | 50 | // // Get and iterate over all matches |
57 | // Get and iterate over all matches | 51 | // System.out.println("UPMUST:"); |
58 | System.out.println("UPMUST:"); | 52 | // for (UPMUSTPropagateConstraint1_pattern_queries_define_numWidth_small1.Match match : |
59 | for (UPMUSTPropagateConstraint0_pattern_queries_refSpec.Match match : | 53 | // UPMUSTPropagateConstraint1_pattern_queries_define_numWidth_small1.Matcher.on(engine).getAllMatches()) { |
60 | UPMUSTPropagateConstraint0_pattern_queries_refSpec.Matcher.on(engine).getAllMatches()) { | 54 | // // Print all the matches to the standard output |
61 | // Print all the matches to the standard output | 55 | // System.out.println(match.getVar_l()); |
62 | System.out.println(match.getVar_l()); | 56 | // } |
63 | } | 57 | // |
64 | 58 | // System.out.println("mustIn1:"); | |
65 | System.out.println("mustIn:"); | 59 | // for (MustInRelationwidth_attribute_Lane.Match match : |
66 | for (MustInRelationreferenceCoord_attribute_Lane.Match match : | 60 | // MustInRelationwidth_attribute_Lane.Matcher.on(engine).getAllMatches()) { |
67 | MustInRelationreferenceCoord_attribute_Lane.Matcher.on(engine).getAllMatches()) { | 61 | // // Print all the matches to the standard output |
68 | // Print all the matches to the standard output | 62 | // DefinedElement de = match.getTarget(); |
69 | DefinedElement de = match.getTarget(); | 63 | // System.out.println(de); |
70 | System.out.println(de); | 64 | // System.out.println("--name?: " + de.getName()); |
71 | System.out.println("--set?: " + ((PrimitiveElement) de).isValueSet()); | 65 | //// System.out.println("--val?: " + de.getName()); |
72 | System.out.println("--val?: " + ((IntegerElement) de).getValue()); | 66 | // } |
73 | 67 | // | |
74 | } | 68 | // System.out.println("mustIn2:"); |
75 | 69 | // for (MustInRelationnumWidth_attribute_Lane.Match match : | |
76 | System.out.println("interp:"); | 70 | // MustInRelationnumWidth_attribute_Lane.Matcher.on(engine).getAllMatches()) { |
77 | for (Interpretation.Match match : | 71 | // // Print all the matches to the standard output |
78 | Interpretation.Matcher.on(engine).getAllMatches()) { | 72 | // DefinedElement de = match.getTarget(); |
79 | // Print all the matches to the standard output | 73 | // System.out.println(de); |
80 | System.out.println(match.getProblem()); | 74 | // System.out.println("--set?: " + ((PrimitiveElement) de).isValueSet()); |
81 | } | 75 | // System.out.println("--val?: " + ((RealElement) de).getValue()); |
82 | } | 76 | // } |
83 | */ | 77 | // |
78 | // System.out.println("interp:"); | ||
79 | // for (Interpretation.Match match : | ||
80 | // Interpretation.Matcher.on(engine).getAllMatches()) { | ||
81 | // // Print all the matches to the standard output | ||
82 | // System.out.println(match.getProblem()); | ||
83 | // } | ||
84 | // } | ||
84 | 85 | ||
85 | public static void main(String[] args) { | ||
86 | ArrayList<String> out = new ArrayList<String>(); | ||
87 | out.add("delta-sat with delta = 0.001"); | ||
88 | out.add("w1602659765 : [1.797693134862315708e+308, 1.797693134862315708e+308]"); | ||
89 | String s = "1.797693134862315708e+308"; | ||
90 | |||
91 | System.out.println(parseDrealOutput(out)); | ||
92 | |||
93 | } | ||
94 | 86 | ||
95 | private static Map<String, String> parseDrealOutput(List<String> output) { | 87 | // public static void main(String[] args) { |
96 | Map<String, String> res = new HashMap<String, String>(); | 88 | // ArrayList<String> out = new ArrayList<String>(); |
97 | String re = "(\\w+) : \\[([0-9\\+-.e]+), ([0-9\\+-.e]+)\\]"; | 89 | // out.add("delta-sat with delta = 0.001"); |
98 | // String re = "(\\w+) : \\[(.*), (.*)\\]"; | 90 | // out.add("w1602659765 : [1.797693134862315708e+308, 1.797693134862315708e+308]"); |
99 | Pattern p = Pattern.compile(re); | 91 | // String s = "1.797693134862315708e+308"; |
100 | for (String varVal : output) { | 92 | // |
101 | Matcher m = p.matcher(varVal); | 93 | // System.out.println(parseDrealOutput(out)); |
102 | if (m.matches()) { | 94 | // |
103 | String name = m.group(1); | 95 | // } |
104 | String lowerB = m.group(2); | 96 | // |
105 | String upperB = m.group(2); | 97 | // private static Map<String, String> parseDrealOutput(List<String> output) { |
106 | res.put(name, lowerB); | 98 | // Map<String, String> res = new HashMap<String, String>(); |
107 | } | 99 | // String re = "(\\w+) : \\[([0-9\\+-.e]+), ([0-9\\+-.e]+)\\]"; |
108 | } | 100 | //// String re = "(\\w+) : \\[(.*), (.*)\\]"; |
109 | return res; | 101 | // Pattern p = Pattern.compile(re); |
110 | } | 102 | // for (String varVal : output) { |
103 | // Matcher m = p.matcher(varVal); | ||
104 | // if (m.matches()) { | ||
105 | // String name = m.group(1); | ||
106 | // String lowerB = m.group(2); | ||
107 | // String upperB = m.group(2); | ||
108 | // res.put(name, lowerB); | ||
109 | // } | ||
110 | // } | ||
111 | // return res; | ||
112 | // } | ||
111 | } | 113 | } |