Esempio n. 1
0
 def _get_manifest(self, id, part_id, file_uri, version = False):
     if not self.storeclient.exists(id):
         raise ObjectNotFoundException
     if not version:
         version = self._get_latest_part(id, part_id)
     part_name = "%s%s%s" % (part_id, self.prefix, version)
     m = Manifest(file_uri)
     if version >= 1:
         f = self.storeclient.get_stream(id, part_id, part_name,streamable=False)
         m.from_string(f.decode('utf-8'))
     return m
Esempio n. 2
0
 def load_manifest(self, create_if_nonexistent=True):
     self.manifest = self.obj.getManifest()
     g = self.manifest.get_graph()
     if isinstance(g, ConjunctiveGraph):
         for s,p,o in g.triples(( None, NAMESPACES['foaf']['primaryTopic'], self.root.uri)):
             if s not in self.parts:
                 self.parts.add(s)
                 if s.startswith(self.obj.uri):
                     part_id = s[len(self.obj.uri)+1:]
                     r = Manifest(s)
                     r.from_string(self.obj.get_part(part_id))
                     self.parts_objs[s] = r
                 elif s.startswith("http://"):
                     r = Manifest(s)
                     r.from_url(s)
                     self.parts_objs[s] = r
Esempio n. 3
0
  </rdf:Description>
  <rdf:Description rdf:about="info:fedora/uuid:23e0e1ca-2284-11de-9609-000e2ed68b2b/rms.dat">
    <dc:title>rms.dat</dc:title>
    <dc:description>The RMS (intensity or power).</dc:description>
    <dataset:physicalPath>/jf/jf_rep3_tap/rms.dat</dataset:physicalPath>
  </rdf:Description>
  <rdf:Description rdf:about="info:fedora/uuid:23e0e1ca-2284-11de-9609-000e2ed68b2b/sss.dat">

    <dc:title>sss.dat</dc:title>
    <dc:description>A measurement of the average slope of the speech spectrum.</dc:description>
    <dataset:physicalPath>/jf/jf_rep3_tap/sss.dat</dataset:physicalPath>
  </rdf:Description>
</rdf:RDF>
"""

m.from_string(RELSINT)

print m.to_string(format="n3")

print "-="*20

# Manifest works like an iterator, yielding RDFobjects in the order given in 
# its internal Manifest.items list. The list can be reordered via sort() or similar

for item in m:
    if item.types:
        print 'Typed object: %s -> %s' % (item.types, item.uri)
        # Adding a bit of info about this item (note, simply adding to m, not the item directly)
        m.add_triple(item.uri, "dc:description", 
                "This is an example.org object, totally pointless, but that's how it goes")
        m.add_triple(item.uri, "dc:format", "text/xml")