5.1.1. API client: code documentation¶
The JSONLDschema package offers and API client that provides most of the library functionality through a RESTFul service.
Here we include the documentation of each of the Python classes and properties for the API client.
-
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
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.InstanceValidatorClient[source] Validates a given instance against a given schema
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.MergeEntitiesClient[source] Resolves a network from given URL and validates each schema
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.NetworkCompilerClient[source] Resolves all references and sub references for a given schema URL
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.NetworkValidatorClient[source] Resolves a network from given URL and validates each schema
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.Schema2ContextClient[source] Fully resolves a schema set from a given URL and creates the context template for each given ontology
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
class
client.SchemaValidatorClient[source] Validates a schema with the jsonschema library
-
on_get(req, resp)[source] Process the get request
Parameters: - req – the user request
- resp – the server response
-
-
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:
-
class
utility.StorageEngine[source]¶ This class is the middle layer that binds the API calls to the actual python code
-
create_context(user_input)[source]¶ Resolve a network a creates the associated context files templates
Parameters: user_input (dict) – a dict that should contain a “schema_url” and a “vocab” attributes. vocab should contain the ontology names as keys and their base URL as value Returns: a dict containing the context files of all schema in the network and for all given vocabulary
-
create_full_sem_diff(user_input)[source]¶ Compares two networks based on their semantics values
Parameters: user_input (dict) – a dictionary containing the network_1, network_2 and a mapping of all schemas to their context files Returns: a list of siblings
-
merge_entities(user_input)[source]¶ Merge two given schemas
Parameters: user_input (dict ({schema_ulr_1; schema_url_2})) – contains the two schemas URL to merge Returns: a merged schema
-
resolve_network(schema)[source]¶ Resolves all references of a given schema
Parameters: schema (dict) – a json containing the schema_url attribute Returns: the resolved network
-
validate_instance(user_input)[source]¶ Validates an instance against a schema
Parameters: user_input (dict) – a dictionary containing the schema_url and instance_url attributes Returns: a validation str or a list of errors
-