import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Bag; public class BagTest { public static void main(String[] args) { Model m1 = ModelFactory.createDefaultModel(); Resource r = m1.createResource(); Model m2 = ModelFactory.createDefaultModel(); Bag s = m2.getBag(r); System.out.println("Bag should be in m2"); System.out.println("Bag is " + (s.getModel() == m1 ? "" : "not ") + "in m1"); System.out.println("Bag is " + (s.getModel() == m2 ? "" : "not ") + "in m2"); } }