public void hashCode(HashCodeBuilder hashCodeBuilder) { hashCodeBuilder.append(this.getAccount()); hashCodeBuilder.append(this.getAnnotation()); hashCodeBuilder.append(this.getId()); }
public RdfAgent(ElmoManager manager, QName qname) { this.manager=manager; this.qname=qname; this.prefix=qname.getNamespaceURI(); super.setId(qname.getLocalPart()); }
/** * Create an instance of {@link Agent } * */ public Agent createAgent() { return new Agent(); }
/** Return all WasControlledBy edges with artifact a as a cause. */ public Collection<WasControlledBy> getWasControlledBy(Agent a) { return agentWasControlledByMap.get(a.getId()); }
Resource res=Resource.uriRef(urify(a.getId())); ProvenanceAgent rdfAgent; rdfAgent = pcf.newAgent((String)oFactory.getLabel(a),res); agentTable.put(a.getId(),rdfAgent); idTable.put(a.getId(),subject); if (!(a.getAnnotation().isEmpty())) { mc.addTriples(triplifyAnnotations(subject,a.getAnnotation()));
Resource res=Resource.uriRef(urify(a.getId())); ProvenanceAgent rdfAgent; if (a.getValue() instanceof String) { rdfAgent = pcf.newAgent((String)a.getValue(),res); } else { logger.warn("how to serialise agent value?"); rdfAgent = pcf.newAgent(a.getValue().toString(),res); agentTable.put(a.getId(),rdfAgent);
public void sortGraph(OPMGraph graph) { graph.setAnnotations(oFactory.getObjectFactory().createAnnotations()); sortById((List)graph.getAccounts().getAccount()); if (graph.getProcesses()!=null && graph.getProcesses().getProcess()!=null) { sortById((List)graph.getProcesses().getProcess()); for (Process p: graph.getProcesses().getProcess()) { sortAnnotations(p.getAnnotation()); sortByRef(p.getAccount()); } } if (graph.getArtifacts()!=null && graph.getArtifacts().getArtifact()!=null) { sortById((List)graph.getArtifacts().getArtifact()); for (Artifact a: graph.getArtifacts().getArtifact()) { sortAnnotations(a.getAnnotation()); sortByRef(a.getAccount()); } } if (graph.getAgents()!=null && graph.getAgents().getAgent()!=null) { sortById((List)graph.getAgents().getAgent()); for (Agent a: graph.getAgents().getAgent()) { sortAnnotations(a.getAnnotation()); sortByRef(a.getAccount()); } } for (Object e: graph.getDependencies().getUsedOrWasGeneratedByOrWasTriggeredBy()) { sortAnnotations(((Edge)e).getAnnotation()); sortByRef(((Edge)e).getAccount()); } sortEdges(graph.getDependencies().getUsedOrWasGeneratedByOrWasTriggeredBy()); }
public void embedExternalAnnotations(OPMGraph graph) { IndexedOPMGraph igraph=new IndexedOPMGraph(oFactory,graph); // embed external annotations if (graph.getAnnotations()!=null) { List<Annotation> anns=graph.getAnnotations().getAnnotation(); for (Annotation ann: anns) { String id=(((Identifiable)ann.getLocalSubject()).getId()); EmbeddedAnnotation embedded=oFactory.newEmbeddedAnnotation(ann.getId(), ann.getProperty(), ann.getAccount(), null); Process p=igraph.getProcess(id); if (p!=null) { p.getAnnotation().add(oFactory.compactAnnotation(embedded)); } else { Artifact a=igraph.getArtifact(id); if (a!=null) { a.getAnnotation().add(oFactory.compactAnnotation(embedded)); } else { Agent ag=igraph.getAgent(id); if (ag!=null) { ag.getAnnotation().add(oFactory.compactAnnotation(embedded)); } } } } graph.setAnnotations(null); } }
public String agentColor(Agent p) { // Note, I should compute effective account membership List<String> colors=new LinkedList(); for (AccountRef acc: p.getAccount()) { String accountLabel=((Account)acc.getRef()).getId(); String colour=convertAccount(accountLabel); colors.add(colour); } return selectColor(colors); }
public boolean equals(Object object) { if (!(object instanceof Agent)) { return false; } if (this == object) { return true; } final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder(); equals(object, equalsBuilder); return equalsBuilder.isEquals(); }
public Agent addAgent(Agent agent) { return addAgent(agent.getId(),agent); } public Agent addAgent(String name, Agent agent) {
public void noAnnotation(OPMGraph graph) { graph.setAnnotations(null); destroy(graph.getAnnotation()); if (graph.getProcesses()!=null && graph.getProcesses().getProcess()!=null) { for (Process p: graph.getProcesses().getProcess()) { destroy(p.getAnnotation()); } } if (graph.getArtifacts()!=null && graph.getArtifacts().getArtifact()!=null) { for (Artifact a: graph.getArtifacts().getArtifact()) { destroy(a.getAnnotation()); } } if (graph.getAgents()!=null && graph.getAgents().getAgent()!=null) { for (Agent a: graph.getAgents().getAgent()) { destroy(a.getAnnotation()); } } for (Object e: graph.getDependencies().getUsedOrWasGeneratedByOrWasTriggeredBy()) { destroy(((Edge)e).getAnnotation()); } }
List<AccountRef> accRefs=a.getAccount();
public void equals(Object object, EqualsBuilder equalsBuilder) { if (!(object instanceof Agent)) { equalsBuilder.appendSuper(false); return ; } if (this == object) { return ; } final Agent that = ((Agent) object); equalsBuilder.append(this.getAccount(), that.getAccount()); equalsBuilder.append(this.getAnnotation(), that.getAnnotation()); equalsBuilder.append(this.getId(), that.getId()); }
public String agentLabel(Agent p) { if (displayAgentValue) { return convertAgentName(""+of.getLabel(p)); } else { return p.getId(); } }
public void setId(String value) { super.setId(value); qname = new QName(prefix, value); manager.designate(qname, org.openprovenance.rdf.Agent.class); }
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 emitAgent(Agent ag, PrintStream out) { HashMap<String,String> properties=new HashMap(); emitNode(ag.getId(), addAgentShape(ag,addAgentLabel(ag, addAgentColor(ag,properties))), out); emitAnnotations(ag,out); }
public Agent newAgent(String ag, Collection<Account> accounts, String label) { Agent res=of.createAgent(); res.setId(ag); addAccounts(res,accounts,null); if (label!=null) addAnnotation(res,newLabel(label)); return res; }
public Agent newAgent(Agent a) { LinkedList<Account> ll=new LinkedList(); for (AccountRef acc: a.getAccount()) { ll.add(newAccount((Account)acc.getRef())); } Agent res=newAgent(a.getId(),ll); addNewAnnotations(res,a.getAnnotation()); return res; }