Skip to content

Commit

Permalink
adjust code snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed Aug 6, 2024
1 parent dae56a9 commit 2ff3ec0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/make-notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,21 @@ def generate_python_code(location):
# validate the model against 223P ontology
ctx = model.validate([s223.get_shape_collection()], error_on_missing_imports=False)
# print the validation result
print(f"Model is valid: {{ctx.valid}}")
# if the model is invalid, print the validation report
if not ctx.valid:
print(ctx.report_string)
print(ctx.report_string[:1000]) # first 1000 characters of the report
# BuildingMOTIF can also interpret the report to provide recommendations on fixes
for focus_node, diffs in ctx.get_reasons_with_severity("Violation").items():
if len(diffs) == 0:
continue
print(focus_node)
for diff in diffs:
print(" - " + diff.reason())
"""
return code_content

Expand Down

0 comments on commit 2ff3ec0

Please sign in to comment.