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)) print fragment.to_string() print "-="*20 print "Now just adding the triples - new items will be created automagically" # or just add the triples - new items will be created automagically item_id2 = u"info:fedora/externalitem:1/magic.jpg" m.add_triple(item_id2, "dc:format", "image/jpg") m.add_triple(item_id2, "dc:title", "It's magic") print "Getting the magically created item's RDFobject"