import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Random; import org.tupeloproject.kernel.Thing; import org.tupeloproject.kernel.ThingSession; import org.tupeloproject.kernel.impl.MemoryContext; import org.tupeloproject.rdf.Resource; import org.tupeloproject.rdf.Triple; import org.tupeloproject.rdf.Vocabulary; public class TUP142 { static public void main(String[] args) throws Exception { MemoryContext mc = new MemoryContext(); ThingSession ts = new ThingSession(mc); List list = new ArrayList(); Random random = new Random(); for (int i = 0; i < 10; i++) { list.add(random.nextInt()); } Thing thing = ts.newThing(); thing.setValues(Vocabulary.Foaf.KNOWS, list, true); thing.save(); Resource subj = thing.getSubject(); Triple type = null; for (Triple t : mc.getTriples()) { if (t.getObject().equals(Vocabulary.Rdf.BAG)) { type = t; } System.out.println(t); } // uncomment next line to make getValues return a single issue //mc.removeTriples(type); mc.addTriples(Triple.create(type.getSubject(), type.getPredicate(), Vocabulary.Rdf.SEQ)); ts = new ThingSession(mc); thing = ts.fetchThing(subj); Collection col = thing.getValues(Vocabulary.Foaf.KNOWS); int i = 0; for (Object o : col) { System.out.println(o + " " + list.get(i++)); } } }