@Override public Object doAction(Entity s) { return newEntity(s); }
@Override public Object doAction(Entity s) { return newEntity(s); }
/** * 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 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; } /**
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); } }
/** * 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; }
/** * 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; }
private void createEntity(QualifiedName context, QualifiedName qualifiedName) { List<Attribute> attributes = collectAttributes(context, qualifiedName, Types.ProvType.ENTITY); org.openprovenance.prov.model.Entity entity = pFactory.newEntity(qualifiedName, attributes); getBundleHolder(context).store(entity); }
/** * Creates a copy of an entity. The copy is shallow in the sense that the new Entity shares the same attributes as the original Entity. * @param e an {@link Entity} to copy * @return a copy of the input {@link Entity} */ public Entity newEntity(Entity e) { Entity res = newEntity(e.getId()); res.getOther().addAll(e.getOther()); res.getType().addAll(e.getType()); res.getLabel().addAll(e.getLabel()); res.getLocation().addAll(e.getLocation()); return res; }
public void testEntity1() { Entity a = pFactory.newEntity(q("e1")); makeDocAndTest(a, "target/entity1"); }
public void testEntityWithOneTypeAttribute(int i) { Entity a = pFactory.newEntity(q("et" + i)); Object [] pair= attributeValues[i]; Object value=pair[0]; QualifiedName type=(QualifiedName) pair[1]; a.getType().add(pFactory.newType(value,type)); makeDocAndTest(a,"target/attr_entity_one_attr"+i); }
public void testEntity3() { Entity a = pFactory.newEntity(q("e3"), "entity3"); addValue(a); makeDocAndTest(a, "target/entity3"); }
public void testEntity5() { Entity a = pFactory.newEntity(q("e5"), "entity5"); addTypes(a); makeDocAndTest(a, "target/entity5"); }
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); }
public void testEntityWithOneValueAttribute(int i) { Entity a = pFactory.newEntity(q("en_v" + i)); Object [] pair= attributeValues[i]; Object value=pair[0]; QualifiedName type=(QualifiedName) pair[1]; a.setValue(pFactory.newValue(value,type)); makeDocAndTest(a,"target/attr_entity_one_value_attr"+i); }
public void testEntity7() { Entity a = pFactory.newEntity(q("e7"), "entity7"); addTypes(a); addLocations(a); addLabels(a); makeDocAndTest(a, "target/entity7"); }
public void testEntity10() { Entity a = pFactory.newEntity(q("e10"), "entity10"); addTypes(a); addLocations(a); addLabels(a); addFurtherAttributes(a); makeDocAndTest(a, "target/entity10"); }
public void testEntity9() { Entity a = pFactory.newEntity(q("e9"), "entity9"); addTypes(a); addLocations(a); addLabels(a); addFurtherAttributes(a); makeDocAndTest(a, "target/entity9"); }
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 void testScruffyStart1() { WasStartedBy start1 = pFactory.newWasStartedBy(q("start1"), q("a1"), q("e1")); start1.setTime(pFactory.newTimeNow()); WasStartedBy start2 = pFactory.newWasStartedBy(q("start1"), q("a1"), q("e1")); start2.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[] { start1, start2 }; makeDocAndTest(statements, opt, "target/scruffy-start1"); }