From 7193efd76bdd814db060fe88f294f40865cf6d09 Mon Sep 17 00:00:00 2001 From: Aren Babikian Date: Thu, 14 Jan 2021 09:13:36 -0500 Subject: Add some documents to debug MG issue --- Domains/simpleScenario/META-INF/MANIFEST.MF | 14 +- .../simpleScenario/inputs/Debug/partial-int.xmi | 1115 ++++++++++++++++++++ Domains/simpleScenario/inputs/Debug/partial.xmi | 1115 ++++++++++++++++++++ Domains/simpleScenario/inputs/Debug/sample.xmi | 7 + Domains/simpleScenario/queries/logProb.vql | 41 + .../src/simpleScenario/run/QueryDebug.java | 73 ++ 6 files changed, 2361 insertions(+), 4 deletions(-) create mode 100644 Domains/simpleScenario/inputs/Debug/partial-int.xmi create mode 100644 Domains/simpleScenario/inputs/Debug/partial.xmi create mode 100644 Domains/simpleScenario/inputs/Debug/sample.xmi create mode 100644 Domains/simpleScenario/queries/logProb.vql create mode 100644 Domains/simpleScenario/src/simpleScenario/run/QueryDebug.java diff --git a/Domains/simpleScenario/META-INF/MANIFEST.MF b/Domains/simpleScenario/META-INF/MANIFEST.MF index 22f9477b..7772ef80 100644 --- a/Domains/simpleScenario/META-INF/MANIFEST.MF +++ b/Domains/simpleScenario/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin -Export-Package: simpleScenario, +Export-Package: queries, + simpleScenario, simpleScenario.impl, simpleScenario.util Require-Bundle: org.eclipse.viatra.query.runtime, @@ -15,8 +16,13 @@ Require-Bundle: org.eclipse.viatra.query.runtime, org.eclipse.xtext.xbase.lib, org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, - hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-11 -Bundle-ActivationPolicy: lazy + hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0", + hu.bme.mit.inf.dslreasoner.logic.model;bundle-version="1.0.0", + org.eclipse.emf.ecore.xmi;bundle-version="2.16.0", + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage;bundle-version="1.0.0", + hu.bme.mit.inf.dslreasoner.ecore2logic;bundle-version="1.0.0", + hu.bme.mit.inf.dslreasoner.viatra2logic;bundle-version="1.0.0" Import-Package: org.apache.log4j Automatic-Module-Name: simpleScenario +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/Domains/simpleScenario/inputs/Debug/partial-int.xmi b/Domains/simpleScenario/inputs/Debug/partial-int.xmi new file mode 100644 index 00000000..eaddaafc --- /dev/null +++ b/Domains/simpleScenario/inputs/Debug/partial-int.xmi @@ -0,0 +1,1115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Domains/simpleScenario/inputs/Debug/partial.xmi b/Domains/simpleScenario/inputs/Debug/partial.xmi new file mode 100644 index 00000000..2b25e65e --- /dev/null +++ b/Domains/simpleScenario/inputs/Debug/partial.xmi @@ -0,0 +1,1115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Domains/simpleScenario/inputs/Debug/sample.xmi b/Domains/simpleScenario/inputs/Debug/sample.xmi new file mode 100644 index 00000000..cb4057fb --- /dev/null +++ b/Domains/simpleScenario/inputs/Debug/sample.xmi @@ -0,0 +1,7 @@ + + + + diff --git a/Domains/simpleScenario/queries/logProb.vql b/Domains/simpleScenario/queries/logProb.vql new file mode 100644 index 00000000..e6045909 --- /dev/null +++ b/Domains/simpleScenario/queries/logProb.vql @@ -0,0 +1,41 @@ +package queries + +import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" +import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" +import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" + +pattern UPMUSTPropagateConstraint0_pattern_queries_refSpec( + problem:LogicProblem, interpretation:PartialInterpretation, + var_l) +{ +// Original Constraints +// var_l exported +find mustInRelationreferenceCoord_attribute_Lane(problem,interpretation,var_l,var_w); +// Propagation for constraint +PrimitiveElement.valueSet(var_w,setted_var_w); +IntegerElement.value(var_w,value_var_w); +// Matching variables +//var_w==up_1; +} + +/** + * Matcher for detecting tuples t where []referenceCoord attribute Lane(source,target) + */ +pattern mustInRelationreferenceCoord_attribute_Lane( + problem:LogicProblem, interpretation:PartialInterpretation, + source: DefinedElement, target:DefinedElement) +{ + find interpretation(problem,interpretation); + PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); + PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"referenceCoord attribute Lane"); + PartialRelationInterpretation.relationlinks(relationIterpretation,link); + BinaryElementRelationLink.param1(link,source); + BinaryElementRelationLink.param2(link,target); +} + +////////// +// 0. Util +////////// +pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) { + PartialInterpretation.problem(interpretation,problem); +} \ No newline at end of file diff --git a/Domains/simpleScenario/src/simpleScenario/run/QueryDebug.java b/Domains/simpleScenario/src/simpleScenario/run/QueryDebug.java new file mode 100644 index 00000000..816a258d --- /dev/null +++ b/Domains/simpleScenario/src/simpleScenario/run/QueryDebug.java @@ -0,0 +1,73 @@ +package simpleScenario.run; + +public class QueryDebug { +// public static void main(String[] args) { +// Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); +// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); +// ResourceSet rs = new ResourceSetImpl(); +// rs.getResource(URI.createFileURI("inputs/sample.xmi"), true); +// +// ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); +// // Access pattern matcher +// +// +// +// SimpleScenarioQueries.instance().prepare(engine); +// RefSpec.Matcher matcher = RefSpec.Matcher.on(engine); +// // Get and iterate over all matches +// for (RefSpec.Match match : matcher.getAllMatches()) { +// // Print all the matches to the standard output +// System.out.println(match.getL()); +// } +// } + + public static void main(String[] args) { +// //Add xmi resource +// Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); +// //Add required EPackages +//// EPackage.Registry.INSTANCE.put(SimpleScenarioPackage.eNS_URI, SimpleScenarioPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(LogiclanguagePackage.eNS_URI, LogiclanguagePackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(LogicproblemPackage.eNS_URI, LogicproblemPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, PartialinterpretationPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(Ecore2logicannotationsPackage.eNS_URI, Ecore2logicannotationsPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, Partial2logicannotationsPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(Viatra2LogicAnnotationsPackage.eNS_URI, Viatra2LogicAnnotationsPackage.eINSTANCE); +// EPackage.Registry.INSTANCE.put(LogicresultPackage.eNS_URI, LogicresultPackage.eINSTANCE); +// +// //Get res +// ResourceSet rs = new ResourceSetImpl(); +// rs.getResource(URI.createFileURI("inputs/partial-int.xmi"), true); +// +// ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); +// // Access pattern matcher +// +// +// +// LogProb.instance().prepare(engine); +// // Get and iterate over all matches +// System.out.println("UPMUST:"); +// for (UPMUSTPropagateConstraint0_pattern_queries_refSpec.Match match : +// UPMUSTPropagateConstraint0_pattern_queries_refSpec.Matcher.on(engine).getAllMatches()) { +// // Print all the matches to the standard output +// System.out.println(match.getVar_l()); +// } +// +// System.out.println("mustIn:"); +// for (MustInRelationreferenceCoord_attribute_Lane.Match match : +// MustInRelationreferenceCoord_attribute_Lane.Matcher.on(engine).getAllMatches()) { +// // Print all the matches to the standard output +// DefinedElement de = match.getTarget(); +// System.out.println(de); +// System.out.println("--set?: " + ((PrimitiveElement) de).isValueSet()); +// System.out.println("--val?: " + ((IntegerElement) de).getValue()); +// +// } +// +// System.out.println("interp:"); +// for (Interpretation.Match match : +// Interpretation.Matcher.on(engine).getAllMatches()) { +// // Print all the matches to the standard output +// System.out.println(match.getProblem()); +// } + } +} -- cgit v1.2.3-54-g00ecf