aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Aren Babikian <aren.babikian@mail.mcgill.ca>2021-01-14 13:12:17 -0500
committerLibravatar Aren Babikian <aren.babikian@mail.mcgill.ca>2021-01-14 13:12:17 -0500
commit8402974389274d7427b67d6bbac0d5f3eae64deb (patch)
tree489c4e43efb6d1f8a76077a7efe25a43c2d46802
parentcomplete change of real representation BigDecimal->Double (diff)
downloadVIATRA-Generator-8402974389274d7427b67d6bbac0d5f3eae64deb.tar.gz
VIATRA-Generator-8402974389274d7427b67d6bbac0d5f3eae64deb.tar.zst
VIATRA-Generator-8402974389274d7427b67d6bbac0d5f3eae64deb.zip
some cleanup
-rw-r--r--Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java168
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore64
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml2
3 files changed, 136 insertions, 98 deletions
diff --git a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java
index 7cbf626d..7f19d2a8 100644
--- a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java
+++ b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java
@@ -1,73 +1,111 @@
1package crossingScenario.run; 1package crossingScenario.run;
2 2
3import java.util.ArrayList;
4import java.util.HashMap;
5import java.util.List;
6import java.util.Map;
7import java.util.regex.Matcher;
8import java.util.regex.Pattern;
9
3public class QueryDebug { 10public class QueryDebug {
4// public static void main(String[] args) { 11 /*
5// Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); 12 public static void main(String[] args) {
13 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl());
14 EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE);
15 ResourceSet rs = new ResourceSetImpl();
16 rs.getResource(URI.createFileURI("inputs/sample.xmi"), true);
17
18 ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs));
19 // Access pattern matcher
20
21
22
23 SimpleScenarioQueries.instance().prepare(engine);
24 RefSpec.Matcher matcher = RefSpec.Matcher.on(engine);
25 // Get and iterate over all matches
26 for (RefSpec.Match match : matcher.getAllMatches()) {
27 // Print all the matches to the standard output
28 System.out.println(match.getL());
29 }
30 }
31 */
32
33 /*
34 public static void main(String[] args) {
35 //Add xmi resource
36 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl());
37 //Add required EPackages
6// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); 38// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE);
7// ResourceSet rs = new ResourceSetImpl(); 39 EPackage.Registry.INSTANCE.put(LogiclanguagePackage.eNS_URI, LogiclanguagePackage.eINSTANCE);
8// rs.getResource(URI.createFileURI("inputs/sample.xmi"), true); 40 EPackage.Registry.INSTANCE.put(LogicproblemPackage.eNS_URI, LogicproblemPackage.eINSTANCE);
9// 41 EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, PartialinterpretationPackage.eINSTANCE);
10// ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); 42 EPackage.Registry.INSTANCE.put(Ecore2logicannotationsPackage.eNS_URI, Ecore2logicannotationsPackage.eINSTANCE);
11// // Access pattern matcher 43 EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, Partial2logicannotationsPackage.eINSTANCE);
12// 44 EPackage.Registry.INSTANCE.put(Viatra2LogicAnnotationsPackage.eNS_URI, Viatra2LogicAnnotationsPackage.eINSTANCE);
13// 45 EPackage.Registry.INSTANCE.put(LogicresultPackage.eNS_URI, LogicresultPackage.eINSTANCE);
14// 46
15// SimpleScenarioQueries.instance().prepare(engine); 47 //Get res
16// RefSpec.Matcher matcher = RefSpec.Matcher.on(engine); 48 ResourceSet rs = new ResourceSetImpl();
17// // Get and iterate over all matches 49 rs.getResource(URI.createFileURI("inputs/partial-int.xmi"), true);
18// for (RefSpec.Match match : matcher.getAllMatches()) { 50
19// // Print all the matches to the standard output 51 ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs));
20// System.out.println(match.getL()); 52 // Access pattern matcher
21// } 53
22// } 54
55
56 LogProb.instance().prepare(engine);
57 // Get and iterate over all matches
58 System.out.println("UPMUST:");
59 for (UPMUSTPropagateConstraint0_pattern_queries_refSpec.Match match :
60 UPMUSTPropagateConstraint0_pattern_queries_refSpec.Matcher.on(engine).getAllMatches()) {
61 // Print all the matches to the standard output
62 System.out.println(match.getVar_l());
63 }
64
65 System.out.println("mustIn:");
66 for (MustInRelationreferenceCoord_attribute_Lane.Match match :
67 MustInRelationreferenceCoord_attribute_Lane.Matcher.on(engine).getAllMatches()) {
68 // Print all the matches to the standard output
69 DefinedElement de = match.getTarget();
70 System.out.println(de);
71 System.out.println("--set?: " + ((PrimitiveElement) de).isValueSet());
72 System.out.println("--val?: " + ((IntegerElement) de).getValue());
73
74 }
75
76 System.out.println("interp:");
77 for (Interpretation.Match match :
78 Interpretation.Matcher.on(engine).getAllMatches()) {
79 // Print all the matches to the standard output
80 System.out.println(match.getProblem());
81 }
82 }
83 */
23 84
24 public static void main(String[] args) { 85 public static void main(String[] args) {
25// //Add xmi resource 86 ArrayList<String> out = new ArrayList<String>();
26// Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); 87 out.add("delta-sat with delta = 0.001");
27// //Add required EPackages 88 out.add("w1602659765 : [1.797693134862315708e+308, 1.797693134862315708e+308]");
28//// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); 89 String s = "1.797693134862315708e+308";
29// EPackage.Registry.INSTANCE.put(LogiclanguagePackage.eNS_URI, LogiclanguagePackage.eINSTANCE); 90
30// EPackage.Registry.INSTANCE.put(LogicproblemPackage.eNS_URI, LogicproblemPackage.eINSTANCE); 91 System.out.println(parseDrealOutput(out));
31// EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, PartialinterpretationPackage.eINSTANCE); 92
32// EPackage.Registry.INSTANCE.put(Ecore2logicannotationsPackage.eNS_URI, Ecore2logicannotationsPackage.eINSTANCE); 93 }
33// EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, Partial2logicannotationsPackage.eINSTANCE); 94
34// EPackage.Registry.INSTANCE.put(Viatra2LogicAnnotationsPackage.eNS_URI, Viatra2LogicAnnotationsPackage.eINSTANCE); 95 private static Map<String, String> parseDrealOutput(List<String> output) {
35// EPackage.Registry.INSTANCE.put(LogicresultPackage.eNS_URI, LogicresultPackage.eINSTANCE); 96 Map<String, String> res = new HashMap<String, String>();
36// 97 String re = "(\\w+) : \\[([0-9\\+-.e]+), ([0-9\\+-.e]+)\\]";
37// //Get res 98// String re = "(\\w+) : \\[(.*), (.*)\\]";
38// ResourceSet rs = new ResourceSetImpl(); 99 Pattern p = Pattern.compile(re);
39// rs.getResource(URI.createFileURI("inputs/partial-int.xmi"), true); 100 for (String varVal : output) {
40// 101 Matcher m = p.matcher(varVal);
41// ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); 102 if (m.matches()) {
42// // Access pattern matcher 103 String name = m.group(1);
43// 104 String lowerB = m.group(2);
44// 105 String upperB = m.group(2);
45// 106 res.put(name, lowerB);
46// LogProb.instance().prepare(engine); 107 }
47// // Get and iterate over all matches 108 }
48// System.out.println("UPMUST:"); 109 return res;
49// for (UPMUSTPropagateConstraint0_pattern_queries_refSpec.Match match :
50// UPMUSTPropagateConstraint0_pattern_queries_refSpec.Matcher.on(engine).getAllMatches()) {
51// // Print all the matches to the standard output
52// System.out.println(match.getVar_l());
53// }
54//
55// System.out.println("mustIn:");
56// for (MustInRelationreferenceCoord_attribute_Lane.Match match :
57// MustInRelationreferenceCoord_attribute_Lane.Matcher.on(engine).getAllMatches()) {
58// // Print all the matches to the standard output
59// DefinedElement de = match.getTarget();
60// System.out.println(de);
61// System.out.println("--set?: " + ((PrimitiveElement) de).isValueSet());
62// System.out.println("--val?: " + ((IntegerElement) de).getValue());
63//
64// }
65//
66// System.out.println("interp:");
67// for (Interpretation.Match match :
68// Interpretation.Matcher.on(engine).getAllMatches()) {
69// // Print all the matches to the standard output
70// System.out.println(match.getProblem());
71// }
72 } 110 }
73} 111}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
index 87ba7135..c928d2b0 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
@@ -1,32 +1,32 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Filesystem" nsURI="FS" nsPrefix="FS"> 3 xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Filesystem" nsURI="FS" nsPrefix="FS">
4 <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> 4 <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
5 <details key="settingDelegates" value="org.eclipse.viatra.query.querybasedfeature"/> 5 <details key="settingDelegates" value="org.eclipse.viatra.query.querybasedfeature"/>
6 </eAnnotations> 6 </eAnnotations>
7 <eClassifiers xsi:type="ecore:EClass" name="FileSystem"> 7 <eClassifiers xsi:type="ecore:EClass" name="FileSystem">
8 <eStructuralFeatures xsi:type="ecore:EReference" name="root" lowerBound="1" eType="#//Dir" 8 <eStructuralFeatures xsi:type="ecore:EReference" name="root" lowerBound="1" eType="#//Dir"
9 containment="true"/> 9 containment="true"/>
10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject" 10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject"
11 changeable="false" volatile="true" transient="true" derived="true"> 11 changeable="false" volatile="true" transient="true" derived="true">
12 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature"> 12 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature">
13 <details key="patternFQN" value="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live"/> 13 <details key="patternFQN" value="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live"/>
14 </eAnnotations> 14 </eAnnotations>
15 </eStructuralFeatures> 15 </eStructuralFeatures>
16 </eClassifiers> 16 </eClassifiers>
17 <eClassifiers xsi:type="ecore:EClass" name="FSObject" abstract="true"> 17 <eClassifiers xsi:type="ecore:EClass" name="FSObject" abstract="true">
18 <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//Dir" 18 <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//Dir"
19 eOpposite="#//Dir/contents"/> 19 eOpposite="#//Dir/contents"/>
20 </eClassifiers> 20 </eClassifiers>
21 <eClassifiers xsi:type="ecore:EClass" name="Dir" eSuperTypes="#//FSObject"> 21 <eClassifiers xsi:type="ecore:EClass" name="Dir" eSuperTypes="#//FSObject">
22 <eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1" 22 <eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1"
23 eType="#//FSObject" containment="true" eOpposite="#//FSObject/parent"/> 23 eType="#//FSObject" containment="true" eOpposite="#//FSObject/parent"/>
24 </eClassifiers> 24 </eClassifiers>
25 <eClassifiers xsi:type="ecore:EClass" name="File" eSuperTypes="#//FSObject"/> 25 <eClassifiers xsi:type="ecore:EClass" name="File" eSuperTypes="#//FSObject"/>
26 <eClassifiers xsi:type="ecore:EClass" name="Model"> 26 <eClassifiers xsi:type="ecore:EClass" name="Model">
27 <eStructuralFeatures xsi:type="ecore:EReference" name="filesystems" lowerBound="1" 27 <eStructuralFeatures xsi:type="ecore:EReference" name="filesystems" lowerBound="1"
28 eType="#//FileSystem" containment="true"/> 28 eType="#//FileSystem" containment="true"/>
29 <eStructuralFeatures xsi:type="ecore:EReference" name="otherFSObjects" upperBound="-1" 29 <eStructuralFeatures xsi:type="ecore:EReference" name="otherFSObjects" upperBound="-1"
30 eType="#//FSObject" containment="true"/> 30 eType="#//FSObject" containment="true"/>
31 </eClassifiers> 31 </eClassifiers>
32</ecore:EPackage> 32</ecore:EPackage>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
index c760d4ef..2f4febdb 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><plugin/> <?xml version="1.0" encoding="UTF-8"?><plugin/>