[InterMine Dev] How to instantiate an Item from its identifier?

Sam Hokin shokin at ncgr.org
Tue Feb 23 22:13:37 GMT 2016


Hi, devs. This has to be something folks do all the time, but I'm stumped on the class/method for doing it. I've got a Collection of 
Items stored in an Item, and I'd like to instantiate them. In other words, with an Item bigItem already existing with a Collection 
called smallItems:

ReferenceList smallItemRefList = bigItem.getCollection("smallItems");
if (smallItemRefList!=null) {
	List<String> smallItemRefIdList = smallItemRefList.getRefIds();
	for (String smallItemRefId : smallItemRefIdList) {
         	// how can I instantiate this SmallItem given its smallItemRefId????
         }
}

So far I've been creating lots of maps to store Items separately, but it sure would be nice if I could use the InterMine API to 
instantiate Items that already exist in a Collection!

Thanks!
Sam



More information about the dev mailing list