@Override public void doAction(Used s) { Used res = pf.newUsed(s.getId(), s.getActivity(), s.getEntity()); res.setTime(s.getTime()); QualifiedName id = res.getId(); boolean updated1 = setExpand(res, id, 0); QualifiedName en = res.getActivity(); boolean updated2 = setExpand(res, en, 1); QualifiedName ag = res.getEntity(); boolean updated3 = setExpand(res, ag, 2); boolean updated4 = expandAttributes(s, res); boolean updated = updated1 || updated2 || updated3 || updated4; boolean allUpdated = updated1 && updated2 && updated3; allExpanded=allExpanded && allUpdated; if (!allUpdatedRequired || allUpdated) { ll.add(res); } if (updated) addOrderAttribute(res); }
public void doAction(org.openprovenance.prov.model.Used use) { if (use.getId()!=null) use.setId(uniquify(use.getId())); use.setEntity(uniquify(use.getEntity())); use.setActivity(uniquify(use.getActivity())); doActionAttributes(use); }
/** A factory method to create an instance of a usage {@link Used} from another * @param u an instance of a usage * @return an instance of {@link Used} equal (in the sense of @see Object.equals()) to the input */ public Used newUsed(Used u) { Used u1 = newUsed(u.getId(), u.getActivity(), u.getEntity()); u1.setTime(u.getTime()); u1.getType().addAll(u.getType()); u1.getLabel().addAll(u.getLabel()); u1.getRole().addAll(u.getRole()); u1.getLocation().addAll(u.getLocation()); u1.getOther().addAll(u.getOther()); return u1; }
public Used addAttributes(Used from, Used to) { to.getLabel().addAll(from.getLabel()); to.getType().addAll(from.getType()); to.getLocation().addAll(from.getLocation()); to.getRole().addAll(from.getRole()); to.getOther().addAll(from.getOther()); return to; }
/** A factory method to create an instance of a usage {@link Used} * @param activity the identifier of the <a href="http://www.w3.org/TR/prov-dm/#usage.activity">activity</a> that used an entity * @param entity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#usage.entity">entity</a> being used * @return an instance of {@link Used} */ public Used newUsed(QualifiedName activity, QualifiedName entity) { Used res = newUsed((QualifiedName)null); res.setActivity(activity); res.setEntity(entity); return res; }
@Override public void doAction(Used use) { register(use.getId()); register(use.getEntity()); register(use.getActivity()); registerLocation(use.getLocation()); registerRole(use.getRole()); registerType(use.getType()); registerOther(use.getOther()); }
final org.openprovenance.prov.model.Used a=(org.openprovenance.prov.model.Used) s; switch (i) { case 0: a.setId((QualifiedName)val); return; case 1: a.setActivity((QualifiedName)val); return; case 2: a.setEntity((QualifiedName)val); return; case 3: a.setTime((XMLGregorianCalendar)val); return; default: throw new ArrayIndexOutOfBoundsException("ProvUtilities.setter() for " + kind + " and index " + i);
time = optionalTime("prov:time", attributeMap); Used wUB = pf.newUsed(id); wUB.setActivity(activity2); if (entity2 != null) wUB.setEntity(entity2); if (time != null) { wUB.setTime(time);
Used u3 = newUsed(p1, "imgRef", a1);u3.setId(q("u3")); Used u4 = newUsed(p1, "hdrRef", a2); Used u5 = newUsed(p2, "img", a5); wd1.setActivity(p1.getId()); wd1.setGeneration(wg1.getId()); wd1.setUsage(u3.getId()); WasDerivedFrom wd2 = newWasDerivedFrom(a11, a2); WasDerivedFrom wd3 = newWasDerivedFrom(a11, a3);
public Used newUsed(QualifiedName id, QualifiedName activity, QualifiedName entity, XMLGregorianCalendar time, Collection<Attribute> attributes) { Used res = newUsed(id, activity, null, entity); res.setTime(time); setAttributes(res, attributes); return res; }
public void testScruffyUsage2() { Used use1 = pFactory.newUsed(q("use1"), q("a1"), null, q("e1")); use1.setTime(pFactory.newTimeNow()); use1.getOther().add(pFactory.newOther(EX_NS, "tag2", EX_PREFIX, "hello", name.XSD_STRING)); Used use2 = pFactory.newUsed(q("use1"), q("a1"), null, q("e1")); use2.setTime(pFactory.newISOTime("2012-12-03T21:08:16.686Z")); use2.getOther().add(pFactory.newOther(EX_NS, "tag2", EX_PREFIX, "hi", name.XSD_STRING)); Entity e1 = pFactory.newEntity(q("e1")); Activity a1 = pFactory.newActivity(q("a1")); Statement[] opt = new Statement[] { e1, a1 }; Statement[] statements = new Statement[] { use1, use2 }; makeDocAndTest(statements, opt, "target/scruffy-usage2"); }
WasDerivedFrom wd1=pFactory.newWasDerivedFrom(null,e2.getId(),e1.getId(),a3.getId(),wg1.getId(),u1.getId(),null);
public void testDoc403() { Document idoc403=new IndexedDocument(pFactory,makeDoc403()).toDocument(); assertEquals(idoc403.getStatementOrBundle().size(),1); Used u=(Used) idoc403.getStatementOrBundle().get(0); assertEquals("label",1,u.getLabel().size()); assertEquals("other",2,u.getOther().size()); }
/** A factory method to create an instance of a usage {@link Used} * @param id an optional identifier for a usage * @return an instance of {@link Used} */ public Used newUsed(QualifiedName id) { Used res = of.createUsed(); res.setId(id); return res; }
public QualifiedName getEffect(Relation r) { if (r instanceof Used) { return ((Used) r).getActivity();
public QualifiedName getCause(Relation r) { if (r instanceof Used) { return ((Used) r).getEntity();
public Used newUsed(org.openprovenance.prov.model.QualifiedName activity, String role, org.openprovenance.prov.model.QualifiedName entity){ Used u1 = pFactory.newUsed(activity, entity); u1.getRole().add(pFactory.newRole(role,name.XSD_STRING)); return u1; }
public void testDoc402() { Document idoc402=new IndexedDocument(pFactory,makeDoc402()).toDocument(); assertEquals(idoc402.getStatementOrBundle().size(),1); Used u=(Used) idoc402.getStatementOrBundle().get(0); assertEquals("label",1,u.getLabel().size()); }
@Override public void doAction(Used use) { register(use.getId()); register(use.getEntity()); register(use.getActivity()); registerLocation(use.getLocation()); registerRole(use.getRole()); registerType(use.getType()); registerOther(use.getOther()); }
final org.openprovenance.prov.model.Used a=(org.openprovenance.prov.model.Used) s; switch (i) { case 0: a.setId((QualifiedName)val); return; case 1: a.setActivity((QualifiedName)val); return; case 2: a.setEntity((QualifiedName)val); return; case 3: a.setTime((XMLGregorianCalendar)val); return; default: throw new ArrayIndexOutOfBoundsException("ProvUtilities.setter() for " + kind + " and index " + i);