Skip to content

Commit

Permalink
Merge pull request #1 from flamapy/splc22
Browse files Browse the repository at this point in the history
Splc22
  • Loading branch information
jagalindo authored Sep 11, 2022
2 parents eae3a4d + 74ab267 commit 1a8a520
Show file tree
Hide file tree
Showing 10 changed files with 381 additions and 0 deletions.
8 changes: 8 additions & 0 deletions models/pizzas/pizzas.afm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%Relationships
Pizza: Topping Size Dough [CheesyCrust];
Size: [1,1]{Normal Big};
Topping: [1,3]{Salami Ham Mozzarella};
Dough: [1,1]{Neapolitan Sicilian};

%Constraints
CheesyCrust REQUIRES Big;
29 changes: 29 additions & 0 deletions models/pizzas/pizzas.fide
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<featureModel>
<struct>
<and abstract="true" mandatory="true" name="Pizza">
<or mandatory="true" name="Topping">
<feature name="Salami"/>
<feature name="Ham"/>
<feature name="Mozzarella"/>
</or>
<alt mandatory="true" name="Size">
<feature name="Normal"/>
<feature name="Big"/>
</alt>
<alt mandatory="true" name="Dough">
<feature name="Neapolitan"/>
<feature name="Sicilian"/>
</alt>
<feature name="CheesyCrust"/>
</and>
</struct>
<constraints>
<rule>
<imp>
<var>CheesyCrust</var>
<var>Big</var>
</imp>
</rule>
</constraints>
</featureModel>
141 changes: 141 additions & 0 deletions models/pizzas/pizzas.gfm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"id": "FM_Pizza",
"name": "FM_Pizza",
"features": {
"Pizza": {
"name": "Pizza",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Topping": {
"name": "Topping",
"optional": false,
"type": "OR",
"note": ""
},
"Salami": {
"name": "Salami",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Ham": {
"name": "Ham",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Mozzarella": {
"name": "Mozzarella",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Size": {
"name": "Size",
"optional": false,
"type": "XOR",
"note": ""
},
"Normal": {
"name": "Normal",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Big": {
"name": "Big",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Dough": {
"name": "Dough",
"optional": false,
"type": "XOR",
"note": ""
},
"Neapolitan": {
"name": "Neapolitan",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Sicilian": {
"name": "Sicilian",
"optional": true,
"type": "FEATURE",
"note": ""
},
"CheesyCrust": {
"name": "CheesyCrust",
"optional": true,
"type": "FEATURE",
"note": ""
}
},
"tree": {
"id": "Pizza",
"children": [
{
"id": "Topping",
"children": [
{
"id": "Salami"
},
{
"id": "Ham"
},
{
"id": "Mozzarella"
}
]
},
{
"id": "Size",
"children": [
{
"id": "Normal"
},
{
"id": "Big"
}
]
},
{
"id": "Dough",
"children": [
{
"id": "Neapolitan"
},
{
"id": "Sicilian"
}
]
},
{
"id": "CheesyCrust"
}
]
},
"constraints": {
"1": {
"type": "ImpliesTerm",
"operands": [
{
"type": "FeatureTerm",
"operands": [
"CheesyCrust"
]
},
{
"type": "FeatureTerm",
"operands": [
"Big"
]
}
]
}
}
}
141 changes: 141 additions & 0 deletions models/pizzas/pizzas.gfmjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"id": "FM_Pizza",
"name": "FM_Pizza",
"features": {
"Pizza": {
"name": "Pizza",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Topping": {
"name": "Topping",
"optional": false,
"type": "OR",
"note": ""
},
"Salami": {
"name": "Salami",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Ham": {
"name": "Ham",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Mozzarella": {
"name": "Mozzarella",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Size": {
"name": "Size",
"optional": false,
"type": "XOR",
"note": ""
},
"Normal": {
"name": "Normal",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Big": {
"name": "Big",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Dough": {
"name": "Dough",
"optional": false,
"type": "XOR",
"note": ""
},
"Neapolitan": {
"name": "Neapolitan",
"optional": true,
"type": "FEATURE",
"note": ""
},
"Sicilian": {
"name": "Sicilian",
"optional": true,
"type": "FEATURE",
"note": ""
},
"CheesyCrust": {
"name": "CheesyCrust",
"optional": true,
"type": "FEATURE",
"note": ""
}
},
"tree": {
"id": "Pizza",
"children": [
{
"id": "Topping",
"children": [
{
"id": "Salami"
},
{
"id": "Ham"
},
{
"id": "Mozzarella"
}
]
},
{
"id": "Size",
"children": [
{
"id": "Normal"
},
{
"id": "Big"
}
]
},
{
"id": "Dough",
"children": [
{
"id": "Neapolitan"
},
{
"id": "Sicilian"
}
]
},
{
"id": "CheesyCrust"
}
]
},
"constraints": {
"1": {
"type": "ImpliesTerm",
"operands": [
{
"type": "FeatureTerm",
"operands": [
"CheesyCrust"
]
},
{
"type": "FeatureTerm",
"operands": [
"Big"
]
}
]
}
}
}
24 changes: 24 additions & 0 deletions models/pizzas/pizzas.uvl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Pizza

features
Pizza {abstract}
mandatory
Topping
or
Salami
Ham
Mozzarella
Size
alternative
Normal
Big
Dough
alternative
Neapolitan
Sicilian

optional
CheesyCrust

constraints
CheesyCrust => Big
8 changes: 8 additions & 0 deletions models/pizzas/pizzas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%Relationships
Size: [1,1]{Normal Big};
Pizza: Topping Size Dough [CheesyCrust];
Topping: [1,3]{Salami Ham Mozzarella};
Dough: [1,1]{Neapolitan Sicilian};

%Constraints
CheesyCrust REQUIRES Big;
2 changes: 2 additions & 0 deletions models/pizzas_nonvalid.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Big,True
Medium,True
2 changes: 2 additions & 0 deletions models/pizzas_nonvalid.csvconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Big,True
Medium,True
5 changes: 5 additions & 0 deletions products_automatic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flamapy.core.discover import DiscoverMetamodels # This loads the tool in the python execution environment
dm = DiscoverMetamodels() # Instantiate the class
#result = dm.use_operation_from_file("Products", "./tutorial-splc22/models/pizzas/pizzas.fide") # This launch the operation and stores the result on the result variable
result = dm.use_operation_from_file("ValidProduct", "./tutorial-splc22/models/pizzas/pizzas.fide",configuration_file="./tutorial-splc22/models/pizzas_nonvalid.csvconf" ) # This launch the operation and stores the result on the result variable
print(result) # to print the result
21 changes: 21 additions & 0 deletions start_ngrok.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Set local port from command line arg or default to 8080
LOCAL_PORT=${1-8080}

echo "Start ngrok in background on port [ $LOCAL_PORT ]"
nohup ./tutorial-splc22/ngrok http ${LOCAL_PORT} &>/dev/null &

echo -n "Extracting ngrok public url ."
NGROK_PUBLIC_URL=""
while [ -z "$NGROK_PUBLIC_URL" ]; do
# Run 'curl' against ngrok API and extract public (using 'sed' command)
export NGROK_PUBLIC_URL=$(curl --silent --max-time 10 --connect-timeout 5 \
--show-error http://127.0.0.1:4040/api/tunnels | \
sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p')
sleep 1
echo -n "."
done

echo
echo "NGROK_PUBLIC_URL => [ $NGROK_PUBLIC_URL ]"

0 comments on commit 1a8a520

Please sign in to comment.