EMMC-ASBL / tripper

Triplestore wrapper package for Python.
https://EMMC-ASBL.github.io/tripper
MIT License
6 stars 2 forks source link

Add explicit remove_namespace() method #37

Open xAlessandroC opened 1 year ago

xAlessandroC commented 1 year ago

It would be helpful to add an explicit remove_namespace(prefix: str) method to remove a specific namespace from a database in a triplestore. I'm aware that, currently, the bind method could also perform namespace deletion in case the prefix is None.

It would be an optional method for triplestores that actually support the namespace management.

@jesper-friis Does it make sense to you?

jesper-friis commented 1 year ago

Do you think about something as simple this?

    def remove_namespace(prefix: str):
        self.bind(prefix, None)

This would just be a more explicit way to remove a prefix that does not require any support from the backends.

xAlessandroC commented 1 year ago

Actually, we need support from the backends since different triplestores may delete the namespaces in different ways (e.g. different paths for the REST API). My idea was to define a new method

    def remove_namespace(prefix: str):
        self.backend.remove_namepsace(prefix)

instead of using self.bind(prefix, None) as a way to remove namespaces. Of course, we can also use your method proposal, in that case, each backend should check if the URI is None and apply the logic for the namespace deletion.

xAlessandroC commented 1 year ago

We could add this feature in #39.