'How to access the origin label of an image through python script

I am trying to practice adversarial attacks in orange data mining, but am having some trouble loading the image in a python script widget. I have it set up where the import images widget is connected to the python script. 'image' has two labels that can be viewed in 'edit domain', 'origin' and 'type'. To actually use the image from in_data, I need to have access to the 'origin' label. I have no idea how to do this. I am new to python so specific code would be greatly appreciated. thank you :)



Solution 1:[1]

You can access it with in_data.domain["image"].attributes["origin"].

You can also refer to the documentation, but I am not sure this is very informative.

Solution 2:[2]

Decide which side should contain the extra column and use the mappedBy attribute. Then JPA will do what's needed

@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false, mappedBy = "user")
private Account account;

Considering that you have bidirectional mapping you don't need the @JoinColumn that you have used.

Just both @OneToOne annotations and the decision which would be owner entity of the relation by using the mappedBy attribute on one of those annotations.

Solution 3:[3]

It depends on you in which side you store the extra column which was a foreign key.Because When You started to established oneToOne relationship between two table it is mandatory to store user's primary key in account table as a foreign key, or account table primary key in user table as foreign key.You should be need to declare mappedBy and your tables reference name.for example if you declare mappedBy="user" in account table it create an extra account_id column in user table as a foreign key, Same as for account

@OneToOne(optional = false, mappedBy = "user")
private Account account;

Don't need to declare these things in side OneToOne annotation cascade = CascadeType.ALL, fetch = FetchType.LAZY, By default it always support lazy fetch

.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vijolica
Solution 2 Panagiotis Bougioukos
Solution 3 JUMBOTURN