Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DOML Model Checker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIACERE
public
The Platform
DOML Model Checker
Commits
e4da9015
Unverified
Commit
e4da9015
authored
2 years ago
by
Andrea Franchini
Browse files
Options
Downloads
Patches
Plain Diff
Add initial support to new synthesis package
parent
6d3b985f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+5
-1
5 additions, 1 deletion
README.md
mc_openapi/__main__.py
+37
-50
37 additions, 50 deletions
mc_openapi/__main__.py
with
42 additions
and
51 deletions
README.md
+
5
−
1
View file @
e4da9015
[

](https://piacere-model-checker.readthedocs.io/en/latest/?badge=latest)
# PIACERE Model Checker
# PIACERE Model Checker
____________________
__
_
____________________
__
_
## **You can read the [docs here](https://
andreafranchini.com/
piacere-model-checker/) for more details.**
## **You can read the [docs here](https://piacere-model-checker
.readthedocs.io/en/latest
/) for more details.**
____________________
__
_
____________________
__
_
The DOML Model Checker is a component of the
[
PIACERE
](
https://www.piacere-project.eu/
)
framework
The DOML Model Checker is a component of the
[
PIACERE
](
https://www.piacere-project.eu/
)
framework
...
@@ -66,6 +68,8 @@ by adding `-p 127.0.0.1:8080:80/tcp` to the `docker run` command.
...
@@ -66,6 +68,8 @@ by adding `-p 127.0.0.1:8080:80/tcp` to the `docker run` command.
The documentation has been written in
[
Sphinx
](
https://www.sphinx-doc.org/
)
The documentation has been written in
[
Sphinx
](
https://www.sphinx-doc.org/
)
and covers both usage through the PIACERE IDE and the REST APIs.
and covers both usage through the PIACERE IDE and the REST APIs.
Read it at
[
readthedocs.io
](
https://piacere-model-checker.readthedocs.io/en/latest/
)
Build the documentation with:
Build the documentation with:
```
sh
```
sh
cd
docs
cd
docs
...
...
This diff is collapsed.
Click to expand it.
mc_openapi/__main__.py
+
37
−
50
View file @
e4da9015
...
@@ -6,12 +6,9 @@ from mc_openapi.doml_mc import DOMLVersion
...
@@ -6,12 +6,9 @@ from mc_openapi.doml_mc import DOMLVersion
from
mc_openapi.doml_mc.dsl_parser.exceptions
import
RequirementException
from
mc_openapi.doml_mc.dsl_parser.exceptions
import
RequirementException
from
mc_openapi.doml_mc.dsl_parser.parser
import
Parser
from
mc_openapi.doml_mc.dsl_parser.parser
import
Parser
from
mc_openapi.doml_mc.imc
import
RequirementStore
from
mc_openapi.doml_mc.imc
import
RequirementStore
from
mc_openapi.doml_mc.intermediate_model.metamodel
import
MetaModelDocs
from
mc_openapi.doml_mc.mc
import
ModelChecker
from
mc_openapi.doml_mc.mc
import
ModelChecker
from
mc_openapi.doml_mc.mc_result
import
MCResult
from
mc_openapi.doml_mc.mc_result
import
MCResult
from
mc_openapi.doml_mc.synthesis.synthesis
import
Synthesis
from
mc_openapi.doml_mc.synthesis.synthesis_common_reqs
import
synthesis_default_req_store
from
mc_openapi.doml_mc.synthesis.xmi_gen
import
generate_xmi
from
mc_openapi.doml_mc.xmi_parser.doml_model
import
get_pyecore_model
,
serialize_pyecore_model
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
@@ -77,51 +74,7 @@ else:
...
@@ -77,51 +74,7 @@ else:
print
(
e
)
print
(
e
)
raise
RuntimeError
(
"
Failed to parse the DOMLR.
"
)
raise
RuntimeError
(
"
Failed to parse the DOMLR.
"
)
if
args
.
synth
:
if
not
args
.
synth
:
try
:
synth
=
Synthesis
(
dmc
.
metamodel
,
dmc
.
intermediate_model
,
verbose
=
args
.
verbose
)
synth_req_store
=
RequirementStore
()
synth_req_store
+=
synthesis_default_req_store
synth_req_store
+=
user_req_store
printv
(
f
"
synth_reqs :
{
len
(
synth_req_store
)
}
"
)
solved_ctx
=
synth
.
check
(
ub_elems_n
=
0
,
ub_vals_n
=
0
,
max_tries
=
args
.
tries
,
# default = 10
reqs
=
synth_req_store
.
get_all_requirements
(),
user_req_strings
=
user_req_str_consts
)
solved_model
=
solved_ctx
.
solver
.
model
()
# Print new found relationships
ub_elems_and_assoc
=
synth
.
get_ub_elems_and_assoc
(
solved_ctx
,
solved_model
)
printv
(
"
\n
"
.
join
([
synth
.
pretty_ub_elems_assoc
(
assoc
)
for
assoc
in
ub_elems_and_assoc
]))
printv
(
"
-
"
*
120
)
ub_vals_and_attr
=
synth
.
get_ub_vals_and_attr
(
solved_ctx
,
solved_model
)
printv
(
"
\n
"
.
join
([
synth
.
pretty_ub_vals_attr
(
attr
)
for
attr
in
ub_vals_and_attr
]))
# find thinned results
assoc_to_implement
=
synth
.
thin_ub_elems_and_assoc
(
solved_ctx
,
ub_elems_and_assoc
)
attrs_to_implement
=
synth
.
thin_ub_vals_and_attr
(
solved_ctx
,
ub_vals_and_attr
)
# Print results
printv
(
"
\n
Please implement the following:
\n
"
)
printv
(
"
\n
"
.
join
([
synth
.
pretty_ub_elems_assoc
(
assoc
)
for
assoc
in
assoc_to_implement
]))
printv
(
"
\n
"
.
join
([
synth
.
pretty_ub_vals_attr
(
attr
)
for
attr
in
attrs_to_implement
]))
# Implement results
eobj
=
get_pyecore_model
(
doml_xmi
,
doml_ver
)
eobj
=
generate_xmi
(
eobj
,
assoc_to_implement
,
dmc
.
intermediate_model
,
doml_ver
)
serialize_pyecore_model
(
eobj
)
except
Exception
as
e
:
print
(
e
)
else
:
try
:
try
:
# Check satisfiability
# Check satisfiability
results
=
dmc
.
check_requirements
(
results
=
dmc
.
check_requirements
(
...
@@ -141,3 +94,37 @@ else:
...
@@ -141,3 +94,37 @@ else:
print
(
"
\033
[91m{}
\033
[00m
"
.
format
(
msg
))
print
(
"
\033
[91m{}
\033
[00m
"
.
format
(
msg
))
except
RequirementException
as
e
:
except
RequirementException
as
e
:
print
(
e
.
message
)
print
(
e
.
message
)
else
:
# Synthesis
printv
(
"
Running synthesis...
"
)
# Lazy load libraries
from
doml_synthesis.types
import
State
from
doml_synthesis.data
import
init_data
from
doml_synthesis.solver
import
solve
from
doml_synthesis.requirements
import
builtin_requirements
from
doml_synthesis.results
import
check_synth_results
,
save_results
# Required files:
mm
=
MetaModelDocs
[
doml_ver
]
im
=
{
k
:
{
'
id
'
:
v
.
id_
,
'
name
'
:
v
.
user_friendly_name
,
'
class
'
:
v
.
class_
,
'
assocs
'
:
v
.
associations
,
'
attrs
'
:
v
.
attributes
}
for
k
,
v
in
dmc
.
intermediate_model
.
items
()
}
# TODO: Fetch (user_reqs, user_reqs_strings)
state
=
State
()
# Parse MM and IM
state
=
init_data
(
state
,
doml
=
im
,
metamodel
=
mm
)
# Solve
state
=
solve
(
state
,
requirements
=
[
builtin_requirements
],
strings
=
[],
max_tries
=
args
.
tries
)
# Update state
state
=
save_results
(
state
)
# Print output
state
=
check_synth_results
(
state
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment