It is not clear from this email what type of transformation you want to achieve. I think you are saying that you already have instances of class A and instances of class B and they both have some string properties with values that are drag names. What do you want to happen?
Do you want to create instances of B from instances of A? What transformations do you need to accomplish this?
If, for example:
-Class A instances have a property p1 with the string names of drugs
-Class B instances should have a property p2 that links them to instances of the class Drug
- Instances of Drug have URIs that can be derived from a name of a drug i.e., the p1 values
Then, as you create instances of B from instances of A, you could use build URI to create relationships from the text values of p1 to create values of p2.