aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/Examples/ModelGenExampleFAM_standalone
diff options
context:
space:
mode:
Diffstat (limited to 'Domains/Examples/ModelGenExampleFAM_standalone')
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/.project23
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/FamGeneration.vsconfig25
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamInstance.xmi12
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamMetamodel.ecore52
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamPatterns.vql104
-rw-r--r--Domains/Examples/ModelGenExampleFAM_standalone/outputs/.gitignore2
6 files changed, 218 insertions, 0 deletions
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/.project b/Domains/Examples/ModelGenExampleFAM_standalone/.project
new file mode 100644
index 00000000..cac2abc4
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/.project
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>ModelGenExampleFAM_standalone</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 </buildSpec>
19 <natures>
20 <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
21 <nature>org.eclipse.viatra.query.projectnature</nature>
22 </natures>
23</projectDescription>
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/FamGeneration.vsconfig b/Domains/Examples/ModelGenExampleFAM_standalone/FamGeneration.vsconfig
new file mode 100644
index 00000000..30e6adfa
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/FamGeneration.vsconfig
@@ -0,0 +1,25 @@
1import epackage "platform:/resource/ModelGenExampleFAM_standalone/inputs/FamMetamodel.ecore"
2import viatra "platform:/resource/ModelGenExampleFAM_standalone/inputs/FamPatterns.vql"
3
4file LogFile = "platform:/resource/ModelGenExampleFAM/outputs/log.txt"
5generate {
6 metamodel = { package functionalarchitecture }
7 patterns = { package hu.bme.mit.inf.dslreasoner.domains.fam excluding { model } }
8 solver = ViatraSolver
9 scope = {
10 #node = 10
11 }
12
13 config = {
14 runtime = 10000,
15 log-level = normal
16 }
17
18 number = 5
19 runs = 1
20
21 debug = "platform:/resource/ModelGenExampleFAM_standalone/outputs/debug"
22 log = "platform:/resource/ModelGenExampleFAM_standalone/outputs/log.txt"
23 output = "platform:/resource/ModelGenExampleFAM_standalone/outputs/models"
24 statistics = "platform:/resource/ModelGenExampleFAM_standalone/outputs/statistics.csv"
25} \ No newline at end of file
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamInstance.xmi b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamInstance.xmi
new file mode 100644
index 00000000..9e3561d2
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamInstance.xmi
@@ -0,0 +1,12 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<functionalarchitecture:FunctionalArchitectureModel
3 xmi:version="2.0"
4 xmlns:xmi="http://www.omg.org/XMI"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xmlns:functionalarchitecture="http://www.inf.mit.bme.hu/viatrasolver/example/fam"
7 xsi:schemaLocation="http://www.inf.mit.bme.hu/viatrasolver/example/fam FamMetamodel.ecore">
8 <rootElements
9 xsi:type="functionalarchitecture:Function"/>
10 <rootElements
11 xsi:type="functionalarchitecture:Function"/>
12</functionalarchitecture:FunctionalArchitectureModel>
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamMetamodel.ecore b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamMetamodel.ecore
new file mode 100644
index 00000000..00d16fc0
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamMetamodel.ecore
@@ -0,0 +1,52 @@
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" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="functionalarchitecture" nsURI="http://www.inf.mit.bme.hu/viatrasolver/example/fam" nsPrefix="functionalarchitecture">
3 <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
4 <details key="settingDelegates" value="org.eclipse.viatra.query.querybasedfeature"/>
5 </eAnnotations>
6 <eClassifiers xsi:type="ecore:EClass" name="FunctionalElement" abstract="true">
7 <eStructuralFeatures xsi:type="ecore:EReference" name="interface" eType="//FunctionalInterface" containment="true" eOpposite="//FunctionalInterface/element"/>
8 <eStructuralFeatures xsi:type="ecore:EReference" name="model" lowerBound="1" eType="//FunctionalArchitectureModel" volatile="true" transient="true" derived="true">
9 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature">
10 <details key="patternFQN" value="hu.bme.mit.inf.dslreasoner.domains.fam.model"/>
11 </eAnnotations>
12 </eStructuralFeatures>
13 <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="//Function" eOpposite="//Function/subElements"/>
14 </eClassifiers>
15 <eClassifiers xsi:type="ecore:EClass" name="FunctionalArchitectureModel">
16 <eStructuralFeatures xsi:type="ecore:EReference" name="rootElements" upperBound="-1" eType="//FunctionalElement" containment="true"/>
17 </eClassifiers>
18 <eClassifiers xsi:type="ecore:EClass" name="Function" eSuperTypes="//FunctionalElement">
19 <eStructuralFeatures xsi:type="ecore:EReference" name="subElements" upperBound="-1" eType="//FunctionalElement" containment="true" eOpposite="//FunctionalElement/parent"/>
20 <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="//FunctionType" changeable="false" volatile="true" transient="true" derived="true">
21 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature">
22 <details key="patternFQN" value="hu.bme.mit.inf.dslreasoner.domains.fam.type"/>
23 </eAnnotations>
24 </eStructuralFeatures>
25 </eClassifiers>
26 <eClassifiers xsi:type="ecore:EClass" name="FAMTerminator">
27 <eStructuralFeatures xsi:type="ecore:EReference" name="data" eType="//FunctionalData" eOpposite="//FunctionalData/terminator"/>
28 </eClassifiers>
29 <eClassifiers xsi:type="ecore:EClass" name="InformationLink">
30 <eStructuralFeatures xsi:type="ecore:EReference" name="from" eType="//FunctionalOutput" eOpposite="//FunctionalOutput/outgoingLinks"/>
31 <eStructuralFeatures xsi:type="ecore:EReference" name="to" lowerBound="1" eType="//FunctionalInput" eOpposite="//FunctionalInput/IncomingLinks"/>
32 </eClassifiers>
33 <eClassifiers xsi:type="ecore:EClass" name="FunctionalInterface">
34 <eStructuralFeatures xsi:type="ecore:EReference" name="data" upperBound="-1" eType="//FunctionalData" containment="true" eOpposite="//FunctionalData/interface"/>
35 <eStructuralFeatures xsi:type="ecore:EReference" name="element" eType="//FunctionalElement" eOpposite="//FunctionalElement/interface"/>
36 </eClassifiers>
37 <eClassifiers xsi:type="ecore:EClass" name="FunctionalInput" eSuperTypes="//FunctionalData">
38 <eStructuralFeatures xsi:type="ecore:EReference" name="IncomingLinks" upperBound="-1" eType="//InformationLink" eOpposite="//InformationLink/to"/>
39 </eClassifiers>
40 <eClassifiers xsi:type="ecore:EClass" name="FunctionalOutput" eSuperTypes="//FunctionalData">
41 <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingLinks" upperBound="-1" eType="//InformationLink" containment="true" eOpposite="//InformationLink/from"/>
42 </eClassifiers>
43 <eClassifiers xsi:type="ecore:EClass" name="FunctionalData" abstract="true">
44 <eStructuralFeatures xsi:type="ecore:EReference" name="terminator" eType="//FAMTerminator" containment="true" eOpposite="//FAMTerminator/data"/>
45 <eStructuralFeatures xsi:type="ecore:EReference" name="interface" eType="//FunctionalInterface" eOpposite="//FunctionalInterface/data"/>
46 </eClassifiers>
47 <eClassifiers xsi:type="ecore:EEnum" name="FunctionType">
48 <eLiterals name="Root"/>
49 <eLiterals name="Intermediate" value="1"/>
50 <eLiterals name="Leaf" value="2"/>
51 </eClassifiers>
52</ecore:EPackage>
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamPatterns.vql b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamPatterns.vql
new file mode 100644
index 00000000..34394ef6
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/inputs/FamPatterns.vql
@@ -0,0 +1,104 @@
1package hu.bme.mit.inf.dslreasoner.domains.fam
2
3import epackage "http://www.inf.mit.bme.hu/viatrasolver/example/fam"
4//import epackage "platform:/resource/ModelGenExampleFAM/inputs/FamMetamodel.ecore";
5
6@Constraint(message="terminatorAndInformation", severity="error", key={T})
7pattern terminatorAndInformation(T : FAMTerminator, I : InformationLink) = {
8 FunctionalOutput.outgoingLinks(Out,I);
9 FunctionalOutput.terminator(Out,T);
10} or {
11 InformationLink.to(I,In);
12 FunctionalInput.terminator(In,T);
13}
14
15@QueryBasedFeature
16pattern type(This : Function, Target : FunctionType) = {
17 find rootElements(_Model, This);
18 Target == FunctionType::Root;
19} or {
20 neg find parent(_Child, This);
21 neg find rootElements(_Model, This);
22 Target == FunctionType::Leaf;
23} or {
24 find parent(This, _Par);
25 find parent(_Child, This);
26 Target == FunctionType::Intermediate;
27}
28
29pattern rootElements(Model: FunctionalArchitectureModel, Root : Function) = {
30 FunctionalArchitectureModel.rootElements(Model, Root);
31}
32
33pattern parent(Func : Function, Par : Function) = {
34 Function.parent(Func, Par);
35}
36
37@QueryBasedFeature
38pattern model(This:FunctionalElement, Target: FunctionalArchitectureModel) {
39 FunctionalElement(This);
40 FunctionalArchitectureModel(Target);
41}
42
43/*
44@Constraint(message="noRoot", severity="error", key={fam})
45pattern noRoot(fam: FunctionalArchitectureModel) {
46 FunctionalArchitectureModel(fam);
47 neg find hasRoot(_);
48}
49@Constraint(message="noIntermediate", severity="error", key={fam})
50pattern noInt(fam: FunctionalArchitectureModel) {
51 FunctionalArchitectureModel(fam);
52 neg find hasInt(_);
53}
54@Constraint(message="noLeaf", severity="error", key={fam})
55pattern noLeaf(fam: FunctionalArchitectureModel) {
56 FunctionalArchitectureModel(fam);
57 neg find hasLeaf(_);
58}
59*/
60
61/*
62@QueryBasedFeature
63pattern model(This : FunctionalElement, Target : FunctionalArchitectureModel) = {
64 find parent+(This, Parent);
65 find rootElements(Target, Parent);
66} or {
67 find rootElements(Target, This);
68}
69
70pattern interfaceData(FI : FunctionalInterface, FD : FunctionalData) = {
71 FunctionalInterface.data(FI, FD);
72}
73
74@QueryBasedFeature
75pattern inputs(This : FunctionalInterface, Target : FunctionalInput) = {
76 find interfaceData(This, Target);
77}
78
79@QueryBasedFeature
80pattern outputs(This : FunctionalInterface, Target : FunctionalOutput) = {
81 find interfaceData(This, Target);
82}
83
84@QueryBasedFeature
85pattern outgoingLinks(This : FunctionalElement, Target : InformationLink) = {
86 FunctionalElement.interface.outputs(This, Output);
87 InformationLink.from(Target, Output);
88}
89
90@QueryBasedFeature
91pattern incomingLinks(This : FunctionalElement, Target : InformationLink) = {
92 FunctionalElement.interface.inputs(This, Input);
93 InformationLink.to(Target, Input);
94}
95
96@QueryBasedFeature
97pattern connects(This : FunctionalElement, Target : FunctionalElement) = {
98 FunctionalElement.outgoingLinks(This,Link);
99 FunctionalElement.incomingLinks(Target,Link);
100}*/
101
102/*pattern frequency(a: Function, b : EInt) {
103 Function.minimumFrequency(a,b);
104}*/
diff --git a/Domains/Examples/ModelGenExampleFAM_standalone/outputs/.gitignore b/Domains/Examples/ModelGenExampleFAM_standalone/outputs/.gitignore
new file mode 100644
index 00000000..a3a0c8b5
--- /dev/null
+++ b/Domains/Examples/ModelGenExampleFAM_standalone/outputs/.gitignore
@@ -0,0 +1,2 @@
1*
2!.gitignore \ No newline at end of file