123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import logging
- from rdflib import Graph
- from lakesuperior.env import env
- from lakesuperior.globals import RES_UPDATED
- from lakesuperior.dictionaries.namespaces import ns_collection as nsc
- from lakesuperior.model.ldpr import Ldpr
- logger = logging.getLogger(__name__)
- class LdpRs(Ldpr):
- '''
- LDP-RS (LDP RDF source).
- https://www.w3.org/TR/ldp/#ldprs
- '''
- def __init__(self, uuid, repr_opts={}, handling='lenient', **kwargs):
- '''
- Extends Ldpr.__init__ by adding LDP-RS specific parameters.
- @param handling (string) One of `strict`, `lenient` (the default) or
- `none`. `strict` raises an error if a server-managed term is in the
- graph. `lenient` removes all sever-managed triples encountered. `none`
- skips all server-managed checks. It is used for internal modifications.
- '''
- super().__init__(uuid, **kwargs)
- self.base_types = super().base_types | {
- nsc['fcrepo'].Container,
- nsc['ldp'].Container,
- }
-
- if self.provided_imr is not None:
- self.workflow = self.WRKF_INBOUND
- else:
- self.workflow = self.WRKF_OUTBOUND
- self._imr_options = repr_opts
- self.handling = handling
- class Ldpc(LdpRs):
- '''LDPC (LDP Container).'''
- def __init__(self, uuid, *args, **kwargs):
- super().__init__(uuid, *args, **kwargs)
- self.base_types |= {
- nsc['fcrepo'].Container,
- nsc['ldp'].Container,
- }
- class LdpBc(Ldpc):
- '''LDP-BC (LDP Basic Container).'''
- def __init__(self, uuid, *args, **kwargs):
- super().__init__(uuid, *args, **kwargs)
- self.base_types |= {
- nsc['ldp'].BasicContainer,
- }
- class LdpDc(Ldpc):
- '''LDP-DC (LDP Direct Container).'''
- def __init__(self, uuid, *args, **kwargs):
- super().__init__(uuid, *args, **kwargs)
- self.base_types |= {
- nsc['ldp'].DirectContainer,
- }
- class LdpIc(Ldpc):
- '''LDP-IC (LDP Indirect Container).'''
- def __init__(self, uuid, *args, **kwargs):
- super().__init__(uuid, *args, **kwargs)
- self.base_types |= {
- nsc['ldp'].IndirectContainer,
- }
|