/** Return all WasDerivedFrom edges with artifact a as an effect . */ public Collection<WasDerivedFrom> getWasDerivedFromWithEffect(Artifact a) { return artifactEffectWasDerivedFromMap.get(a.getId()); }
/** Return all used edges with artifact a as a cause. */ public Collection<Used> getUsed(Artifact p) { return artifactUsedMap.get(p.getId()); }
/** Return all WasDerivedFrom edges with artifact a as a cause. */ public Collection<WasDerivedFrom> getWasDerivedFromWithCause(Artifact a) { return artifactCauseWasDerivedFromMap.get(a.getId()); }
/** Return all WasGeneratedBy edges with artifact a as a cause. */ public Collection<WasGeneratedBy> getWasGeneratedBy(Artifact p) { return artifactWasGeneratedByMap.get(p.getId()); }
public Artifact addArtifact(Artifact artifact) { return addArtifact(artifact.getId(),artifact); } public Artifact addArtifact(String name, Artifact artifact) {
public void hashCode(HashCodeBuilder hashCodeBuilder) { hashCodeBuilder.append(this.getAccount()); hashCodeBuilder.append(this.getAnnotation()); hashCodeBuilder.append(this.getId()); }
/** * orphan artifacts are those that are in the graph but are never used neither generated. this * indicates some problem with the graph structure. this method is used for diagnostics after import has finished * @return */ public List<String> getOrphanArtifacts() { List<String> allwgb = new ArrayList<String>(); List<String> allUsed = new ArrayList<String>(); List<String> orphans = new ArrayList<String>(); if (graph == null) { logger.warn("null graph while attempting to count orphan artifacts -- giving up"); return orphans; } Artifacts allArtifacts = graph.getArtifacts(); for ( Map.Entry<String, Map<String,List<String>>>entry: wgbArtifactsByAccount.entrySet()) { allwgb.addAll(entry.getValue().keySet()); } for ( Map.Entry<String, Map<String,List<String>>>entry: usedArtifactsByAccount.entrySet()) { allUsed.addAll(entry.getValue().keySet()); } List<Artifact> artifacts = allArtifacts.getArtifact(); for (Artifact a:artifacts) { if (!allwgb.contains(a.getId()) && !allUsed.contains(a.getId())) { orphans.add(a.getId()); } } return orphans; }
public void toString(ToStringBuilder toStringBuilder) { { List<AccountRef> theAccount; theAccount = this.getAccount(); toStringBuilder.append("account", theAccount); } { List<JAXBElement<? extends EmbeddedAnnotation>> theAnnotation; theAnnotation = this.getAnnotation(); toStringBuilder.append("annotation", theAnnotation); } { String theId; theId = this.getId(); toStringBuilder.append("id", theId); } }
public void equals(Object object, EqualsBuilder equalsBuilder) { if (!(object instanceof Artifact)) { equalsBuilder.appendSuper(false); return ; } if (this == object) { return ; } final Artifact that = ((Artifact) object); equalsBuilder.append(this.getAccount(), that.getAccount()); equalsBuilder.append(this.getAnnotation(), that.getAnnotation()); equalsBuilder.append(this.getId(), that.getId()); }
public String artifactLabel(Artifact p) { if (displayArtifactValue) { return convertArtifactName(""+of.getLabel(p)); } else { return p.getId(); } } public String artifactColor(Artifact p) {
usedVarsByAccount.put(workflowId, usedVars); List<Port> vars = usedVars.get(((Artifact) artId.getRef()).getId()); usedVars.put(((Artifact) artId.getRef()).getId(), vars); String artifactName = ((Artifact) artId.getRef()).getId(); List<String> processes = usedArtifacts.get(artifactName); if (processes == null) {
public Artifact newArtifact(Artifact a) { LinkedList<Account> ll=new LinkedList(); for (AccountRef acc: a.getAccount()) { ll.add(newAccount((Account)acc.getRef())); } Artifact res=newArtifact(a.getId(),ll); addNewAnnotations(res,a.getAnnotation()); return res; } public Process newProcess(Process a) {
public void emitArtifact(Artifact a, PrintStream out) { HashMap<String,String> properties=new HashMap(); emitNode(a.getId(), addArtifactShape(a,addArtifactLabel(a, addArtifactColor(a,properties))), out); emitAnnotations(a,out); }
public WasDerivedFrom newWasDerivedFrom(WasDerivedFrom d) { WasDerivedFrom wdf=newWasDerivedFrom(d.getId(), newArtifactRef(artifactRegister2.get(((Artifact)d.getEffect().getRef()).getId())), newArtifactRef(artifactRegister2.get(((Artifact)d.getCause().getRef()).getId())), newAccounts(d.getAccount())); wdf.getAnnotation().addAll(d.getAnnotation()); return wdf; }
/** * generic processing of a process-artifact dependency * @param procID * @param artId * @param role * @param workflowId * @param workflowRun * @param artifactIsInput */ private Port processProcessArtifactDep(ProcessRef procID, ArtifactRef artId, Role role, String workflowId, String workflowRun, boolean artifactIsInput) { String procName = ((org.openprovenance.model.Process) procID.getRef()).getId(); String portName = role.getValue(); String value = ((Artifact) artId.getRef()).getId(); portName = removeBlanks(portName); return processProcessArtifactDep(procName, value, portName, workflowId, workflowRun, artifactIsInput); }
public Used newUsed(Used d) { Used u=newUsed(d.getId(), newProcessRef(processRegister2.get(((Process)d.getEffect().getRef()).getId())), newRole(d.getRole()), newArtifactRef(artifactRegister2.get(((Artifact)d.getCause().getRef()).getId())), newAccounts(d.getAccount())); u.getAnnotation().addAll(d.getAnnotation()); if (d.getTime()!=null) u.setTime(newOTime(d.getTime())); return u; } public WasGeneratedBy newWasGeneratedBy(WasGeneratedBy d) {
as.add(register(a.getId(),newArtifact(a)));
public WasGeneratedBy newWasGeneratedBy(WasGeneratedBy d) { WasGeneratedBy wgb=newWasGeneratedBy(d.getId(), newArtifactRef(artifactRegister2.get(((Artifact)d.getEffect().getRef()).getId())), newRole(d.getRole()), newProcessRef(processRegister2.get(((Process)d.getCause().getRef()).getId())), newAccounts(d.getAccount())); wgb.getAnnotation().addAll(d.getAnnotation()); if (d.getTime()!=null) wgb.setTime(newOTime(d.getTime())); return wgb; }