class SemanticManager(object):
This class implements semantic service and helper functions.
Note
The semantic graphs are not persisted and only hold in memory at the moment.
When the CSE is started the SemanticManager rebuilds the whole semantic graph
from the existing <SMD> resources in the resource tree.
| Method | add |
Perform the semantic validation of the <SMD> resource |
| Method | configure |
Configure the WebSocket server. |
| Method | execute |
Recursively discover link-related <SMD> resources and run a SPARQL query against each of the results. |
| Method | execute |
Run a SPARQL query against a list of <SMD> resources. |
| Method | init |
Initialization of the SemanticManager plugin. |
| Method | remove |
Remove the graph for a semantic descriptor. |
| Method | restart |
Restart the Semantic Manager. |
| Method | start |
Start of the SemanticManager plugin. This includes re-building of the semantic graph in memory from the existing resources. |
| Method | stop |
Shutdown the Semantic Manager. |
| Method | update |
Update the graph for a semantic descriptor. |
| Method | validate |
Check that the descriptor attribute conforms to the syntax defined by the descriptorRepresentation attribute. |
| Method | validate |
Validate wether an input string is a valid SPARQL query. |
| Method | validate |
Check and handle the setting of the validationEnable attribute. |
| Class Variable | __slots__ |
Slots for SemanticManager class. |
| Class Variable | dispatcher |
Injected Dispatcher instance. |
| Class Variable | security |
Injected SecurityManager instance. |
| Instance Variable | default |
Default serialization format for semantic descriptions. |
| Instance Variable | semantic |
The semantic graph store handler to be used for the CSE. |
| Method | _build |
Retrieve the resources in the ris attribute and follow the optional rels attribute recursively. |
Configure the WebSocket server.
| Parameters | |
config:Configuration | The configuration object to update with the semantic manager configuration. |
str, query: str, smds: Sequence[ SMD], ct: ContentSerializationType) -> list[ Resource]:
¶
Recursively discover link-related <SMD> resources and run a SPARQL query against each of the results.
This implementation support the "resource link-based" method, but not the "annotation-based" method.
When ann originator doesn't have access to a Link-related <SMD> resource then this resource is ignored.
| Parameters | |
originator:str | The originator of the original request. It is used to determine the access to related resources. |
query:str | String with the SPARQL query. |
smds:Sequence[ | A list of <SMD> resources which are to be aggregated and for the query. |
ct:ContentSerializationType | Result serialization format to determine the result format. |
| Returns | |
list[ | Result object. If successful, the data attribute contains the serialized result of the query. |
str, smds: Sequence[ SMD] | SMD, ct: ContentSerializationType) -> Result:
¶
Run a SPARQL query against a list of <SMD> resources.
| Parameters | |
query:str | String with the SPARQL query. |
smds:Sequence[ | A list of <SMD> resources, or a single <SMD> resource, which are to be aggregated for the query. |
ct:ContentSerializationType | Result serialization format to determine the result format. |
| Returns | |
Result | Result object. If successful, the data attribute contains the serialized result of the query. |
Start of the SemanticManager plugin. This includes re-building of the semantic graph in memory from the existing resources.
Validate wether an input string is a valid SPARQL query.
Todo
Not implemented yet.
| Parameters | |
query:str | String with the SPARQL query to validate. |
Retrieve the resources in the ris attribute and follow the optional rels attribute recursively.
The result does not contain duplicates.
| Parameters | |
ris:list[ | List of resource IDs to be included in the result and followed recursively. |
originator:str | The originator of the original request. It is used to determine the access to related resources. |
graphdict[ | A dictionary of resource IDs and <SMD> resources that is extended during the recursive walk. |