瀏覽代碼

Add LDP types to headers.

Stefano Cossu 7 年之前
父節點
當前提交
8a29338389
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      lakesuperior/ldp/ldpr.py

+ 9 - 2
lakesuperior/ldp/ldpr.py

@@ -390,8 +390,9 @@ class Ldpr(metaclass=ABCMeta):
         Perform a POST action after a valid resource URI has been found.
         '''
         g = Graph()
-
         g.parse(data=data, format=format, publicID=self.urn)
+        for t in self.base_types:
+            g.add((self.urn, RDF.type, t))
 
         self.gs.create_rsrc(g)
 
@@ -405,6 +406,8 @@ class Ldpr(metaclass=ABCMeta):
         '''
         g = Graph()
         g.parse(data=data, format=format, publicID=self.urn)
+        for t in self.base_types:
+            g.add((self.urn, RDF.type, t))
 
         self.gs.create_or_replace_rsrc(g)
 
@@ -640,7 +643,11 @@ class Ldpc(LdpRs):
 
 class LdpBc(Ldpc):
     '''LDP-BC (LDP Basic Container).'''
-    pass
+    def __init__(self, uuid):
+        super().__init__(uuid)
+        self.base_types.update({
+            nsc['ldp'].BasicContainer,
+        })