2.1.1. Code documentation for the CEDAR utilities¶
The CEDAR client will provide all the links the the CEDAR API functionality such as get, post and updates on templates, template elements, folders, instances ect …
-
class
client.
ClientBase
[source]¶ The base class for all client classes .. warning:: Do not use
Parameters: db (StorageEngine) – the storage engine
-
class
client.
FullSemDiffClient
[source]¶ Resolves the two given networks and compares their semantic values based on bound context files
-
class
client.
MergeEntitiesClient
[source]¶ Resolves a network from given URL and validates each schema
-
class
client.
NetworkCompilerClient
[source]¶ Resolves all references and sub references for a given schema URL
-
class
client.
NetworkValidatorClient
[source]¶ Resolves a network from given URL and validates each schema
-
class
client.
Schema2ContextClient
[source]¶ Fully resolves a schema set from a given URL and creates the context template for each given ontology
-
client.
create_client
()[source]¶ Simple function that instantiates the app and creates the bridge to the API
Returns: the falcon app
-
client.
max_body
(limit)[source]¶ Simple function to limit the size of the request
Parameters: limit (int) – the maxiùum size of the request Returns:
The schema2cedar classes will help you transform your JSON schemas draft 04 into compatible CEDAR schemas
-
class
schema2cedar.
Schema2CedarBase
[source]¶ The base converter class
Warning
This class should not be used! Use its children for converting to cedar template and template elements
-
static
json_pretty_dump
(json_object, output_file)[source]¶ Dump a given json in the given file
Parameters: - json_object (dict) – the input JSON to dump
- output_file (TextIOWrapper) – the file to dump the JSON to
Returns: the dumping result
Return type: string
-
static
set_prop_context
(schema)[source]¶ Set the required context for the properties attribute of the given schema
Parameters: schema – an input JSON schema Returns: the properties context required by CEDAR
-
static
set_properties_base_item
()[source]¶ Set the base properties required by CEDAR
Returns: the base property dictionary
-
static
set_property_context
()[source]¶ Set the base context for a given template
Returns: the base context
-
static
set_required_item
(schema)[source]¶ Set the required items that a CEDAR schema needs for a given schema
Parameters: schema – the input schema Returns: the dictionary of required items
-
static
set_stripped_properties
(schema)[source]¶ Set the properties of a given schema
Parameters: schema – the input schema Returns: a dictionary of properties
-
static
set_sub_context
(schema)[source]¶ Set the context required by CEDAR for each individual attribute/field for a given schema
Parameters: schema – the input schema Returns: the dictionary of required context for each field
-
static
set_template_element_property_minimals
(sub_context, schema)[source]¶ Set the minimal elements of the properties attributes of a given schema and its sub-context
Parameters: - sub_context – the schema sub-context
- schema – the input schema
Returns: (dict) a dictionary of the required properties for CEDAR conversion
-
static
-
class
schema2cedar.
Schema2CedarTemplate
[source]¶ Schema 2 Template Converter, this is the one you want to use if you want to convert a schema into a template
-
class
schema2cedar.
Schema2CedarTemplateElement
[source]¶ Schema to TemplateElement converter.
Warning
Should only be used to convert schemas to template element. If you want to convert a schema to a template, use Schema2CedarTemplate (it will automatically create nested template elements for you)
-
convert_template_element
(input_json_schema, **kwargs)[source]¶ Method to convert a given schema into a CEDAR template element
Parameters: - input_json_schema – the input schema
- kwargs – optional parameter to provide the field name referencing that schema
Returns: the schema converted to a CEDAR template element
-
find_sub_specs
(schema, sub_spec_container)[source]¶ Inspect a given schema to find and load its schemas dependencies
Parameters: - schema – the input schema
- sub_spec_container – a container that will hold the dependencies
Return sub_spec_container: the filled container with the schema dependencies
-
load_sub_spec
(path_to_load, parent_schema, field_key)[source]¶ Load the given sub schema into memory
Parameters: - path_to_load – path to the sub schema
- parent_schema – the parent schema that this sub-schema is referenced from
- field_key – the parent schema field name that this sub-schema is referenced from
Returns: the string containing the loaded JSON schema
-