Example #1
0
def delete_relationship(db: PartitionedDatabase, model_id_or_name: str,
                        relationship_id: ModelRelationshipId) -> None:
    with db.transaction() as tx:
        deleted = db.delete_model_relationship_tx(tx=tx,
                                                  relationship=relationship_id)
        if deleted is None:
            raise NotFound(f"Could not find property [{relationship_id}]")
Example #2
0
def delete_concept_relationship(
        db: PartitionedDatabase,
        relationship_id_or_name: ModelRelationshipId) -> JsonDict:

    with db.transaction() as tx:
        id_or_name = to_relationship_id_or_name(relationship_id_or_name)
        deleted_id = db.delete_model_relationship_stub_tx(tx=tx,
                                                          relation=id_or_name)
        if deleted_id is None:
            deleted_id = db.delete_model_relationship_tx(
                tx=tx, relationship=id_or_name)

    if deleted_id is None:
        raise NotFound(f"Could not delete model relationship [{deleted_id}]")
    return [str(deleted_id)]
Example #3
0
def delete_schema_linked_property(db: PartitionedDatabase, id_: str,
                                  link_id: ModelRelationshipId):
    # Ignore the ID of the model/concept, as it's not needed to actually
    # fetch the linked property:
    with db.transaction() as tx:
        return db.delete_model_relationship_tx(tx=tx, relationship=link_id)