Link¶
v5.0.0 uses the object-oriented models
This page documents the legacy Link entity class. New code should use the
object-oriented Link model.
synapseclient.entity.Link
¶
Bases: Entity
Represents a link in Synapse.
WARNING - This class is deprecated and will no longer be maintained. Please use the Link model from synapseclient.models.Link instead.
Links must have a target ID and a parent. When you do synapseclient.Synapse.get on a Link object, the Link object is returned. If the target is desired, specify followLink=True in synapseclient.Synapse.get.
| ATTRIBUTE | DESCRIPTION |
|---|---|
targetId |
The ID of the entity to be linked
|
targetVersion |
The version of the entity to be linked
|
parent |
The parent project or folder
|
properties |
A map of Synapse properties
|
annotations |
A map of user defined annotations
|
local_state |
Internal use only
TYPE:
|
Using this class
Creating an instance and storing the link
link = Link('targetID', parent=folder)
link = syn.store(link)
Migration to the object-oriented model
The legacy Link class is created and persisted through the Synapse client. The object-oriented Link model stores itself.
# Old approach (DEPRECATED)
# from synapseclient import Link
# link = syn.store(Link("syn123", parent="syn456"))
# New approach (RECOMMENDED)
from synapseclient import Synapse
from synapseclient.models import Link
syn = Synapse()
syn.login()
link = Link(target_id="syn123", parent_id="syn456").store()
print(link.id)
Source code in synapseclient/entity.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | |