|
@@ -22,6 +22,8 @@ DTDESIGN_NAMESPACES = {
|
|
|
"xopp": "http://ua.be/sdo2l/vocabulary/formalisms/xopp",
|
|
|
"object_diagram": "http://ua.be/sdo2l/vocabulary/formalisms/object_diagram",
|
|
|
"dict": "http://ua.be/sdo2l/vocabulary/formalisms/dict",
|
|
|
+
|
|
|
+ "artifacts": "http://ua.be/sdo2l/description/artifacts/",
|
|
|
}
|
|
|
|
|
|
def to_oml_string_literal(python_string):
|
|
@@ -32,7 +34,20 @@ def to_oml_string_literal(python_string):
|
|
|
def to_base64_string(bytes):
|
|
|
return '"' + base64.b64encode(bytes).decode('utf-8') + '"'
|
|
|
|
|
|
-def writeOML(xournalFile: abstract_syntax.XournalFile, inputfile:str, namespace:str, ostream: io.TextIOBase):
|
|
|
+def writeOML(
|
|
|
+ xournalFile: abstract_syntax.XournalFile,
|
|
|
+ inputfile:str,
|
|
|
+ model_name: str,
|
|
|
+ ostream: io.TextIOBase,
|
|
|
+ namespaces=DTDESIGN_NAMESPACES):
|
|
|
+ """ Write out a Xournal++ file as an OML description.
|
|
|
+ Parameters:
|
|
|
+ xournalFile: abstract syntax of a parsed .xopp file
|
|
|
+ inputfile: name of input file (only for documentation/traceability purposes - any value can be used here)
|
|
|
+ model_name: used to determine the namespace of the generated OML description
|
|
|
+ namespace: namespace of xopp-OML-vocabulary
|
|
|
+ ostream: output stream to write to
|
|
|
+ """
|
|
|
import jinja2
|
|
|
import os
|
|
|
|
|
@@ -48,5 +63,7 @@ def writeOML(xournalFile: abstract_syntax.XournalFile, inputfile:str, namespace:
|
|
|
file=xournalFile,
|
|
|
inputfile=inputfile,
|
|
|
enumerate=enumerate,
|
|
|
- namespaces=DTDESIGN_NAMESPACES):
|
|
|
+ output_namespace=namespaces['artifacts']+model_name+"_xopp",
|
|
|
+ shorthand=model_name+"_xopp",
|
|
|
+ namespaces=namespaces):
|
|
|
ostream.write(piece)
|