Esempio n. 1
0
                "This is an example.org object, totally pointless, but that's how it goes")
        m.add_triple(item.uri, "dc:format", "text/xml")
        print "-="*20
        print "Print this now adjusted item as ntriples\n"
        print item.to_string(format="nt")
        print "-="*20
    else:
        print "Untyped object, likely a file: %s" % (item.uri)

# Creating new items

item_id = u"info:fedora/uuid:23e0e1ca-2284-11de-9609-000e2ed68b2b/the_shizzle.txt"

print "Creating item %s explicitly" % (item_id)

m.add_item(item_id)

m.add_triple(item_id, "dc:format", "text/plain")

print "Attempting to create the item again erroneously"

try:
    m.add_item(item_id)
except ItemAlreadyExistsException:
    print "Item not overwritten accidentally"

print "Getting the item's RDFobject"

fragment = m.get_item(item_id)
print "-="*20
print "What is fragment (should be an RDFobject) \n%s\n\n" % (type(fragment))