The OntoUML JSON2Graph Transformation
+The OntoUML JSON2Graph Transformation
The OntoUML JSON2Graph (ontouml-json2graph) decodes a JSON file that complies with the ontouml-schema (e.g., the ones exported by the ontouml-vp-plugin) to a graph file that complies with the ontouml-vocabulary.
When transforming a model, you can choose to represent only the core concepts of the model or include all of its information, including diagrammatic elements, as part of the knowledge graph. Additionally, users have the choice to enable basic semantic and syntactical verifications, ensuring enhanced and accurate transformation results.
@@ -120,7 +121,7 @@The OntoUML JSON2Graph Transformationcomprehensive docstring-generated documentation available for this project.
-Contents
+Contents
The OntoUML JSON2Graph Transformation
@@ -156,7 +157,7 @@ Contents
-Installation
+Installation
Before using the OntoUML JSON2Graph Decoder, you need to download and install Python.
To install the application you simply need to perform the following command:
pip install ontouml-json2graph
@@ -165,27 +166,40 @@ Installation
-Usage
+Usage
After being installed, the OntoUML JSON2Graph Decoder can be used as an executable script or imported as a library into another Python project.
The output of the transformation, i.e., the graph file, will be saved into a directory named results
in the same path in which the software was executed.
-Executing as a Script
+Executing as a Script
For executing the software, run the following command on the terminal inside the project’s folder:
python -m json2graph.decode [path_to_json] [OPTIONAL ARGUMENTS]
+For example, to decode the JSON file my_ontology.json
and save the output graph in the Turtle format, you would run the following command:
+python -m json2graph.decode -i turtle my_ontology.json
+
+
+You can also use the script to decode multiple JSON files. To do this, you would use the decode_all
option (‘-a’ argument).
+For example, to decode all of the JSON files in the my_data directory you would run the following command:
+python -m json2graph.decode -a -i my_data
+
+
-Arguments
+Arguments
The only mandatory argument is path_to_json
, which must be substituted for the input file’s location on your computer. Optional arguments provide additional features. All available ontouml-json2graph arguments can be observed below.
-usage: ontouml-json2graph [-h] [-f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}] [-l LANGUAGE] [-c] [-s] [-u BASE_URI] [-m] [-v] json_path
+usage: ontouml-json2graph [-h] -i INPUT_PATH [-o OUTPUT_PATH] [-a] [-f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}]
+ [-l LANGUAGE] [-c] [-s] [-u BASE_URI] [-m] [-v]
-OntoUML JSON2Graph Decoder. Version: 1.1.0
-positional arguments:
- json_path The path of the JSON file to be encoded.
+OntoUML JSON2Graph Decoder. Version: 1.2.0
options:
-h, --help show this help message and exit
+ -i INPUT_PATH, --input_path INPUT_PATH
+ The path of the JSON file or directory with JSON files to be decoded.
+ -o OUTPUT_PATH, --output_path OUTPUT_PATH
+ The path of the directory in which the resulting decoded file(s) will be saved. Default is the working directory.
+ -a, --decode_all Converts all JSON files in the informed path.
-f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}, --format {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}
Format to save the decoded file. Default is 'ttl'.
-l LANGUAGE, --language LANGUAGE
@@ -197,38 +211,40 @@ Arguments
-Importing as a Library
+Importing as a Library
The library.py
module (full docummentation) is a user-friendly component of the ontouml-json2graph
package. By encapsulating complex functionalities, this library empowers users to seamlessly integrate OntoUML JSON conversion capabilities into their projects. In addition to conversion functions, the library provides a utility function for safely saving OntoUML graphs to files in the desired syntax.
The library provides the following functions for decoding OntoUML JSON data and saving OntoUML graphs to files:
-decode_json_project
+decode_json_project
The decode_json_project
function allows you to decode the complete OntoUML JSON data (including elements from OntoUML’s abstract and concrete syntax) into a knowledge graph that conforms to the OntoUML Vocabulary. This function provides customization options, such as specifying the base URI for ontology concepts, adding language tags, and enabling error correction. With this function domain-level and diagrammatic data are converted to Knowledge Graph.
from json2graph.library import decode_json_project
-decoded_graph_project = decode_json_project(json_path="path/to/input.json", base_uri="https://myuri.org#",
+decoded_graph_project = decode_json_project(json_file_path="path/to/input.json", base_uri="https://myuri.org#",
language="en", correct=True)
-decode_json_model
+decode_json_model
The decode_json_model
function decodes OntoUML JSON data representing a model-level view into a knowledge graph that adheres to the OntoUML Vocabulary.
Differently from the decode_json_model
, this function decodes only elements from the OntoUML’s abstract syntax. I.e., only domain-level (and not diagrammatic) data is converted to knowledge graph. It offers options for base URI, language tags, and error correction.
from json2graph.library import decode_json_model
-decoded_graph_model = decode_json_model(json_path="path/to/input.json", base_uri="https://myuri.org#", language="en",
+decoded_graph_model = decode_json_model(json_file_path="path/to/input.json", base_uri="https://myuri.org#",
+ language="en",
correct=True)
-save_graph_file
+save_graph_file
The save_graph_file
utility function provides a convenient way to save an OntoUML graph as an RDF file in the desired syntax.
from json2graph.library import save_graph_file
@@ -241,13 +257,13 @@ save_graph_file
-Input and Output
+Input and Output
This software’s input is a JSON file that complies with the OntoUML Schema. This JSON file can be obtained from the ontouml-vp-plugin’s export feature. The JSON2Graph Decoder was tested to guarantee its compatibility with the JSON generated by the plugin’s version 0.5.3.
The transformation’s output corresponds to the OntoUML Model serialized as a graph. The saved file information is described by the OntoUML Vocabulary and can be saved in the different formats that are supported by the RDFLib. This output graph may contain the model’s diagrammatic information or not, depending on the user’s provided arguments. The OntoUML Vocabulary documentation contains a userge overview, presenting information about all available elements, and about how to use them, including examples of SPARQL queries.
Both the input and output of the software are built upon the same metamodel, the OntoUML Metamodel, which facilitates the conversion between different representations.
-OntoUML Vocabulary and gUFO
+OntoUML Vocabulary and gUFO
The ontouml-vp-plugin has a feature that enables an ontology to be transformed from OntoUML to a graph format. This feature is called the Model Transformation to OWL with gUFO.
gUFO is a lightweight implementation of the OntoUML’s underlying foundational ontology, the Unified Foundational Ontology (UFO).
Even though an ontology represented in gUFO and in the OntoUML Vocabulary are both suitable for Semantic Web OWL 2 DL applications, these two representations are different and were created with different purposes.
@@ -257,7 +273,7 @@ OntoUML Vocabulary and gUFO
-Basic Syntactical and Sematic Validation
+Basic Syntactical and Sematic Validation
Class validations:
@@ -287,7 +303,7 @@ Basic Syntactical and Sematic Validation
-Permanent URLs and Identifiers
+Permanent URLs and Identifiers
Repository: https://w3id.org/ontouml/json2graph
Documentation: https://w3id.org/ontouml/json2graph/docs
@@ -301,7 +317,7 @@ Permanent URLs and Identifiers
-Related Projects
+Related Projects
OntoUML Metamodel: Implementation-independent OntoUML Metamodel. Unlike the UML profile, this version is independent of UML and presents only the concepts officially supported in the language. This metamodel covers the abstract and concrete syntaxes of the language and serves as the reference for all projects in the OntoUML as a Service (OaaS) ecosystem, including its different model serializations.
OntoUML Vocabulary: An OntoUML Metamodel’s serialization in Turtle (ttl) format. This vocabulary supports the serialization, exchange, and publishing of OntoUML models as graphs that can be used for Semantic Web and Linked Data applications.
@@ -310,7 +326,7 @@ Related Projects
-Development Contribution
+Development Contribution
We encourage you to contribute to the development of this software.
The dependencies to develop this software are not the same as the ones to execute it. Hence, it is necessary run the following command on the terminal inside the project’s folder to install all necessary dependencies:
pip install -r requirements.txt
@@ -318,10 +334,10 @@ Development Contributionpyproject.toml file to present information to users. If any change is made to that file, the setup_metadata.py
file, located inside the project’s root folder must be executed to update the transformation’s data.
The ontouml-json2graph package was developed using test-driven-based development. Multiple tests are available inside the following folder: ontouml-json2graph/json2graph/tests.
-Documentation regarding the text is also available.
+Documentation regarding the tests is also available.
-Author
+Author
This project is maintained by the Semantics, Cybersecurity & Services (SCS) Group of the University of Twente, The Netherlands. Its developer is:
diff --git a/docs/_sources/autoapi/json2graph/decode/index.rst.txt b/docs/_sources/autoapi/json2graph/decode/index.rst.txt
index 2beb9c1..d4246be 100644
--- a/docs/_sources/autoapi/json2graph/decode/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decode/index.rst.txt
@@ -21,6 +21,7 @@ Functions
json2graph.decode.decode_ontouml_json2graph
json2graph.decode.write_graph_file
+ json2graph.decode.decode_all_ontouml_json2graph
@@ -32,21 +33,18 @@ Attributes
json2graph.decode.decoded_graph
-.. py:function:: decode_ontouml_json2graph(json_path, base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import')
+.. py:function:: decode_ontouml_json2graph(json_file_path, base_uri = 'https://example.org#', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import')
Main function for converting OntoUML JSON data to a Knowledge Graph.
This function takes the path to a JSON file representing OntoUML model data provided by the user
and converts it into a knowledge graph following the specified options.
- :param json_path: Path to the JSON file to be decoded provided by the user.
- :type json_path: str
+ :param json_file_path: Path to the JSON file to be decoded provided by the user.
+ :type json_file_path: str
:param base_uri: Base URI to be used for generating URIs for ontology concepts.
Default is https://example.org#. (Optional)
:type base_uri: str
- :param graph_format: Format for saving the resulting knowledge graph.
- Default value is 'ttl' (Turtle syntax). (Optional)
- :type graph_format: str
:param language: Language tag to be added to the ontology's concepts. (Optional)
:type language: str
:param model_only: If True, only the OntoUML model will be extracted without diagrammatic information. (Optional)
@@ -63,21 +61,32 @@ Attributes
:rtype: Graph
-.. py:function:: write_graph_file(ontouml_graph, json_path, graph_format)
+.. py:function:: write_graph_file(ontouml_graph, execution_mode = 'script')
- Saves the ontology graph into a file with syntax defined by the user.
- The file is saved inside the 'results' directory also created by this function.
+ Saves the ontology graph received as argument into a file using the syntax defined by the user.
+
+ When running in script mode, the result is saved in the folder specified by the user as argument.
+ When running in test mode, the file is saved inside the 'results' directory created by this function.
:param ontouml_graph: Graph compliant with the OntoUML Vocabulary.
:type ontouml_graph: Graph
- :param json_path: Path to the input json file.
- :type json_path: str
- :param graph_format: Syntax selected by the user to save the graph.
- :type graph_format: str
+ :param execution_mode: Information about the execution mode.
+ Valid values are 'import' (default), 'script', and 'test'. (Optional)
+ :type execution_mode: str
+
:return: Saved output file path.
:rtype: str
+.. py:function:: decode_all_ontouml_json2graph()
+
+ Decode multiple OntoUML JSON files.
+
+ This function processes a directory of OntoUML JSON files and converts each file into a corresponding
+ knowledge graph using the specified options.
+ The output graphs are saved in the output directory chosen by the user as argument.
+
+
.. py:data:: decoded_graph
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt
similarity index 85%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt
index 232b5e0..d6b2089 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_general`
-===================================================
+:py:mod:`json2graph.decoder.decode_general`
+===========================================
-.. py:module:: json2graph.modules.decoder.decode_general
+.. py:module:: json2graph.decoder.decode_general
.. autoapi-nested-parse::
@@ -18,13 +18,13 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_general.create_point
- json2graph.modules.decoder.decode_general.count_elements_graph
- json2graph.modules.decoder.decode_general.get_stereotype
- json2graph.modules.decoder.decode_general.get_list_subdictionaries_for_specific_type
- json2graph.modules.decoder.decode_general.get_subdictionary_for_specific_id
- json2graph.modules.decoder.decode_general.get_all_ids_of_specific_type
- json2graph.modules.decoder.decode_general.clean_null_data
+ json2graph.decoder.decode_general.create_point
+ json2graph.decoder.decode_general.count_elements_graph
+ json2graph.decoder.decode_general.get_stereotype
+ json2graph.decoder.decode_general.get_list_subdictionaries_for_specific_type
+ json2graph.decoder.decode_general.get_subdictionary_for_specific_id
+ json2graph.decoder.decode_general.get_all_ids_of_specific_type
+ json2graph.decoder.decode_general.clean_null_data
@@ -33,7 +33,7 @@ Attributes
.. autoapisummary::
- json2graph.modules.decoder.decode_general.LOGGER
+ json2graph.decoder.decode_general.LOGGER
.. py:data:: LOGGER
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt
similarity index 85%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt
index 05f2373..91cef1d 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_main`
-================================================
+:py:mod:`json2graph.decoder.decode_main`
+========================================
-.. py:module:: json2graph.modules.decoder.decode_main
+.. py:module:: json2graph.decoder.decode_main
.. autoapi-nested-parse::
@@ -18,9 +18,9 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_main.add_metadata
- json2graph.modules.decoder.decode_main.decode_dictionary
- json2graph.modules.decoder.decode_main.decode_json_to_graph
+ json2graph.decoder.decode_main.add_metadata
+ json2graph.decoder.decode_main.decode_dictionary
+ json2graph.decoder.decode_main.decode_json_to_graph
@@ -29,7 +29,7 @@ Attributes
.. autoapisummary::
- json2graph.modules.decoder.decode_main.LOGGER
+ json2graph.decoder.decode_main.LOGGER
.. py:data:: LOGGER
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt
similarity index 88%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt
index 9d2423e..b3fc773 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_class`
-=====================================================
+:py:mod:`json2graph.decoder.decode_obj_class`
+=============================================
-.. py:module:: json2graph.modules.decoder.decode_obj_class
+.. py:module:: json2graph.decoder.decode_obj_class
.. autoapi-nested-parse::
@@ -24,17 +24,17 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_class.validate_class_attribute_constraints
- json2graph.modules.decoder.decode_obj_class.validate_class_order_constraints
- json2graph.modules.decoder.decode_obj_class.set_defaults_class_attribute
- json2graph.modules.decoder.decode_obj_class.set_defaults_class_order
- json2graph.modules.decoder.decode_obj_class.set_class_stereotype
- json2graph.modules.decoder.decode_obj_class.set_class_order_nonnegativeinteger
- json2graph.modules.decoder.decode_obj_class.set_class_restrictedto_ontologicalnature
- json2graph.modules.decoder.decode_obj_class.set_class_attributes
- json2graph.modules.decoder.decode_obj_class.set_class_attribute_property
- json2graph.modules.decoder.decode_obj_class.set_class_literal_literal
- json2graph.modules.decoder.decode_obj_class.create_class_properties
+ json2graph.decoder.decode_obj_class.validate_class_attribute_constraints
+ json2graph.decoder.decode_obj_class.validate_class_order_constraints
+ json2graph.decoder.decode_obj_class.set_defaults_class_attribute
+ json2graph.decoder.decode_obj_class.set_defaults_class_order
+ json2graph.decoder.decode_obj_class.set_class_stereotype
+ json2graph.decoder.decode_obj_class.set_class_order_nonnegativeinteger
+ json2graph.decoder.decode_obj_class.set_class_restrictedto_ontologicalnature
+ json2graph.decoder.decode_obj_class.set_class_attributes
+ json2graph.decoder.decode_obj_class.set_class_attribute_property
+ json2graph.decoder.decode_obj_class.set_class_literal_literal
+ json2graph.decoder.decode_obj_class.create_class_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt
similarity index 84%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt
index da4d8a5..432d528 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_diagram`
-=======================================================
+:py:mod:`json2graph.decoder.decode_obj_diagram`
+===============================================
-.. py:module:: json2graph.modules.decoder.decode_obj_diagram
+.. py:module:: json2graph.decoder.decode_obj_diagram
.. autoapi-nested-parse::
@@ -25,9 +25,9 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_diagram.set_diagram_owner_modelelement
- json2graph.modules.decoder.decode_obj_diagram.set_diagram_containsview_elementview
- json2graph.modules.decoder.decode_obj_diagram.create_diagram_properties
+ json2graph.decoder.decode_obj_diagram.set_diagram_owner_modelelement
+ json2graph.decoder.decode_obj_diagram.set_diagram_containsview_elementview
+ json2graph.decoder.decode_obj_diagram.create_diagram_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt
similarity index 84%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt
index 3ce73c1..1483d2b 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_elementview`
-===========================================================
+:py:mod:`json2graph.decoder.decode_obj_elementview`
+===================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_elementview
+.. py:module:: json2graph.decoder.decode_obj_elementview
.. autoapi-nested-parse::
@@ -25,8 +25,8 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_elementview.set_elementview_relations
- json2graph.modules.decoder.decode_obj_elementview.create_elementview_properties
+ json2graph.decoder.decode_obj_elementview.set_elementview_relations
+ json2graph.decoder.decode_obj_elementview.create_elementview_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt
similarity index 82%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt
index 2d4e2d1..6aadec2 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_generalization`
-==============================================================
+:py:mod:`json2graph.decoder.decode_obj_generalization`
+======================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_generalization
+.. py:module:: json2graph.decoder.decode_obj_generalization
.. autoapi-nested-parse::
@@ -25,8 +25,8 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_generalization.set_generalization_relations
- json2graph.modules.decoder.decode_obj_generalization.create_generalization_properties
+ json2graph.decoder.decode_obj_generalization.set_generalization_relations
+ json2graph.decoder.decode_obj_generalization.create_generalization_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt
similarity index 82%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt
index 6808484..dda7006 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_generalizationset`
-=================================================================
+:py:mod:`json2graph.decoder.decode_obj_generalizationset`
+=========================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_generalizationset
+.. py:module:: json2graph.decoder.decode_obj_generalizationset
.. autoapi-nested-parse::
@@ -25,9 +25,9 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_generalizationset.set_generalizationset_defaults
- json2graph.modules.decoder.decode_obj_generalizationset.set_generalizationset_relations
- json2graph.modules.decoder.decode_obj_generalizationset.create_generalizationset_properties
+ json2graph.decoder.decode_obj_generalizationset.set_generalizationset_defaults
+ json2graph.decoder.decode_obj_generalizationset.set_generalizationset_relations
+ json2graph.decoder.decode_obj_generalizationset.create_generalizationset_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt
similarity index 84%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt
index e11082a..3bd5503 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_package`
-=======================================================
+:py:mod:`json2graph.decoder.decode_obj_package`
+===============================================
-.. py:module:: json2graph.modules.decoder.decode_obj_package
+.. py:module:: json2graph.decoder.decode_obj_package
.. autoapi-nested-parse::
@@ -25,9 +25,9 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_package.get_package_contents
- json2graph.modules.decoder.decode_obj_package.set_package_containsmodelelement_modelelement
- json2graph.modules.decoder.decode_obj_package.create_package_properties
+ json2graph.decoder.decode_obj_package.get_package_contents
+ json2graph.decoder.decode_obj_package.set_package_containsmodelelement_modelelement
+ json2graph.decoder.decode_obj_package.create_package_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt
similarity index 84%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt
index fade6f1..b3b7e04 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_path`
-====================================================
+:py:mod:`json2graph.decoder.decode_obj_path`
+============================================
-.. py:module:: json2graph.modules.decoder.decode_obj_path
+.. py:module:: json2graph.decoder.decode_obj_path
.. autoapi-nested-parse::
@@ -25,8 +25,8 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_path.set_path_path_point
- json2graph.modules.decoder.decode_obj_path.create_path_properties
+ json2graph.decoder.decode_obj_path.set_path_path_point
+ json2graph.decoder.decode_obj_path.create_path_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt
similarity index 86%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt
index e40a944..b2e5f0c 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_project`
-=======================================================
+:py:mod:`json2graph.decoder.decode_obj_project`
+===============================================
-.. py:module:: json2graph.modules.decoder.decode_obj_project
+.. py:module:: json2graph.decoder.decode_obj_project
.. autoapi-nested-parse::
@@ -25,10 +25,10 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_project.set_ontoumlelement_project_project
- json2graph.modules.decoder.decode_obj_project.set_project_model_package
- json2graph.modules.decoder.decode_obj_project.set_project_diagram_diagram
- json2graph.modules.decoder.decode_obj_project.create_project_properties
+ json2graph.decoder.decode_obj_project.set_ontoumlelement_project_project
+ json2graph.decoder.decode_obj_project.set_project_model_package
+ json2graph.decoder.decode_obj_project.set_project_diagram_diagram
+ json2graph.decoder.decode_obj_project.create_project_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt
similarity index 88%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt
index fe70479..ab09bdc 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_property`
-========================================================
+:py:mod:`json2graph.decoder.decode_obj_property`
+================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_property
+.. py:module:: json2graph.decoder.decode_obj_property
.. autoapi-nested-parse::
@@ -25,12 +25,12 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_property.validate_property_stereotype
- json2graph.modules.decoder.decode_obj_property.set_property_defaults
- json2graph.modules.decoder.decode_obj_property.set_property_relations
- json2graph.modules.decoder.decode_obj_property.determine_cardinality_bounds
- json2graph.modules.decoder.decode_obj_property.set_cardinality_relations
- json2graph.modules.decoder.decode_obj_property.create_property_properties
+ json2graph.decoder.decode_obj_property.validate_property_stereotype
+ json2graph.decoder.decode_obj_property.set_property_defaults
+ json2graph.decoder.decode_obj_property.set_property_relations
+ json2graph.decoder.decode_obj_property.determine_cardinality_bounds
+ json2graph.decoder.decode_obj_property.set_cardinality_relations
+ json2graph.decoder.decode_obj_property.create_property_properties
@@ -39,7 +39,7 @@ Attributes
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_property.LOGGER
+ json2graph.decoder.decode_obj_property.LOGGER
.. py:data:: LOGGER
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt
similarity index 84%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt
index 52e994e..1596bed 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_rectangularshape`
-================================================================
+:py:mod:`json2graph.decoder.decode_obj_rectangularshape`
+========================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_rectangularshape
+.. py:module:: json2graph.decoder.decode_obj_rectangularshape
.. autoapi-nested-parse::
@@ -25,8 +25,8 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_rectangularshape.set_rectangularshape_coordinates
- json2graph.modules.decoder.decode_obj_rectangularshape.create_rectangularshape_properties
+ json2graph.decoder.decode_obj_rectangularshape.set_rectangularshape_coordinates
+ json2graph.decoder.decode_obj_rectangularshape.create_rectangularshape_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt
similarity index 86%
rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt
index 4b606db..c17526a 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder.decode_obj_relation`
-========================================================
+:py:mod:`json2graph.decoder.decode_obj_relation`
+================================================
-.. py:module:: json2graph.modules.decoder.decode_obj_relation
+.. py:module:: json2graph.decoder.decode_obj_relation
.. autoapi-nested-parse::
@@ -25,10 +25,10 @@ Functions
.. autoapisummary::
- json2graph.modules.decoder.decode_obj_relation.set_relation_defaults
- json2graph.modules.decoder.decode_obj_relation.set_relation_stereotype
- json2graph.modules.decoder.decode_obj_relation.set_relation_relations
- json2graph.modules.decoder.decode_obj_relation.create_relation_properties
+ json2graph.decoder.decode_obj_relation.set_relation_defaults
+ json2graph.decoder.decode_obj_relation.set_relation_stereotype
+ json2graph.decoder.decode_obj_relation.set_relation_relations
+ json2graph.decoder.decode_obj_relation.create_relation_properties
diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/index.rst.txt
similarity index 81%
rename from docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt
rename to docs/_sources/autoapi/json2graph/decoder/index.rst.txt
index d3faf97..8db2600 100644
--- a/docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/decoder/index.rst.txt
@@ -1,7 +1,7 @@
-:py:mod:`json2graph.modules.decoder`
-====================================
+:py:mod:`json2graph.decoder`
+============================
-.. py:module:: json2graph.modules.decoder
+.. py:module:: json2graph.decoder
Submodules
diff --git a/docs/_sources/autoapi/json2graph/index.rst.txt b/docs/_sources/autoapi/json2graph/index.rst.txt
index 1a849a2..cb1b4dc 100644
--- a/docs/_sources/autoapi/json2graph/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/index.rst.txt
@@ -10,8 +10,8 @@ Subpackages
:titlesonly:
:maxdepth: 3
+ decoder/index.rst
modules/index.rst
- resources/index.rst
tests/index.rst
diff --git a/docs/_sources/autoapi/json2graph/library/index.rst.txt b/docs/_sources/autoapi/json2graph/library/index.rst.txt
index 41abbf8..aaec849 100644
--- a/docs/_sources/autoapi/json2graph/library/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/library/index.rst.txt
@@ -32,7 +32,7 @@ Functions
-.. py:function:: decode_json_project(json_path, base_uri = 'https://example.org#', language = '', correct = False)
+.. py:function:: decode_json_project(json_file_path, base_uri = 'https://example.org#', language = '', correct = False)
Decodes elements from OntoUML's abstract and concrete syntax from JSON format into a Knowledge Graph.
I.e., domain-level and diagrammatic data are converted to Knowledge Graph.
@@ -41,8 +41,8 @@ Functions
that adheres to the OntoUML Vocabulary. It provides customization options for URI generation, language tags,
error correction, and returns the resulting knowledge graph.
- :param json_path: Path to the JSON file to be decoded provided by the user.
- :type json_path: str
+ :param json_file_path: Path to the JSON file to be decoded provided by the user.
+ :type json_file_path: str
:param base_uri: Base URI to be used for generating URIs for ontology concepts.
Default is "https://example.org#". (Optional)
:type base_uri: str
@@ -56,7 +56,7 @@ Functions
:rtype: Graph
-.. py:function:: decode_json_model(json_path, base_uri = 'https://example.org#', language = '', correct = False)
+.. py:function:: decode_json_model(json_file_path, base_uri = 'https://example.org#', language = '', correct = False)
Decodes elements from OntoUML's abstract syntax from JSON format into a Knowledge Graph.
I.e., only domain-level (and not diagrammatic) data is converted to Knowledge Graph.
@@ -65,8 +65,8 @@ Functions
that adheres to the OntoUML Vocabulary. It provides customization options for URI generation, language tags,
error correction, and returns the resulting knowledge graph.
- :param json_path: Path to the JSON file to be decoded provided by the user.
- :type json_path: str
+ :param json_file_path: Path to the JSON file to be decoded provided by the user.
+ :type json_file_path: str
:param base_uri: Base URI to be used for generating URIs for ontology concepts.
Default is "https://example.org#". (Optional)
:type base_uri: str
diff --git a/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt
index 67db468..6deea5e 100644
--- a/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt
@@ -24,8 +24,9 @@ Functions
.. autoapisummary::
- json2graph.modules.arguments.treat_user_arguments
- json2graph.modules.arguments.initialize_arguments
+ json2graph.modules.arguments.initialize_args_script
+ json2graph.modules.arguments.initialize_args_import
+ json2graph.modules.arguments.initialize_args_test
@@ -46,33 +47,56 @@ Attributes
-.. py:function:: treat_user_arguments()
+.. py:function:: initialize_args_script()
This function parses the command-line arguments provided by the user and performs necessary validations.
+
- :return: Dictionary with json path (key 'json_path') and final file format (key 'format').
- :rtype: dict
-
-.. py:function:: initialize_arguments(json_path = 'not_initialized', base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import')
+.. py:function:: initialize_args_import(input_path = 'not_initialized', output_path = os.getcwd(), base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False)
This function initializes the global variable ARGUMENTS of type dictionary, which contains user-provided
(when executed in script mode) or default arguments (when executed as a library or for testing).
The ARGUMENTS variable must be initialized in every possible execution mode.
- The valid execution modes are:
- - 'script': If used as a script, use user's arguments parsed from the command line.
- - 'package': When imported into external code, working as a library package.
- - 'test': Used for testing.
+ :param input_path: Path to the directory or JSON file to be decoded. (Optional)
+ :type input_path: str
+ :param output_path: Path to the directory in which the result file(s) will be saved. (Optional)
+ :type output_path: str
+ :param base_uri: Base URI to be used for generating URIs for ontology concepts. (Optional)
+ Default is "https://example.org#".
+ :type base_uri: str
+ :param graph_format: Format for saving the resulting knowledge graph. (Optional)
+ Default value is 'ttl' (Turtle syntax).
+ :type graph_format: str
+ :param language: Language tag to be added to the ontology's concepts. (Optional)
+ :type language: str
+ :param model_only: If True, only the OntoUML model will be extracted without diagrammatic information. (Optional)
+ :type model_only: bool
+ :param silent: If True, suppresses intermediate communications and log messages during execution. (Optional)
+ :type silent: bool
+ :param correct: If True, attempts to correct potential errors during the conversion process. (Optional)
+ :type correct: bool
+
+.. py:function:: initialize_args_test(input_path = 'not_initialized', language = '')
+
+ This function initializes the global variable ARGUMENTS of type dictionary, which contains user-provided
+ (when executed in script mode) or default arguments (when executed as a library or for testing).
+ The ARGUMENTS variable must be initialized in every possible execution mode.
- :param json_path: Path to the JSON file to be decoded provided by the user. (Optional)
- :type json_path: str
- :param base_uri: Base URI to be used for generating URIs for ontology concepts.
- Default is "https://example.org#". (Optional)
+ :param input_path: Path to the directory or JSON file to be decoded. (Optional)
+ :type input_path: str
+ :param output_path: Path to the directory in which the result file(s) will be saved. (Optional)
+ :type output_path: str
+ :param decode_all: Informs if user wants to convert all json files in the input_path performing the decode
+ function multiple times. (Optional)
+ :type decode_all: bool
+ :param base_uri: Base URI to be used for generating URIs for ontology concepts. (Optional)
+ Default is "https://example.org#".
:type base_uri: str
- :param graph_format: Format for saving the resulting knowledge graph.
- Default value is 'ttl' (Turtle syntax). (Optional)
+ :param graph_format: Format for saving the resulting knowledge graph. (Optional)
+ Default value is 'ttl' (Turtle syntax).
:type graph_format: str
:param language: Language tag to be added to the ontology's concepts. (Optional)
:type language: str
@@ -82,8 +106,5 @@ Attributes
:type silent: bool
:param correct: If True, attempts to correct potential errors during the conversion process. (Optional)
:type correct: bool
- :param execution_mode: Information about the execution mode.
- Valid values are 'import' (default), 'script', and 'test'. (Optional)
- :type execution_mode: str
diff --git a/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt
index 514613a..7fb62fe 100644
--- a/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt
@@ -5,7 +5,9 @@
.. autoapi-nested-parse::
- Functions related to the verification and treatment of identified ERROR cases.
+ This module provides a collection of functions for reporting various error scenarios that can occur during the software
+ execution. These functions are designed to improve the robustness and reliability of the program by providing clear
+ error messages and raising appropriate exceptions when necessary.
@@ -19,6 +21,7 @@ Functions
.. autoapisummary::
json2graph.modules.errors.report_error_requirement_not_met
+ json2graph.modules.errors.report_error_invalid_parameter
json2graph.modules.errors.report_error_end_of_switch
json2graph.modules.errors.report_error_io_read
json2graph.modules.errors.report_error_io_write
@@ -44,6 +47,25 @@ Attributes
:param error_message: Message to be printed to the user indicating the detected error.
:type error_message: str
+
+ :raises ValueError: Always.
+
+
+.. py:function:: report_error_invalid_parameter(invalid_parameter, list_valid_parameters, caller_function_name)
+
+ Reports the error caused when an invalid parameter is passed to a function. E.g., the function accepts (i.e.,
+ list_valid_parameters is) ["alfa", "beta"] and the received parameter (invalid_parameter) was "gama".
+
+ NOTE 1: This function must be used only for validation of parameters of type string.
+ NOTE 2: caller_function_name can be obtained from 'current_function = inspect.stack()[0][3]'
+
+ :param invalid_parameter: Used parameter value that was evaluated as not valid.
+ :type invalid_parameter: str
+ :param list_valid_parameters: List of valid values for the evaluated parameter.
+ :type list_valid_parameters: list[str]
+ :param caller_function_name: Name of the function in which the invalid parameter was used.
+ :type caller_function_name: str
+
:raises ValueError: Always.
@@ -58,6 +80,7 @@ Attributes
:type invalid_parameter: str
:param caller_function_name: Name of the function in which the invalid parameter was used.
:type caller_function_name: str
+
:raises ValueError: Always.
@@ -71,6 +94,7 @@ Attributes
:type file_description: str
:param error: Error raised by the IO operation.
:type error: OSError
+
:raises OSError: Always.
@@ -84,6 +108,7 @@ Attributes
:type file_description: str
:param error: Error raised by the IO operation.
:type error: OSError
+
:raises OSError: Always.
diff --git a/docs/_sources/autoapi/json2graph/modules/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/index.rst.txt
index 9196f61..21c1cfc 100644
--- a/docs/_sources/autoapi/json2graph/modules/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/index.rst.txt
@@ -4,15 +4,6 @@
.. py:module:: json2graph.modules
-Subpackages
------------
-.. toctree::
- :titlesonly:
- :maxdepth: 3
-
- decoder/index.rst
-
-
Submodules
----------
.. toctree::
@@ -28,5 +19,6 @@ Submodules
sparql_queries/index.rst
utils_general/index.rst
utils_graph/index.rst
+ utils_validations/index.rst
diff --git a/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt
index f5653be..f327ec3 100644
--- a/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt
@@ -5,7 +5,7 @@
.. autoapi-nested-parse::
- This module provides functions for configuring a logger that outputs messages to both the console and a log file.
+ This module provides functions for configuring a logger that outputs messages to the console.
The logger can be customized based on different execution modes, allowing you to control the log level.
@@ -34,7 +34,8 @@ Functions
.. py:function:: initialize_logger(execution_mode = 'script')
- Create and initialize logger. The created logger is called 'execution-logger'.
+ Create and initialize logger named 'execution-logger'.
+
Different triggers are defined for each execution mode:
- script: INFO
- import: ERROR
diff --git a/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt
index fee83cc..60ccb4c 100644
--- a/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt
@@ -18,24 +18,10 @@ Functions
.. autoapisummary::
- json2graph.modules.utils_general.count_elements_types
json2graph.modules.utils_general.get_date_time
-.. py:function:: count_elements_types(element_type_list, element_counting)
-
- Returns the number of elements (in the already counted data) of the types given in a list.
- Receives a dictionary of number of items and returns the value corresponding to the provided argument.
-
- :param element_type_list: List of types of elements to have their count value returned.
- :type element_type_list: list[str]
- :param element_counting: Dictionary with types and corresponding number of occurrences.
- :type element_counting: dict
- :return: Number of occurrences of the element of the given type.
- :rtype: int
-
-
.. py:function:: get_date_time(date_time_format)
Return a string with date and time according to the specified format received as argument.
diff --git a/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt
index 0f442d5..c24b88b 100644
--- a/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt
@@ -21,7 +21,6 @@ Functions
json2graph.modules.utils_graph.ontouml_ref
json2graph.modules.utils_graph.load_ontouml_vocabulary
json2graph.modules.utils_graph.load_graph_safely
- json2graph.modules.utils_graph.get_all_ids_for_type
@@ -69,13 +68,3 @@ Attributes
:rtype: Graph
-.. py:function:: get_all_ids_for_type(ontology_graph, element_type)
-
- Queries the graph for all elements of the given element_type and returns a list of their ids.
-
- :param ontology_file: Loaded ontology graph.
- :type ontology_file: Graph
- :param element_type: Type of the element (originally a JSON object) to be queried to have their ids returned .
- :type element_type: list[str]
-
-
diff --git a/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt
new file mode 100644
index 0000000..d9ed667
--- /dev/null
+++ b/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt
@@ -0,0 +1,47 @@
+:py:mod:`json2graph.modules.utils_validations`
+==============================================
+
+.. py:module:: json2graph.modules.utils_validations
+
+.. autoapi-nested-parse::
+
+ Functions that performs validations for different functions or parameters used in the software.
+
+
+
+Module Contents
+---------------
+
+
+Functions
+~~~~~~~~~
+
+.. autoapisummary::
+
+ json2graph.modules.utils_validations.validate_arg_input
+ json2graph.modules.utils_validations.validate_execution_mode
+
+
+
+.. py:function:: validate_arg_input(input_path, decode_all)
+
+ Validates the input path received as argument.
+
+ :param input_path: The path to the input file or directory.
+ :type input_path: str
+ :param decode_all: A flag indicating whether to decode all files in the directory.
+ :type decode_all: bool
+
+
+.. py:function:: validate_execution_mode(execution_mode)
+
+ Validate the provided execution mode against a list of valid modes.
+
+ This function validates the given execution mode against a predefined list of valid modes: ["script", "import",
+ "test"]. It ensures that the provided mode is one of the accepted values, and if not, raises an error indicating
+ the invalid parameter.
+
+ :param execution_mode: The execution mode to be validated.
+ :type execution_mode: str
+
+
diff --git a/docs/_sources/autoapi/json2graph/resources/index.rst.txt b/docs/_sources/autoapi/json2graph/resources/index.rst.txt
deleted file mode 100644
index 3f94604..0000000
--- a/docs/_sources/autoapi/json2graph/resources/index.rst.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-:py:mod:`json2graph.resources`
-==============================
-
-.. py:module:: json2graph.resources
-
-
diff --git a/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt b/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt
deleted file mode 100644
index 2f9c80a..0000000
--- a/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-:py:mod:`json2graph.tests.deprecated_test_clear`
-================================================
-
-.. py:module:: json2graph.tests.deprecated_test_clear
-
-.. autoapi-nested-parse::
-
- This Python module provides a simple script to remove all files with the ".ttl" extension from the
- tests/results directory and then remove the directory itself.
-
-
-
-Module Contents
----------------
-
-.. py:data:: dir_name
- :value: 'results'
-
-
-
-.. py:data:: test
-
-
-
diff --git a/docs/_sources/autoapi/json2graph/tests/index.rst.txt b/docs/_sources/autoapi/json2graph/tests/index.rst.txt
index 2cc26e1..cfaa757 100644
--- a/docs/_sources/autoapi/json2graph/tests/index.rst.txt
+++ b/docs/_sources/autoapi/json2graph/tests/index.rst.txt
@@ -10,7 +10,6 @@ Submodules
:titlesonly:
:maxdepth: 1
- deprecated_test_clear/index.rst
test_aux/index.rst
test_main/index.rst
diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt
index d5ac17e..680f77a 100644
--- a/docs/_sources/index.rst.txt
+++ b/docs/_sources/index.rst.txt
@@ -19,7 +19,11 @@ Welcome to ontouml-json2graph's documentation!
.. list-table::
* - Badges
- - |repo-status| |commits-latest| |published-at| |pypi-project| |pypi-downloads| |language-top| |language-version| |codefactor| |ossf-scorecard| |license|
+ - |zenodo-doi| |repo-status| |commits-latest| |published-at| |pypi-project| |pypi-downloads| |language-top| |language-version| |codefactor| |ossf-scorecard| |license|
+
+.. |zenodo-doi| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214977.svg
+ :target: https://doi.org/10.5281/zenodo.8214977
+ :alt: DOI
.. |repo-status| image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
diff --git a/docs/_static/basic.css b/docs/_static/basic.css
index cfc60b8..30fee9d 100644
--- a/docs/_static/basic.css
+++ b/docs/_static/basic.css
@@ -237,6 +237,10 @@ a.headerlink {
visibility: hidden;
}
+a:visited {
+ color: #551A8B;
+}
+
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js
index 2281e7d..e15aace 100644
--- a/docs/_static/documentation_options.js
+++ b/docs/_static/documentation_options.js
@@ -1,5 +1,4 @@
-var DOCUMENTATION_OPTIONS = {
- URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
+const DOCUMENTATION_OPTIONS = {
VERSION: '1.0.2',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js
index 97d56a7..7918c3f 100644
--- a/docs/_static/searchtools.js
+++ b/docs/_static/searchtools.js
@@ -57,12 +57,12 @@ const _removeChildren = (element) => {
const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
-const _displayItem = (item, searchTerms) => {
+const _displayItem = (item, searchTerms, highlightTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
- const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
+ const contentRoot = document.documentElement.dataset.content_root;
const [docName, title, anchor, descr, score, _filename] = item;
@@ -75,20 +75,24 @@ const _displayItem = (item, searchTerms) => {
if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = "";
- requestUrl = docUrlRoot + dirname;
+ requestUrl = contentRoot + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
- requestUrl = docUrlRoot + docName + docFileSuffix;
+ requestUrl = contentRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix;
}
let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + anchor;
linkEl.dataset.score = score;
linkEl.innerHTML = title;
- if (descr)
+ if (descr) {
listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")";
+ // highlight search terms in the description
+ if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
+ highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
+ }
else if (showSearchSummary)
fetch(requestUrl)
.then((responseData) => responseData.text())
@@ -97,6 +101,9 @@ const _displayItem = (item, searchTerms) => {
listItem.appendChild(
Search.makeSearchSummary(data, searchTerms)
);
+ // highlight search terms in the summary
+ if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
+ highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
});
Search.output.appendChild(listItem);
};
@@ -115,14 +122,15 @@ const _finishSearch = (resultCount) => {
const _displayNextItem = (
results,
resultCount,
- searchTerms
+ searchTerms,
+ highlightTerms,
) => {
// results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount)
if (results.length) {
- _displayItem(results.pop(), searchTerms);
+ _displayItem(results.pop(), searchTerms, highlightTerms);
setTimeout(
- () => _displayNextItem(results, resultCount, searchTerms),
+ () => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
5
);
}
@@ -360,7 +368,7 @@ const Search = {
// console.info("search results:", Search.lastresults);
// print the results
- _displayNextItem(results, results.length, searchTerms);
+ _displayNextItem(results, results.length, searchTerms, highlightTerms);
},
/**
diff --git a/docs/_static/sphinx_highlight.js b/docs/_static/sphinx_highlight.js
index aae669d..8a96c69 100644
--- a/docs/_static/sphinx_highlight.js
+++ b/docs/_static/sphinx_highlight.js
@@ -29,14 +29,19 @@ const _highlight = (node, addItems, text, className) => {
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
+ const rest = document.createTextNode(val.substr(pos + text.length));
parent.insertBefore(
span,
parent.insertBefore(
- document.createTextNode(val.substr(pos + text.length)),
+ rest,
node.nextSibling
)
);
node.nodeValue = val.substr(0, pos);
+ /* There may be more occurrences of search term in this node. So call this
+ * function recursively on the remaining fragment.
+ */
+ _highlight(rest, addItems, text, className);
if (isInSVG) {
const rect = document.createElementNS(
@@ -140,5 +145,10 @@ const SphinxHighlight = {
},
};
-_ready(SphinxHighlight.highlightSearchWords);
-_ready(SphinxHighlight.initEscapeListener);
+_ready(() => {
+ /* Do not call highlightSearchWords() when we are on the search page.
+ * It will highlight words from the *previous* search query.
+ */
+ if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords();
+ SphinxHighlight.initEscapeListener();
+});
diff --git a/docs/autoapi/index.html b/docs/autoapi/index.html
index be80a3c..e3e135b 100644
--- a/docs/autoapi/index.html
+++ b/docs/autoapi/index.html
@@ -15,9 +15,9 @@
-
+
-
+
@@ -79,28 +79,28 @@
-API Reference
+API Reference
This page contains auto-generated API reference documentation [1].
json2graph
-json2graph.modules
-json2graph.modules.decoder
-json2graph.modules.decoder.decode_general
-json2graph.modules.decoder.decode_main
-json2graph.modules.decoder.decode_obj_class
-json2graph.modules.decoder.decode_obj_diagram
-json2graph.modules.decoder.decode_obj_elementview
-json2graph.modules.decoder.decode_obj_generalization
-json2graph.modules.decoder.decode_obj_generalizationset
-json2graph.modules.decoder.decode_obj_package
-json2graph.modules.decoder.decode_obj_path
-json2graph.modules.decoder.decode_obj_project
-json2graph.modules.decoder.decode_obj_property
-json2graph.modules.decoder.decode_obj_rectangularshape
-json2graph.modules.decoder.decode_obj_relation
+json2graph.decoder
+json2graph.decoder.decode_general
+json2graph.decoder.decode_main
+json2graph.decoder.decode_obj_class
+json2graph.decoder.decode_obj_diagram
+json2graph.decoder.decode_obj_elementview
+json2graph.decoder.decode_obj_generalization
+json2graph.decoder.decode_obj_generalizationset
+json2graph.decoder.decode_obj_package
+json2graph.decoder.decode_obj_path
+json2graph.decoder.decode_obj_project
+json2graph.decoder.decode_obj_property
+json2graph.decoder.decode_obj_rectangularshape
+json2graph.decoder.decode_obj_relation
+json2graph.modules
json2graph.modules.arguments
json2graph.modules.errors
json2graph.modules.globals
@@ -110,11 +110,10 @@ API Referencejson2graph.modules.sparql_queries
json2graph.modules.utils_general
json2graph.modules.utils_graph
+json2graph.modules.utils_validations
-json2graph.resources
json2graph.tests
diff --git a/docs/autoapi/json2graph/decode/index.html b/docs/autoapi/json2graph/decode/index.html
index 9991945..a1b9821 100644
--- a/docs/autoapi/json2graph/decode/index.html
+++ b/docs/autoapi/json2graph/decode/index.html
@@ -15,9 +15,9 @@
-
+
-
+
@@ -89,26 +89,29 @@
-json2graph.decode
+json2graph.decode
Main function used as script to convert OntoUML JSON files into knowledge graphs, with the flexibility to
customize the output and control the execution mode for different use cases.
-Module Contents
+Module Contents
-Functions
+Functions
-decode_ontouml_json2graph
(json_path[, base_uri, ...])
+decode_ontouml_json2graph
(json_file_path[, base_uri, ...])
Main function for converting OntoUML JSON data to a Knowledge Graph.
-write_graph_file
(ontouml_graph, json_path, graph_format)
-Saves the ontology graph into a file with syntax defined by the user.
+write_graph_file
(ontouml_graph[, execution_mode])
+Saves the ontology graph received as argument into a file using the syntax defined by the user.
+
+
+Decode multiple OntoUML JSON files.
-Attributes
+Attributes
Contents
+Contents
The OntoUML JSON2Graph Transformation
@@ -156,7 +157,7 @@Contents -
Installation
+Installation
Before using the OntoUML JSON2Graph Decoder, you need to download and install Python. To install the application you simply need to perform the following command:
pip install ontouml-json2graph @@ -165,27 +166,40 @@
Installation -
Usage
+Usage
After being installed, the OntoUML JSON2Graph Decoder can be used as an executable script or imported as a library into another Python project.
The output of the transformation, i.e., the graph file, will be saved into a directory named
results
in the same path in which the software was executed.- Executing as a Script
+Executing as a Script
For executing the software, run the following command on the terminal inside the project’s folder:
+python -m json2graph.decode [path_to_json] [OPTIONAL ARGUMENTS]
For example, to decode the JSON file
+my_ontology.json
and save the output graph in the Turtle format, you would run the following command:++python -m json2graph.decode -i turtle my_ontology.json +
You can also use the script to decode multiple JSON files. To do this, you would use the
+decode_all
option (‘-a’ argument). +For example, to decode all of the JSON files in the my_data directory you would run the following command:+python -m json2graph.decode -a -i my_data +
- Arguments
+Arguments
The only mandatory argument is
-path_to_json
, which must be substituted for the input file’s location on your computer. Optional arguments provide additional features. All available ontouml-json2graph arguments can be observed below.usage: ontouml-json2graph [-h] [-f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}] [-l LANGUAGE] [-c] [-s] [-u BASE_URI] [-m] [-v] json_path +
usage: ontouml-json2graph [-h] -i INPUT_PATH [-o OUTPUT_PATH] [-a] [-f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}] + [-l LANGUAGE] [-c] [-s] [-u BASE_URI] [-m] [-v] -OntoUML JSON2Graph Decoder. Version: 1.1.0 -positional arguments: - json_path The path of the JSON file to be encoded. +OntoUML JSON2Graph Decoder. Version: 1.2.0 options: -h, --help show this help message and exit + -i INPUT_PATH, --input_path INPUT_PATH + The path of the JSON file or directory with JSON files to be decoded. + -o OUTPUT_PATH, --output_path OUTPUT_PATH + The path of the directory in which the resulting decoded file(s) will be saved. Default is the working directory. + -a, --decode_all Converts all JSON files in the informed path. -f {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads}, --format {turtle,ttl,turtle2,xml,pretty-xml,json-ld,ntriples,nt,nt11,n3,trig,trix,nquads} Format to save the decoded file. Default is 'ttl'. -l LANGUAGE, --language LANGUAGE @@ -197,38 +211,40 @@
Arguments -
Importing as a Library
+Importing as a Library
The
library.py
module (full docummentation) is a user-friendly component of theontouml-json2graph
package. By encapsulating complex functionalities, this library empowers users to seamlessly integrate OntoUML JSON conversion capabilities into their projects. In addition to conversion functions, the library provides a utility function for safely saving OntoUML graphs to files in the desired syntax.The library provides the following functions for decoding OntoUML JSON data and saving OntoUML graphs to files:
- decode_json_project
+decode_json_project
The
decode_json_project
function allows you to decode the complete OntoUML JSON data (including elements from OntoUML’s abstract and concrete syntax) into a knowledge graph that conforms to the OntoUML Vocabulary. This function provides customization options, such as specifying the base URI for ontology concepts, adding language tags, and enabling error correction. With this function domain-level and diagrammatic data are converted to Knowledge Graph.from json2graph.library import decode_json_project -decoded_graph_project = decode_json_project(json_path="path/to/input.json", base_uri="https://myuri.org#", +decoded_graph_project = decode_json_project(json_file_path="path/to/input.json", base_uri="https://myuri.org#", language="en", correct=True)
- decode_json_model
+decode_json_model
The
decode_json_model
function decodes OntoUML JSON data representing a model-level view into a knowledge graph that adheres to the OntoUML Vocabulary.Differently from the
decode_json_model
, this function decodes only elements from the OntoUML’s abstract syntax. I.e., only domain-level (and not diagrammatic) data is converted to knowledge graph. It offers options for base URI, language tags, and error correction.from json2graph.library import decode_json_model -decoded_graph_model = decode_json_model(json_path="path/to/input.json", base_uri="https://myuri.org#", language="en", +decoded_graph_model = decode_json_model(json_file_path="path/to/input.json", base_uri="https://myuri.org#", + language="en", correct=True)
- save_graph_file
+save_graph_file
The
save_graph_file
utility function provides a convenient way to save an OntoUML graph as an RDF file in the desired syntax.from json2graph.library import save_graph_file @@ -241,13 +257,13 @@
save_graph_file -
Input and Output
+Input and Output
This software’s input is a JSON file that complies with the OntoUML Schema. This JSON file can be obtained from the ontouml-vp-plugin’s export feature. The JSON2Graph Decoder was tested to guarantee its compatibility with the JSON generated by the plugin’s version 0.5.3.
The transformation’s output corresponds to the OntoUML Model serialized as a graph. The saved file information is described by the OntoUML Vocabulary and can be saved in the different formats that are supported by the RDFLib. This output graph may contain the model’s diagrammatic information or not, depending on the user’s provided arguments. The OntoUML Vocabulary documentation contains a userge overview, presenting information about all available elements, and about how to use them, including examples of SPARQL queries.
Both the input and output of the software are built upon the same metamodel, the OntoUML Metamodel, which facilitates the conversion between different representations.
- OntoUML Vocabulary and gUFO
+OntoUML Vocabulary and gUFO
The ontouml-vp-plugin has a feature that enables an ontology to be transformed from OntoUML to a graph format. This feature is called the Model Transformation to OWL with gUFO. gUFO is a lightweight implementation of the OntoUML’s underlying foundational ontology, the Unified Foundational Ontology (UFO).
Even though an ontology represented in gUFO and in the OntoUML Vocabulary are both suitable for Semantic Web OWL 2 DL applications, these two representations are different and were created with different purposes.
@@ -257,7 +273,7 @@OntoUML Vocabulary and gUFO -
Basic Syntactical and Sematic Validation
+Basic Syntactical and Sematic Validation
Class validations:
-
@@ -287,7 +303,7 @@
Repository: https://w3id.org/ontouml/json2graph
Documentation: https://w3id.org/ontouml/json2graph/docs
@@ -301,7 +317,7 @@ OntoUML Metamodel: Implementation-independent OntoUML Metamodel. Unlike the UML profile, this version is independent of UML and presents only the concepts officially supported in the language. This metamodel covers the abstract and concrete syntaxes of the language and serves as the reference for all projects in the OntoUML as a Service (OaaS) ecosystem, including its different model serializations.
OntoUML Vocabulary: An OntoUML Metamodel’s serialization in Turtle (ttl) format. This vocabulary supports the serialization, exchange, and publishing of OntoUML models as graphs that can be used for Semantic Web and Linked Data applications.
@@ -310,7 +326,7 @@ - diff --git a/docs/_sources/autoapi/json2graph/decode/index.rst.txt b/docs/_sources/autoapi/json2graph/decode/index.rst.txt index 2beb9c1..d4246be 100644 --- a/docs/_sources/autoapi/json2graph/decode/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decode/index.rst.txt @@ -21,6 +21,7 @@ Functions json2graph.decode.decode_ontouml_json2graph json2graph.decode.write_graph_file + json2graph.decode.decode_all_ontouml_json2graph @@ -32,21 +33,18 @@ Attributes json2graph.decode.decoded_graph -.. py:function:: decode_ontouml_json2graph(json_path, base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import') +.. py:function:: decode_ontouml_json2graph(json_file_path, base_uri = 'https://example.org#', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import') Main function for converting OntoUML JSON data to a Knowledge Graph. This function takes the path to a JSON file representing OntoUML model data provided by the user and converts it into a knowledge graph following the specified options. - :param json_path: Path to the JSON file to be decoded provided by the user. - :type json_path: str + :param json_file_path: Path to the JSON file to be decoded provided by the user. + :type json_file_path: str :param base_uri: Base URI to be used for generating URIs for ontology concepts. Default is https://example.org#. (Optional) :type base_uri: str - :param graph_format: Format for saving the resulting knowledge graph. - Default value is 'ttl' (Turtle syntax). (Optional) - :type graph_format: str :param language: Language tag to be added to the ontology's concepts. (Optional) :type language: str :param model_only: If True, only the OntoUML model will be extracted without diagrammatic information. (Optional) @@ -63,21 +61,32 @@ Attributes :rtype: Graph -.. py:function:: write_graph_file(ontouml_graph, json_path, graph_format) +.. py:function:: write_graph_file(ontouml_graph, execution_mode = 'script') - Saves the ontology graph into a file with syntax defined by the user. - The file is saved inside the 'results' directory also created by this function. + Saves the ontology graph received as argument into a file using the syntax defined by the user. + + When running in script mode, the result is saved in the folder specified by the user as argument. + When running in test mode, the file is saved inside the 'results' directory created by this function. :param ontouml_graph: Graph compliant with the OntoUML Vocabulary. :type ontouml_graph: Graph - :param json_path: Path to the input json file. - :type json_path: str - :param graph_format: Syntax selected by the user to save the graph. - :type graph_format: str + :param execution_mode: Information about the execution mode. + Valid values are 'import' (default), 'script', and 'test'. (Optional) + :type execution_mode: str + :return: Saved output file path. :rtype: str +.. py:function:: decode_all_ontouml_json2graph() + + Decode multiple OntoUML JSON files. + + This function processes a directory of OntoUML JSON files and converts each file into a corresponding + knowledge graph using the specified options. + The output graphs are saved in the output directory chosen by the user as argument. + + .. py:data:: decoded_graph diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt similarity index 85% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt index 232b5e0..d6b2089 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_general/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_general/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_general` -=================================================== +:py:mod:`json2graph.decoder.decode_general` +=========================================== -.. py:module:: json2graph.modules.decoder.decode_general +.. py:module:: json2graph.decoder.decode_general .. autoapi-nested-parse:: @@ -18,13 +18,13 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_general.create_point - json2graph.modules.decoder.decode_general.count_elements_graph - json2graph.modules.decoder.decode_general.get_stereotype - json2graph.modules.decoder.decode_general.get_list_subdictionaries_for_specific_type - json2graph.modules.decoder.decode_general.get_subdictionary_for_specific_id - json2graph.modules.decoder.decode_general.get_all_ids_of_specific_type - json2graph.modules.decoder.decode_general.clean_null_data + json2graph.decoder.decode_general.create_point + json2graph.decoder.decode_general.count_elements_graph + json2graph.decoder.decode_general.get_stereotype + json2graph.decoder.decode_general.get_list_subdictionaries_for_specific_type + json2graph.decoder.decode_general.get_subdictionary_for_specific_id + json2graph.decoder.decode_general.get_all_ids_of_specific_type + json2graph.decoder.decode_general.clean_null_data @@ -33,7 +33,7 @@ Attributes .. autoapisummary:: - json2graph.modules.decoder.decode_general.LOGGER + json2graph.decoder.decode_general.LOGGER .. py:data:: LOGGER diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt similarity index 85% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt index 05f2373..91cef1d 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_main/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_main/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_main` -================================================ +:py:mod:`json2graph.decoder.decode_main` +======================================== -.. py:module:: json2graph.modules.decoder.decode_main +.. py:module:: json2graph.decoder.decode_main .. autoapi-nested-parse:: @@ -18,9 +18,9 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_main.add_metadata - json2graph.modules.decoder.decode_main.decode_dictionary - json2graph.modules.decoder.decode_main.decode_json_to_graph + json2graph.decoder.decode_main.add_metadata + json2graph.decoder.decode_main.decode_dictionary + json2graph.decoder.decode_main.decode_json_to_graph @@ -29,7 +29,7 @@ Attributes .. autoapisummary:: - json2graph.modules.decoder.decode_main.LOGGER + json2graph.decoder.decode_main.LOGGER .. py:data:: LOGGER diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt similarity index 88% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt index 9d2423e..b3fc773 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_class/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_class/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_class` -===================================================== +:py:mod:`json2graph.decoder.decode_obj_class` +============================================= -.. py:module:: json2graph.modules.decoder.decode_obj_class +.. py:module:: json2graph.decoder.decode_obj_class .. autoapi-nested-parse:: @@ -24,17 +24,17 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_class.validate_class_attribute_constraints - json2graph.modules.decoder.decode_obj_class.validate_class_order_constraints - json2graph.modules.decoder.decode_obj_class.set_defaults_class_attribute - json2graph.modules.decoder.decode_obj_class.set_defaults_class_order - json2graph.modules.decoder.decode_obj_class.set_class_stereotype - json2graph.modules.decoder.decode_obj_class.set_class_order_nonnegativeinteger - json2graph.modules.decoder.decode_obj_class.set_class_restrictedto_ontologicalnature - json2graph.modules.decoder.decode_obj_class.set_class_attributes - json2graph.modules.decoder.decode_obj_class.set_class_attribute_property - json2graph.modules.decoder.decode_obj_class.set_class_literal_literal - json2graph.modules.decoder.decode_obj_class.create_class_properties + json2graph.decoder.decode_obj_class.validate_class_attribute_constraints + json2graph.decoder.decode_obj_class.validate_class_order_constraints + json2graph.decoder.decode_obj_class.set_defaults_class_attribute + json2graph.decoder.decode_obj_class.set_defaults_class_order + json2graph.decoder.decode_obj_class.set_class_stereotype + json2graph.decoder.decode_obj_class.set_class_order_nonnegativeinteger + json2graph.decoder.decode_obj_class.set_class_restrictedto_ontologicalnature + json2graph.decoder.decode_obj_class.set_class_attributes + json2graph.decoder.decode_obj_class.set_class_attribute_property + json2graph.decoder.decode_obj_class.set_class_literal_literal + json2graph.decoder.decode_obj_class.create_class_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt similarity index 84% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt index da4d8a5..432d528 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_diagram/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_diagram/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_diagram` -======================================================= +:py:mod:`json2graph.decoder.decode_obj_diagram` +=============================================== -.. py:module:: json2graph.modules.decoder.decode_obj_diagram +.. py:module:: json2graph.decoder.decode_obj_diagram .. autoapi-nested-parse:: @@ -25,9 +25,9 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_diagram.set_diagram_owner_modelelement - json2graph.modules.decoder.decode_obj_diagram.set_diagram_containsview_elementview - json2graph.modules.decoder.decode_obj_diagram.create_diagram_properties + json2graph.decoder.decode_obj_diagram.set_diagram_owner_modelelement + json2graph.decoder.decode_obj_diagram.set_diagram_containsview_elementview + json2graph.decoder.decode_obj_diagram.create_diagram_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt similarity index 84% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt index 3ce73c1..1483d2b 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_elementview/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_elementview/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_elementview` -=========================================================== +:py:mod:`json2graph.decoder.decode_obj_elementview` +=================================================== -.. py:module:: json2graph.modules.decoder.decode_obj_elementview +.. py:module:: json2graph.decoder.decode_obj_elementview .. autoapi-nested-parse:: @@ -25,8 +25,8 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_elementview.set_elementview_relations - json2graph.modules.decoder.decode_obj_elementview.create_elementview_properties + json2graph.decoder.decode_obj_elementview.set_elementview_relations + json2graph.decoder.decode_obj_elementview.create_elementview_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt similarity index 82% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt index 2d4e2d1..6aadec2 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalization/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalization/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_generalization` -============================================================== +:py:mod:`json2graph.decoder.decode_obj_generalization` +====================================================== -.. py:module:: json2graph.modules.decoder.decode_obj_generalization +.. py:module:: json2graph.decoder.decode_obj_generalization .. autoapi-nested-parse:: @@ -25,8 +25,8 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_generalization.set_generalization_relations - json2graph.modules.decoder.decode_obj_generalization.create_generalization_properties + json2graph.decoder.decode_obj_generalization.set_generalization_relations + json2graph.decoder.decode_obj_generalization.create_generalization_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt similarity index 82% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt index 6808484..dda7006 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_generalizationset/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_generalizationset/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_generalizationset` -================================================================= +:py:mod:`json2graph.decoder.decode_obj_generalizationset` +========================================================= -.. py:module:: json2graph.modules.decoder.decode_obj_generalizationset +.. py:module:: json2graph.decoder.decode_obj_generalizationset .. autoapi-nested-parse:: @@ -25,9 +25,9 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_generalizationset.set_generalizationset_defaults - json2graph.modules.decoder.decode_obj_generalizationset.set_generalizationset_relations - json2graph.modules.decoder.decode_obj_generalizationset.create_generalizationset_properties + json2graph.decoder.decode_obj_generalizationset.set_generalizationset_defaults + json2graph.decoder.decode_obj_generalizationset.set_generalizationset_relations + json2graph.decoder.decode_obj_generalizationset.create_generalizationset_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt similarity index 84% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt index e11082a..3bd5503 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_package/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_package/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_package` -======================================================= +:py:mod:`json2graph.decoder.decode_obj_package` +=============================================== -.. py:module:: json2graph.modules.decoder.decode_obj_package +.. py:module:: json2graph.decoder.decode_obj_package .. autoapi-nested-parse:: @@ -25,9 +25,9 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_package.get_package_contents - json2graph.modules.decoder.decode_obj_package.set_package_containsmodelelement_modelelement - json2graph.modules.decoder.decode_obj_package.create_package_properties + json2graph.decoder.decode_obj_package.get_package_contents + json2graph.decoder.decode_obj_package.set_package_containsmodelelement_modelelement + json2graph.decoder.decode_obj_package.create_package_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt similarity index 84% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt index fade6f1..b3b7e04 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_path/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_path/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_path` -==================================================== +:py:mod:`json2graph.decoder.decode_obj_path` +============================================ -.. py:module:: json2graph.modules.decoder.decode_obj_path +.. py:module:: json2graph.decoder.decode_obj_path .. autoapi-nested-parse:: @@ -25,8 +25,8 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_path.set_path_path_point - json2graph.modules.decoder.decode_obj_path.create_path_properties + json2graph.decoder.decode_obj_path.set_path_path_point + json2graph.decoder.decode_obj_path.create_path_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt similarity index 86% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt index e40a944..b2e5f0c 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_project/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_project/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_project` -======================================================= +:py:mod:`json2graph.decoder.decode_obj_project` +=============================================== -.. py:module:: json2graph.modules.decoder.decode_obj_project +.. py:module:: json2graph.decoder.decode_obj_project .. autoapi-nested-parse:: @@ -25,10 +25,10 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_project.set_ontoumlelement_project_project - json2graph.modules.decoder.decode_obj_project.set_project_model_package - json2graph.modules.decoder.decode_obj_project.set_project_diagram_diagram - json2graph.modules.decoder.decode_obj_project.create_project_properties + json2graph.decoder.decode_obj_project.set_ontoumlelement_project_project + json2graph.decoder.decode_obj_project.set_project_model_package + json2graph.decoder.decode_obj_project.set_project_diagram_diagram + json2graph.decoder.decode_obj_project.create_project_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt similarity index 88% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt index fe70479..ab09bdc 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_property/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_property/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_property` -======================================================== +:py:mod:`json2graph.decoder.decode_obj_property` +================================================ -.. py:module:: json2graph.modules.decoder.decode_obj_property +.. py:module:: json2graph.decoder.decode_obj_property .. autoapi-nested-parse:: @@ -25,12 +25,12 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_property.validate_property_stereotype - json2graph.modules.decoder.decode_obj_property.set_property_defaults - json2graph.modules.decoder.decode_obj_property.set_property_relations - json2graph.modules.decoder.decode_obj_property.determine_cardinality_bounds - json2graph.modules.decoder.decode_obj_property.set_cardinality_relations - json2graph.modules.decoder.decode_obj_property.create_property_properties + json2graph.decoder.decode_obj_property.validate_property_stereotype + json2graph.decoder.decode_obj_property.set_property_defaults + json2graph.decoder.decode_obj_property.set_property_relations + json2graph.decoder.decode_obj_property.determine_cardinality_bounds + json2graph.decoder.decode_obj_property.set_cardinality_relations + json2graph.decoder.decode_obj_property.create_property_properties @@ -39,7 +39,7 @@ Attributes .. autoapisummary:: - json2graph.modules.decoder.decode_obj_property.LOGGER + json2graph.decoder.decode_obj_property.LOGGER .. py:data:: LOGGER diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt similarity index 84% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt index 52e994e..1596bed 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_rectangularshape/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_rectangularshape/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_rectangularshape` -================================================================ +:py:mod:`json2graph.decoder.decode_obj_rectangularshape` +======================================================== -.. py:module:: json2graph.modules.decoder.decode_obj_rectangularshape +.. py:module:: json2graph.decoder.decode_obj_rectangularshape .. autoapi-nested-parse:: @@ -25,8 +25,8 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_rectangularshape.set_rectangularshape_coordinates - json2graph.modules.decoder.decode_obj_rectangularshape.create_rectangularshape_properties + json2graph.decoder.decode_obj_rectangularshape.set_rectangularshape_coordinates + json2graph.decoder.decode_obj_rectangularshape.create_rectangularshape_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt similarity index 86% rename from docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt index 4b606db..c17526a 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/decode_obj_relation/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/decode_obj_relation/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder.decode_obj_relation` -======================================================== +:py:mod:`json2graph.decoder.decode_obj_relation` +================================================ -.. py:module:: json2graph.modules.decoder.decode_obj_relation +.. py:module:: json2graph.decoder.decode_obj_relation .. autoapi-nested-parse:: @@ -25,10 +25,10 @@ Functions .. autoapisummary:: - json2graph.modules.decoder.decode_obj_relation.set_relation_defaults - json2graph.modules.decoder.decode_obj_relation.set_relation_stereotype - json2graph.modules.decoder.decode_obj_relation.set_relation_relations - json2graph.modules.decoder.decode_obj_relation.create_relation_properties + json2graph.decoder.decode_obj_relation.set_relation_defaults + json2graph.decoder.decode_obj_relation.set_relation_stereotype + json2graph.decoder.decode_obj_relation.set_relation_relations + json2graph.decoder.decode_obj_relation.create_relation_properties diff --git a/docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt b/docs/_sources/autoapi/json2graph/decoder/index.rst.txt similarity index 81% rename from docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt rename to docs/_sources/autoapi/json2graph/decoder/index.rst.txt index d3faf97..8db2600 100644 --- a/docs/_sources/autoapi/json2graph/modules/decoder/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/decoder/index.rst.txt @@ -1,7 +1,7 @@ -:py:mod:`json2graph.modules.decoder` -==================================== +:py:mod:`json2graph.decoder` +============================ -.. py:module:: json2graph.modules.decoder +.. py:module:: json2graph.decoder Submodules diff --git a/docs/_sources/autoapi/json2graph/index.rst.txt b/docs/_sources/autoapi/json2graph/index.rst.txt index 1a849a2..cb1b4dc 100644 --- a/docs/_sources/autoapi/json2graph/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/index.rst.txt @@ -10,8 +10,8 @@ Subpackages :titlesonly: :maxdepth: 3 + decoder/index.rst modules/index.rst - resources/index.rst tests/index.rst diff --git a/docs/_sources/autoapi/json2graph/library/index.rst.txt b/docs/_sources/autoapi/json2graph/library/index.rst.txt index 41abbf8..aaec849 100644 --- a/docs/_sources/autoapi/json2graph/library/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/library/index.rst.txt @@ -32,7 +32,7 @@ Functions -.. py:function:: decode_json_project(json_path, base_uri = 'https://example.org#', language = '', correct = False) +.. py:function:: decode_json_project(json_file_path, base_uri = 'https://example.org#', language = '', correct = False) Decodes elements from OntoUML's abstract and concrete syntax from JSON format into a Knowledge Graph. I.e., domain-level and diagrammatic data are converted to Knowledge Graph. @@ -41,8 +41,8 @@ Functions that adheres to the OntoUML Vocabulary. It provides customization options for URI generation, language tags, error correction, and returns the resulting knowledge graph. - :param json_path: Path to the JSON file to be decoded provided by the user. - :type json_path: str + :param json_file_path: Path to the JSON file to be decoded provided by the user. + :type json_file_path: str :param base_uri: Base URI to be used for generating URIs for ontology concepts. Default is "https://example.org#". (Optional) :type base_uri: str @@ -56,7 +56,7 @@ Functions :rtype: Graph -.. py:function:: decode_json_model(json_path, base_uri = 'https://example.org#', language = '', correct = False) +.. py:function:: decode_json_model(json_file_path, base_uri = 'https://example.org#', language = '', correct = False) Decodes elements from OntoUML's abstract syntax from JSON format into a Knowledge Graph. I.e., only domain-level (and not diagrammatic) data is converted to Knowledge Graph. @@ -65,8 +65,8 @@ Functions that adheres to the OntoUML Vocabulary. It provides customization options for URI generation, language tags, error correction, and returns the resulting knowledge graph. - :param json_path: Path to the JSON file to be decoded provided by the user. - :type json_path: str + :param json_file_path: Path to the JSON file to be decoded provided by the user. + :type json_file_path: str :param base_uri: Base URI to be used for generating URIs for ontology concepts. Default is "https://example.org#". (Optional) :type base_uri: str diff --git a/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt index 67db468..6deea5e 100644 --- a/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/arguments/index.rst.txt @@ -24,8 +24,9 @@ Functions .. autoapisummary:: - json2graph.modules.arguments.treat_user_arguments - json2graph.modules.arguments.initialize_arguments + json2graph.modules.arguments.initialize_args_script + json2graph.modules.arguments.initialize_args_import + json2graph.modules.arguments.initialize_args_test @@ -46,33 +47,56 @@ Attributes -.. py:function:: treat_user_arguments() +.. py:function:: initialize_args_script() This function parses the command-line arguments provided by the user and performs necessary validations. + - :return: Dictionary with json path (key 'json_path') and final file format (key 'format'). - :rtype: dict - -.. py:function:: initialize_arguments(json_path = 'not_initialized', base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False, execution_mode = 'import') +.. py:function:: initialize_args_import(input_path = 'not_initialized', output_path = os.getcwd(), base_uri = 'https://example.org#', graph_format = 'ttl', language = '', model_only = False, silent = True, correct = False) This function initializes the global variable ARGUMENTS of type dictionary, which contains user-provided (when executed in script mode) or default arguments (when executed as a library or for testing). The ARGUMENTS variable must be initialized in every possible execution mode. - The valid execution modes are: - - 'script': If used as a script, use user's arguments parsed from the command line. - - 'package': When imported into external code, working as a library package. - - 'test': Used for testing. + :param input_path: Path to the directory or JSON file to be decoded. (Optional) + :type input_path: str + :param output_path: Path to the directory in which the result file(s) will be saved. (Optional) + :type output_path: str + :param base_uri: Base URI to be used for generating URIs for ontology concepts. (Optional) + Default is "https://example.org#". + :type base_uri: str + :param graph_format: Format for saving the resulting knowledge graph. (Optional) + Default value is 'ttl' (Turtle syntax). + :type graph_format: str + :param language: Language tag to be added to the ontology's concepts. (Optional) + :type language: str + :param model_only: If True, only the OntoUML model will be extracted without diagrammatic information. (Optional) + :type model_only: bool + :param silent: If True, suppresses intermediate communications and log messages during execution. (Optional) + :type silent: bool + :param correct: If True, attempts to correct potential errors during the conversion process. (Optional) + :type correct: bool + +.. py:function:: initialize_args_test(input_path = 'not_initialized', language = '') + + This function initializes the global variable ARGUMENTS of type dictionary, which contains user-provided + (when executed in script mode) or default arguments (when executed as a library or for testing). + The ARGUMENTS variable must be initialized in every possible execution mode. - :param json_path: Path to the JSON file to be decoded provided by the user. (Optional) - :type json_path: str - :param base_uri: Base URI to be used for generating URIs for ontology concepts. - Default is "https://example.org#". (Optional) + :param input_path: Path to the directory or JSON file to be decoded. (Optional) + :type input_path: str + :param output_path: Path to the directory in which the result file(s) will be saved. (Optional) + :type output_path: str + :param decode_all: Informs if user wants to convert all json files in the input_path performing the decode + function multiple times. (Optional) + :type decode_all: bool + :param base_uri: Base URI to be used for generating URIs for ontology concepts. (Optional) + Default is "https://example.org#". :type base_uri: str - :param graph_format: Format for saving the resulting knowledge graph. - Default value is 'ttl' (Turtle syntax). (Optional) + :param graph_format: Format for saving the resulting knowledge graph. (Optional) + Default value is 'ttl' (Turtle syntax). :type graph_format: str :param language: Language tag to be added to the ontology's concepts. (Optional) :type language: str @@ -82,8 +106,5 @@ Attributes :type silent: bool :param correct: If True, attempts to correct potential errors during the conversion process. (Optional) :type correct: bool - :param execution_mode: Information about the execution mode. - Valid values are 'import' (default), 'script', and 'test'. (Optional) - :type execution_mode: str diff --git a/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt index 514613a..7fb62fe 100644 --- a/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/errors/index.rst.txt @@ -5,7 +5,9 @@ .. autoapi-nested-parse:: - Functions related to the verification and treatment of identified ERROR cases. + This module provides a collection of functions for reporting various error scenarios that can occur during the software + execution. These functions are designed to improve the robustness and reliability of the program by providing clear + error messages and raising appropriate exceptions when necessary. @@ -19,6 +21,7 @@ Functions .. autoapisummary:: json2graph.modules.errors.report_error_requirement_not_met + json2graph.modules.errors.report_error_invalid_parameter json2graph.modules.errors.report_error_end_of_switch json2graph.modules.errors.report_error_io_read json2graph.modules.errors.report_error_io_write @@ -44,6 +47,25 @@ Attributes :param error_message: Message to be printed to the user indicating the detected error. :type error_message: str + + :raises ValueError: Always. + + +.. py:function:: report_error_invalid_parameter(invalid_parameter, list_valid_parameters, caller_function_name) + + Reports the error caused when an invalid parameter is passed to a function. E.g., the function accepts (i.e., + list_valid_parameters is) ["alfa", "beta"] and the received parameter (invalid_parameter) was "gama". + + NOTE 1: This function must be used only for validation of parameters of type string. + NOTE 2: caller_function_name can be obtained from 'current_function = inspect.stack()[0][3]' + + :param invalid_parameter: Used parameter value that was evaluated as not valid. + :type invalid_parameter: str + :param list_valid_parameters: List of valid values for the evaluated parameter. + :type list_valid_parameters: list[str] + :param caller_function_name: Name of the function in which the invalid parameter was used. + :type caller_function_name: str + :raises ValueError: Always. @@ -58,6 +80,7 @@ Attributes :type invalid_parameter: str :param caller_function_name: Name of the function in which the invalid parameter was used. :type caller_function_name: str + :raises ValueError: Always. @@ -71,6 +94,7 @@ Attributes :type file_description: str :param error: Error raised by the IO operation. :type error: OSError + :raises OSError: Always. @@ -84,6 +108,7 @@ Attributes :type file_description: str :param error: Error raised by the IO operation. :type error: OSError + :raises OSError: Always. diff --git a/docs/_sources/autoapi/json2graph/modules/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/index.rst.txt index 9196f61..21c1cfc 100644 --- a/docs/_sources/autoapi/json2graph/modules/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/index.rst.txt @@ -4,15 +4,6 @@ .. py:module:: json2graph.modules -Subpackages ------------ -.. toctree:: - :titlesonly: - :maxdepth: 3 - - decoder/index.rst - - Submodules ---------- .. toctree:: @@ -28,5 +19,6 @@ Submodules sparql_queries/index.rst utils_general/index.rst utils_graph/index.rst + utils_validations/index.rst diff --git a/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt index f5653be..f327ec3 100644 --- a/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/logger/index.rst.txt @@ -5,7 +5,7 @@ .. autoapi-nested-parse:: - This module provides functions for configuring a logger that outputs messages to both the console and a log file. + This module provides functions for configuring a logger that outputs messages to the console. The logger can be customized based on different execution modes, allowing you to control the log level. @@ -34,7 +34,8 @@ Functions .. py:function:: initialize_logger(execution_mode = 'script') - Create and initialize logger. The created logger is called 'execution-logger'. + Create and initialize logger named 'execution-logger'. + Different triggers are defined for each execution mode: - script: INFO - import: ERROR diff --git a/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt index fee83cc..60ccb4c 100644 --- a/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/utils_general/index.rst.txt @@ -18,24 +18,10 @@ Functions .. autoapisummary:: - json2graph.modules.utils_general.count_elements_types json2graph.modules.utils_general.get_date_time -.. py:function:: count_elements_types(element_type_list, element_counting) - - Returns the number of elements (in the already counted data) of the types given in a list. - Receives a dictionary of number of items and returns the value corresponding to the provided argument. - - :param element_type_list: List of types of elements to have their count value returned. - :type element_type_list: list[str] - :param element_counting: Dictionary with types and corresponding number of occurrences. - :type element_counting: dict - :return: Number of occurrences of the element of the given type. - :rtype: int - - .. py:function:: get_date_time(date_time_format) Return a string with date and time according to the specified format received as argument. diff --git a/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt index 0f442d5..c24b88b 100644 --- a/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/modules/utils_graph/index.rst.txt @@ -21,7 +21,6 @@ Functions json2graph.modules.utils_graph.ontouml_ref json2graph.modules.utils_graph.load_ontouml_vocabulary json2graph.modules.utils_graph.load_graph_safely - json2graph.modules.utils_graph.get_all_ids_for_type @@ -69,13 +68,3 @@ Attributes :rtype: Graph -.. py:function:: get_all_ids_for_type(ontology_graph, element_type) - - Queries the graph for all elements of the given element_type and returns a list of their ids. - - :param ontology_file: Loaded ontology graph. - :type ontology_file: Graph - :param element_type: Type of the element (originally a JSON object) to be queried to have their ids returned . - :type element_type: list[str] - - diff --git a/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt b/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt new file mode 100644 index 0000000..d9ed667 --- /dev/null +++ b/docs/_sources/autoapi/json2graph/modules/utils_validations/index.rst.txt @@ -0,0 +1,47 @@ +:py:mod:`json2graph.modules.utils_validations` +============================================== + +.. py:module:: json2graph.modules.utils_validations + +.. autoapi-nested-parse:: + + Functions that performs validations for different functions or parameters used in the software. + + + +Module Contents +--------------- + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + json2graph.modules.utils_validations.validate_arg_input + json2graph.modules.utils_validations.validate_execution_mode + + + +.. py:function:: validate_arg_input(input_path, decode_all) + + Validates the input path received as argument. + + :param input_path: The path to the input file or directory. + :type input_path: str + :param decode_all: A flag indicating whether to decode all files in the directory. + :type decode_all: bool + + +.. py:function:: validate_execution_mode(execution_mode) + + Validate the provided execution mode against a list of valid modes. + + This function validates the given execution mode against a predefined list of valid modes: ["script", "import", + "test"]. It ensures that the provided mode is one of the accepted values, and if not, raises an error indicating + the invalid parameter. + + :param execution_mode: The execution mode to be validated. + :type execution_mode: str + + diff --git a/docs/_sources/autoapi/json2graph/resources/index.rst.txt b/docs/_sources/autoapi/json2graph/resources/index.rst.txt deleted file mode 100644 index 3f94604..0000000 --- a/docs/_sources/autoapi/json2graph/resources/index.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -:py:mod:`json2graph.resources` -============================== - -.. py:module:: json2graph.resources - - diff --git a/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt b/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt deleted file mode 100644 index 2f9c80a..0000000 --- a/docs/_sources/autoapi/json2graph/tests/deprecated_test_clear/index.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -:py:mod:`json2graph.tests.deprecated_test_clear` -================================================ - -.. py:module:: json2graph.tests.deprecated_test_clear - -.. autoapi-nested-parse:: - - This Python module provides a simple script to remove all files with the ".ttl" extension from the - tests/results directory and then remove the directory itself. - - - -Module Contents ---------------- - -.. py:data:: dir_name - :value: 'results' - - - -.. py:data:: test - - - diff --git a/docs/_sources/autoapi/json2graph/tests/index.rst.txt b/docs/_sources/autoapi/json2graph/tests/index.rst.txt index 2cc26e1..cfaa757 100644 --- a/docs/_sources/autoapi/json2graph/tests/index.rst.txt +++ b/docs/_sources/autoapi/json2graph/tests/index.rst.txt @@ -10,7 +10,6 @@ Submodules :titlesonly: :maxdepth: 1 - deprecated_test_clear/index.rst test_aux/index.rst test_main/index.rst diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index d5ac17e..680f77a 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -19,7 +19,11 @@ Welcome to ontouml-json2graph's documentation! .. list-table:: * - Badges - - |repo-status| |commits-latest| |published-at| |pypi-project| |pypi-downloads| |language-top| |language-version| |codefactor| |ossf-scorecard| |license| + - |zenodo-doi| |repo-status| |commits-latest| |published-at| |pypi-project| |pypi-downloads| |language-top| |language-version| |codefactor| |ossf-scorecard| |license| + +.. |zenodo-doi| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214977.svg + :target: https://doi.org/10.5281/zenodo.8214977 + :alt: DOI .. |repo-status| image:: https://www.repostatus.org/badges/latest/active.svg :target: https://www.repostatus.org/#active diff --git a/docs/_static/basic.css b/docs/_static/basic.css index cfc60b8..30fee9d 100644 --- a/docs/_static/basic.css +++ b/docs/_static/basic.css @@ -237,6 +237,10 @@ a.headerlink { visibility: hidden; } +a:visited { + color: #551A8B; +} + h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 2281e7d..e15aace 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,5 +1,4 @@ -var DOCUMENTATION_OPTIONS = { - URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), +const DOCUMENTATION_OPTIONS = { VERSION: '1.0.2', LANGUAGE: 'en', COLLAPSE_INDEX: false, diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js index 97d56a7..7918c3f 100644 --- a/docs/_static/searchtools.js +++ b/docs/_static/searchtools.js @@ -57,12 +57,12 @@ const _removeChildren = (element) => { const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string -const _displayItem = (item, searchTerms) => { +const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; - const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; const [docName, title, anchor, descr, score, _filename] = item; @@ -75,20 +75,24 @@ const _displayItem = (item, searchTerms) => { if (dirname.match(/\/index\/$/)) dirname = dirname.substring(0, dirname.length - 6); else if (dirname === "index/") dirname = ""; - requestUrl = docUrlRoot + dirname; + requestUrl = contentRoot + dirname; linkUrl = requestUrl; } else { // normal html builders - requestUrl = docUrlRoot + docName + docFileSuffix; + requestUrl = contentRoot + docName + docFileSuffix; linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; - if (descr) + if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) @@ -97,6 +101,9 @@ const _displayItem = (item, searchTerms) => { listItem.appendChild( Search.makeSearchSummary(data, searchTerms) ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); }); Search.output.appendChild(listItem); }; @@ -115,14 +122,15 @@ const _finishSearch = (resultCount) => { const _displayNextItem = ( results, resultCount, - searchTerms + searchTerms, + highlightTerms, ) => { // results left, load the summary and display it // this is intended to be dynamic (don't sub resultsCount) if (results.length) { - _displayItem(results.pop(), searchTerms); + _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( - () => _displayNextItem(results, resultCount, searchTerms), + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 5 ); } @@ -360,7 +368,7 @@ const Search = { // console.info("search results:", Search.lastresults); // print the results - _displayNextItem(results, results.length, searchTerms); + _displayNextItem(results, results.length, searchTerms, highlightTerms); }, /** diff --git a/docs/_static/sphinx_highlight.js b/docs/_static/sphinx_highlight.js index aae669d..8a96c69 100644 --- a/docs/_static/sphinx_highlight.js +++ b/docs/_static/sphinx_highlight.js @@ -29,14 +29,19 @@ const _highlight = (node, addItems, text, className) => { } span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); parent.insertBefore( span, parent.insertBefore( - document.createTextNode(val.substr(pos + text.length)), + rest, node.nextSibling ) ); node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); if (isInSVG) { const rect = document.createElementNS( @@ -140,5 +145,10 @@ const SphinxHighlight = { }, }; -_ready(SphinxHighlight.highlightSearchWords); -_ready(SphinxHighlight.initEscapeListener); +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/docs/autoapi/index.html b/docs/autoapi/index.html index be80a3c..e3e135b 100644 --- a/docs/autoapi/index.html +++ b/docs/autoapi/index.html @@ -15,9 +15,9 @@ - + - + @@ -79,28 +79,28 @@
json2graph
-
-
json2graph.modules
-
-
json2graph.modules.decoder
-
-
json2graph.modules.decoder.decode_general
-json2graph.modules.decoder.decode_main
-json2graph.modules.decoder.decode_obj_class
-json2graph.modules.decoder.decode_obj_diagram
-json2graph.modules.decoder.decode_obj_elementview
-json2graph.modules.decoder.decode_obj_generalization
-json2graph.modules.decoder.decode_obj_generalizationset
-json2graph.modules.decoder.decode_obj_package
-json2graph.modules.decoder.decode_obj_path
-json2graph.modules.decoder.decode_obj_project
-json2graph.modules.decoder.decode_obj_property
-json2graph.modules.decoder.decode_obj_rectangularshape
-json2graph.modules.decoder.decode_obj_relation
+json2graph.decoder
-
+
json2graph.decoder.decode_general
+json2graph.decoder.decode_main
+json2graph.decoder.decode_obj_class
+json2graph.decoder.decode_obj_diagram
+json2graph.decoder.decode_obj_elementview
+json2graph.decoder.decode_obj_generalization
+json2graph.decoder.decode_obj_generalizationset
+json2graph.decoder.decode_obj_package
+json2graph.decoder.decode_obj_path
+json2graph.decoder.decode_obj_project
+json2graph.decoder.decode_obj_property
+json2graph.decoder.decode_obj_rectangularshape
+json2graph.decoder.decode_obj_relation
+json2graph.modules
json2graph.modules.arguments
json2graph.modules.errors
json2graph.modules.globals
@@ -110,11 +110,10 @@
API Reference
json2graph.modules.sparql_queries
json2graph.modules.utils_general
json2graph.modules.utils_graph
+json2graph.modules.utils_validations
-json2graph.resources
json2graph.tests
diff --git a/docs/autoapi/json2graph/decode/index.html b/docs/autoapi/json2graph/decode/index.html index 9991945..a1b9821 100644 --- a/docs/autoapi/json2graph/decode/index.html +++ b/docs/autoapi/json2graph/decode/index.html @@ -15,9 +15,9 @@ - + - + @@ -89,26 +89,29 @@-
+json2graph.decode
json2graph.decode
Main function used as script to convert OntoUML JSON files into knowledge graphs, with the flexibility to customize the output and control the execution mode for different use cases.
- Module Contents
+Module Contents
- Functions
+Functions
-
+decode_ontouml_json2graph
(json_path[, base_uri, ...]) -decode_ontouml_json2graph
(json_file_path[, base_uri, ...])Main function for converting OntoUML JSON data to a Knowledge Graph.
-write_graph_file
(ontouml_graph, json_path, graph_format) +Saves the ontology graph into a file with syntax defined by the user.
+ +write_graph_file
(ontouml_graph[, execution_mode]) +Saves the ontology graph received as argument into a file using the syntax defined by the user.
+ Decode multiple OntoUML JSON files.
- Attributes
+Attributes
Basic Syntactical and Sematic Validation -
Permanent URLs and Identifiers
+Permanent URLs and Identifiers
Permanent URLs and Identifiers -
Related Projects
+Related Projects
Related Projects -
Development Contribution
+Development Contribution
We encourage you to contribute to the development of this software.
The dependencies to develop this software are not the same as the ones to execute it. Hence, it is necessary run the following command on the terminal inside the project’s folder to install all necessary dependencies:
pip install -r requirements.txt @@ -318,10 +334,10 @@
Development Contributionpyproject.toml file to present information to users. If any change is made to that file, the
setup_metadata.py
file, located inside the project’s root folder must be executed to update the transformation’s data.The ontouml-json2graph package was developed using test-driven-based development. Multiple tests are available inside the following folder: ontouml-json2graph/json2graph/tests.
-Documentation regarding the text is also available.
+Documentation regarding the tests is also available.
- Author
+Author
This project is maintained by the Semantics, Cybersecurity & Services (SCS) Group of the University of Twente, The Netherlands. Its developer is:
- API Reference
+API Reference
This page contains auto-generated API reference documentation [1].