Beispiel #1
0
annot.add_tag("another")
annot.add_tag("and_another")

print(annot.to_json(indent=2))

if annot.is_valid():
    print("Valid!")

    success = annot.save()

    if success:
        annot_id = annot.id
        print("Succesfully saved annot ID: %s" % annot_id)

        annot2 = Annotation.load(annot_id)

        print(annot2.to_json(indent=2))

        deletion_success = annot.delete()

        if deletion_success:
            print("Deleted annot with ID %s" % annot_id)
        else:
            print("Deletion of annot %s failed." % annot_id)
    else:
        print("Save failed")
else:
    print("Invalid...")
    validation_errors = annot.validate()
    pprint(validation_errors)
Beispiel #2
0
annot.add_tag("another")
annot.add_tag("and_another")

print(annot.to_json(indent=2))

if annot.is_valid():
    print("Valid!")

    success = annot.save()

    if success:
        annot_id = annot.id
        print("Succesfully saved annot ID: %s" % annot_id)

        annot2 = Annotation.load(annot_id)

        print(annot2.to_json(indent=2))

        deletion_success = annot.delete()

        if deletion_success:
            print("Deleted annot with ID %s" % annot_id)
        else:
            print("Deletion of annot %s failed." % annot_id)
    else:
        print("Save failed")
else:
    print("Invalid...")
    validation_errors = annot.validate()
    pprint(validation_errors)