public Document newDocument(Activity[] ps, Entity[] as, Agent[] ags, Statement[] lks) { return newDocument(((ps == null) ? null : Arrays.asList(ps)), ((as == null) ? null : Arrays.asList(as)), ((ags == null) ? null : Arrays.asList(ags)), ((lks == null) ? null : Arrays.asList(lks))); }
public void add1DValues_v2(List<Statement> ll, Hashtable<QualifiedName, List<QualifiedName>> variables) { for (Entry<QualifiedName, List<QualifiedName>> entry: variables.entrySet()) { int count=0; List<Attribute> attrs=new LinkedList<Attribute>(); for (QualifiedName qn: entry.getValue()) { attrs.add(pf.newAttribute(TMPL_NS, VALUE_v2+count, TMPL_PREFIX, qn, pf.getName().PROV_QUALIFIED_NAME)); count++; } Entity e=pf.newEntity(entry.getKey(),attrs); ll.add(e); } }
/** A factory method to create an instance of a delegation {@link ActedOnBehalfOf} * @param id identifier for the delegation association between delegate and responsible * @param delegate identifier for the agent associated with an activity, acting on behalf of the responsible agent * @param responsible identifier for the agent, on behalf of which the delegate agent acted * @return an instance of {@link ActedOnBehalfOf} */ public ActedOnBehalfOf newActedOnBehalfOf(QualifiedName id, QualifiedName delegate, QualifiedName responsible) { ActedOnBehalfOf res=newActedOnBehalfOf(id, delegate, responsible, null,null); return res; }
/** * Creates a new {@link Entity} with provided identifier and attributes * @param id a {@link QualifiedName} for the entity * @param attributes a collection of {@link Attribute} for the entity * @return an object of type {@link Entity} */ public Entity newEntity(QualifiedName id, Collection<Attribute> attributes) { Entity res = newEntity(id); setAttributes(res, attributes); return res; } /**
/** * Creates a new {@link Agent} with provided identifier and attributes * @param id a {@link QualifiedName} for the agent * @param attributes a collection of {@link Attribute} for the agent * @return an object of type {@link Agent} */ public Agent newAgent(QualifiedName id, Collection<Attribute> attributes) { Agent res = newAgent(id); setAttributes(res, attributes); return res; }
/** * Creates a new {@link Agent} with provided identifier and label * @param ag a {@link QualifiedName} for the agent * @param label a String for the label property (see {@link HasLabel#getLabel()} * @return an object of type {@link Agent} */ public Agent newAgent(QualifiedName ag, String label) { Agent res = newAgent(ag); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
public void testScruffyUsage1() { Used use1 = pFactory.newUsed(q("use1"), q("a1"), null, q("e1")); use1.setTime(pFactory.newTimeNow()); Used use2 = pFactory.newUsed(q("use1"), q("a1"), null, q("e1")); use2.setTime(pFactory.newISOTime("2012-12-03T21:08:16.686Z")); 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-usage1"); }
public void testScruffyEnd1() { WasEndedBy end1 = pFactory.newWasEndedBy(q("end1"), q("a1"), q("e1")); end1.setTime(pFactory.newTimeNow()); WasEndedBy end2 = pFactory.newWasEndedBy(q("end1"), q("a1"), q("e1")); end2.setTime(pFactory.newISOTime("2012-12-03T21:08:16.686Z")); Entity e1 = pFactory.newEntity(q("e1")); Activity a1 = pFactory.newActivity(q("a1")); Statement[] opt = new Statement[] { e1, a1 }; Statement[] statements = new Statement[] { end1, end2 }; makeDocAndTest(statements, opt, "target/scruffy-end1"); }
public Document toDocument_v2 () { List<Statement> ll=new LinkedList<Statement>(); add1DValues_v2(ll,variables); add2Dvalues_v2(ll,attributes); Document dummy=pf.newDocument(null,ll,new LinkedList<Bundle>()); Document result=pf.newDocument(pf.newNamespace(Namespace.gatherNamespaces(dummy)),ll,new LinkedList<Bundle>()); return result; }
public WasGeneratedBy newWasGeneratedBy(QualifiedName id, Entity a, String role, Activity p) { WasGeneratedBy res=newWasGeneratedBy(id, a.getId(), p.getId()); if (role!=null) addRole(res, newRole(role,getName().XSD_STRING)); return res; }
public WasAttributedTo newWasAttributedTo(WasAttributedTo u) { WasAttributedTo u1 = newWasAttributedTo(u.getId(), u.getEntity(), u.getAgent()); u1.getOther().addAll(u.getOther()); u1.getType().addAll(u.getType()); u1.getLabel().addAll(u.getLabel()); return u1; }
public void testEntityWithOneOtherAttribute(int i) { Entity a = pFactory.newEntity(q("en_o" + i)); Object [] pair= attributeValues[i]; Object value=pair[0]; QualifiedName type=(QualifiedName) pair[1]; a.getOther().add(pFactory.newOther(pFactory.newQualifiedName(EX_NS, "tag2", "exo"), value,type)); makeDocAndTest(a,"target/attr_entity_one_other_attr"+i); }
/** * Creates a new {@link Entity} with provided identifier and label * @param id a {@link QualifiedName} for the entity * @param label a String for the label property (see {@link HasLabel#getLabel()} * @return an object of type {@link Entity} */ public Entity newEntity(QualifiedName id, String label) { Entity res = newEntity(id); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
public Activity newActivity(QualifiedName q, String label) { Activity res = newActivity(q); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
public List<Attribute> convertLabelAttributes(HasLabel e, List<Attribute> acc) { List<LangString> labels = e.getLabel(); for (LangString label : labels) { acc.add(pFactory.newAttribute(Attribute.AttributeKind.PROV_LABEL,label, pFactory.getName().XSD_STRING)); } return acc; }
/** A factory method to create an instance of an Association {@link WasAssociatedWith} * @param id an identifier for the association * @return an instance of {@link WasAssociatedWith} */ public WasAssociatedWith newWasAssociatedWith(QualifiedName id) { return newWasAssociatedWith(id, (QualifiedName)null,(QualifiedName)null); }
public Activity newActivity(Activity a) { Activity res = newActivity(a.getId()); res.getType().addAll(a.getType()); res.getLabel().addAll(a.getLabel()); res.getLocation().addAll(a.getLocation()); res.setStartTime(a.getStartTime()); res.setEndTime(a.getEndTime()); return res; }
/** 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; }