class documentation

class SemanticHandler(ABC):

Known subclasses: acme.plugins.services.SemanticManager.RdfLibHandler

View In Hierarchy

Abstract base class for semantic graph store handlers.

Method addDescription Add a semantic description to the graph store.
Method addParentID Add the parent ID to a resource's graph.
Method query Run a SPARQL query against a graph.
Method removeDescription Remove a description from the graph store.
Method reset Reset the handler, remove all graphs etc.
Method updateDescription Update a description in the graph store.
Method validateDescription Validate a semantic description.
@abstractmethod
def addDescription(self, description: str, format: SemanticFormat, id: str) -> Result:

Add a semantic description to the graph store.

Parameters
description:strA string with the semantic description.
format:SemanticFormatThe format of the string in description. It must be a supported format.
id:strIdentifier for the graph. It should be a resouce identifier.
Returns
ResultA Result object. The query result is returned in its data attribute.
@abstractmethod
def addParentID(self, id: str, pi: str):

Add the parent ID to a resource's graph.

Parameters
id:strIdentifier for the graph. It should be a resouce identifier.
pi:strParent ID to add.
@abstractmethod
def query(self, query: str, ids: Sequence[str], format: str) -> Result:

Run a SPARQL query against a graph.

Parameters
query:strSPARQL query.
ids:Sequence[str]List of resource / graph identifiers used to build the graph for the query.
format:strDesired serialization format for the result. It must be supported.
Returns
ResultResult object. The serialized query result is stored in data.
@abstractmethod
def removeDescription(self, id: str) -> Result:

Remove a description from the graph store.

Parameters
id:strIdentifier for the graph. It should be a resouce identifier.
Returns
ResultA Result object indicating success or error.
@abstractmethod
def reset(self):

Reset the handler, remove all graphs etc.

@abstractmethod
def updateDescription(self, description: str, format: SemanticFormat, id: str) -> Result:

Update a description in the graph store.

Parameters
description:strA string with the semantic description.
format:SemanticFormatThe format of the string in description. It must be a supported format.
id:strIdentifier for the graph. It should be a resouce identifier.
Returns
ResultA Result object indicating success or error.
@abstractmethod
def validateDescription(self, description: str, format: SemanticFormat) -> Result:

Validate a semantic description.

Parameters
description:strA string with the semantic description.
format:SemanticFormatThe format of the string in description. It must be supported.
Returns
ResultA Result object indicating a valid description, or with an error status.