Browse Source

Fix things that broke Hyrax.

* Simple ingest working
* Some characterization metadata not created properly
Stefano Cossu 7 years ago
parent
commit
d77920d05d

+ 1 - 1
lakesuperior/endpoints/ldp.py

@@ -60,7 +60,7 @@ std_headers = {
 
 '''Predicates excluded by view.'''
 vw_blacklist = {
-    nsc['fcrepo'].contains,
+    nsc['fcsystem'].contains,
 }
 
 @ldp.url_defaults

+ 1 - 1
lakesuperior/model/ldp_factory.py

@@ -1,6 +1,6 @@
 import logging
 
-from pprint import pformat
+#from pprint import pformat
 
 import rdflib
 

+ 5 - 5
lakesuperior/model/ldp_rs.py

@@ -1,4 +1,4 @@
-from copy import deepcopy
+#from copy import deepcopy
 
 from flask import g
 from rdflib import Graph
@@ -103,7 +103,7 @@ class Ldpc(LdpRs):
 
     def __init__(self, uuid, *args, **kwargs):
         super().__init__(uuid, *args, **kwargs)
-        self.base_types = super().base_types | {
+        self.base_types |= {
             nsc['fcrepo'].Container,
             nsc['ldp'].Container,
         }
@@ -114,7 +114,7 @@ class LdpBc(Ldpc):
     '''LDP-BC (LDP Basic Container).'''
     def __init__(self, uuid, *args, **kwargs):
         super().__init__(uuid, *args, **kwargs)
-        self.base_types = super().base_types | {
+        self.base_types |= {
             nsc['ldp'].BasicContainer,
         }
 
@@ -125,7 +125,7 @@ class LdpDc(Ldpc):
 
     def __init__(self, uuid, *args, **kwargs):
         super().__init__(uuid, *args, **kwargs)
-        self.base_types = super().base_types | {
+        self.base_types |= {
             nsc['ldp'].DirectContainer,
         }
 
@@ -136,7 +136,7 @@ class LdpIc(Ldpc):
 
     def __init__(self, uuid, *args, **kwargs):
         super().__init__(uuid, *args, **kwargs)
-        self.base_types = super().base_types | {
+        self.base_types |= {
             nsc['ldp'].IndirectContainer,
         }
 

+ 11 - 12
lakesuperior/model/ldpr.py

@@ -294,7 +294,7 @@ class Ldpr(metaclass=ABCMeta):
             try:
                 self._version_info = self.rdfly.get_version_info(self.uid)
             except ResourceNotExistsError as e:
-                self._version_info = Graph()
+                self._version_info = Resource(Graph(), self.urn)
 
         return self._version_info
 
@@ -961,35 +961,34 @@ class Ldpr(metaclass=ABCMeta):
         @param cont_rsrc (rdflib.resource.Resouce)  The container resource.
         '''
         cont_p = set(cont_rsrc.metadata.graph.predicates())
-        add_trp = set()
 
         self._logger.info('Checking direct or indirect containment.')
         self._logger.debug('Parent predicates: {}'.format(cont_p))
 
-        add_trp.add((self.urn, nsc['fcrepo'].hasParent, cont_rsrc.urn))
+        add_trp = {(self.urn, nsc['fcrepo'].hasParent, cont_rsrc.urn)}
 
         if self.MBR_RSRC_URI in cont_p and self.MBR_REL_URI in cont_p:
-            s = g.tbox.localize_term(
-                    cont_rsrc.metadata.value(self.MBR_RSRC_URI).identifier)
+            s = cont_rsrc.metadata.value(self.MBR_RSRC_URI).identifier
             p = cont_rsrc.metadata.value(self.MBR_REL_URI).identifier
 
             if cont_rsrc.metadata[RDF.type : nsc['ldp'].DirectContainer]:
                 self._logger.info('Parent is a direct container.')
 
                 self._logger.debug('Creating DC triples.')
-                add_trp.add((s, p, self.urn))
+                o = self.urn
 
             elif cont_rsrc.metadata[RDF.type : nsc['ldp'].IndirectContainer] \
                    and self.INS_CNT_REL_URI in cont_p:
                 self._logger.info('Parent is an indirect container.')
                 cont_rel_uri = cont_rsrc.metadata.value(
                         self.INS_CNT_REL_URI).identifier
-                target_uri = self.provided_metadata.value(
-                        cont_rel_uri).identifier
-                self._logger.debug('Target URI: {}'.format(target_uri))
-                if target_uri:
-                    self._logger.debug('Creating IC triples.')
-                    add_trp.add((s, p, target_uri))
+                #import pdb; pdb.set_trace()
+                o = self.provided_imr.value(cont_rel_uri).identifier
+                self._logger.debug('Target URI: {}'.format(o))
+                self._logger.debug('Creating IC triples.')
+
+            target_rsrc = LdpFactory.from_stored(g.tbox.uri_to_uuid(s))
+            target_rsrc._modify_rsrc(self.RES_UPDATED, add_trp={(s, p, o)})
 
         self._modify_rsrc(self.RES_UPDATED, add_trp=add_trp)