def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ loc_def = dict(ro_def) wkf = loc_def.pop('workflow') ResearchObject.init(self, session, loc_def) self.workflow = wkf # link to workflow associated to this provenance ROLink.connect(session, self.id, wkf, 'use') # link to workflow nodes associated with each process? # link to external data consumed input_data = set() for pexec in ro_def["executions"]: for port in pexec['inputs']: if port['data'] is not None: input_data.add(port['data']) input_ref = set() for did in input_data: ddef = get_data_def(ro_def, did) if ddef['type'] == 'ref': input_ref.add(ddef['value']) for did in input_ref: ROLink.connect(session, self.id, did, 'consume') # link to external data produced output_data = set() for pexec in ro_def["executions"]: for port in pexec['outputs']: if port['data'] is not None: output_data.add(port['data']) output_ref = set() for did in output_data: ddef = get_data_def(ro_def, did) if ddef['type'] == 'ref': output_ref.add(ddef['value']) for did in output_ref: ROLink.connect(session, self.id, did, 'produce')
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ loc_def = dict(ro_def) doi = loc_def.pop('doi', "") ResearchObject.init(self, session, loc_def) self.doi = doi
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ ResearchObject.init(self, session, ro_def) # link to nodes used by this workflow uids = set(ndef['id'] for ndef in ro_def.get('nodes', [])) for uid in uids: ROLink.connect(session, self.id, uid, 'use')
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ loc_def = dict(ro_def) interface = loc_def.pop('interface', self.implements) value = loc_def.pop('value', None) ResearchObject.init(self, session, loc_def) self.interface = interface self.value = json.dumps(value)
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ # remove attributes locally stored loc_def = dict(ro_def) schema = loc_def.pop('schema', "{}") ancestors = loc_def.pop('ancestors', []) ResearchObject.init(self, session, loc_def) self.schema = schema for ancestor in ancestors: ROLink.connect(session, ancestor, self.id, 'is_ancestor_of')
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ # remove attributes locally stored loc_def = dict(ro_def) contents = loc_def.pop('contents', []) ctype = loc_def.pop('ctype', "container") ResearchObject.init(self, session, loc_def) self.ctype = ctype for ro in contents: ROLink.connect(session, self.id, ro.id, "contains")
def init(self, session, ro_def): """Initialize this RO with a set of attributes Args: session (DBSession): ro_def (dict): set of properties to initialize this RO Returns: None """ loc_def = dict(ro_def) # check attributes if 'inputs' not in loc_def: loc_def['inputs'] = [] if 'outputs' not in loc_def: loc_def['outputs'] = [] ResearchObject.init(self, session, loc_def) # link to interfaces used by this node ports = chain(loc_def['inputs'], loc_def['outputs']) uids = set(port_def['interface'] for port_def in ports) for uid in uids: ROLink.connect(session, self.id, uid, 'use')
def main(session): ro_top = ROContainer() ro_top.init(session, dict(owner=users[0].id, name="sample")) ro_top.public = True containers.append(ro_top) ro1 = ResearchObject() ro1.init(session, dict(owner=users[0].id, name="RO one")) ro1.add_policy(session, users[0], Role.view) ro1.add_policy(session, teams[2], Role.edit) ro2 = ResearchObject() ro2.init(session, dict(owner=users[0].id, name="RO two")) ROLink.connect(session, ro1.id, ro2.id, "contains") ro3 = ResearchObject() ro3.init(session, dict(owner=users[0].id, name="RO three")) ros = [] for i in range(5): ro = ResearchObject() ro.init(session, dict(owner=users[0].id, name="RO%d" % i)) ros.append(ro) roc = ROContainer() roc.init(session, dict(owner=users[0].id, name="myproject", remote="https://github.com/revesansparole/roc", contents=ros)) ROLink.connect(session, ro_top.id, roc.id, 'contains') ros = [] for i in range(5): ro = ResearchObject() ro.init(session, dict(owner=users[1].id, name="ROcp%d" % i)) ros.append(ro) ro = ROArticle() ro.init(session, dict(owner=users[2].id, name="cp article")) ro.add_policy(session, users[0], Role.view) ros.append(ro) roc2 = ROContainer() roc2.init(session, dict(owner=users[2].id, name="CPproject", contents=ros)) ROLink.connect(session, ro_top.id, roc2.id, 'contains') roa = ROArticle() roa.init(session, dict(owner=users[0].id, name="test article")) roa.doi = "10.1016/S0304-3800(98)00100-8" descr = dedent(""" We present a new approach to simulate the distribution of natural light within plant canopies. The canopy is described in 3D, each organ being represented by a set of polygons. Our model calculates the light incident on each polygon. The principle is to distinguish for each polygon the contribution of the light coming directly from light sources, the light scattered from close polygons and that scattered from far polygons. Close polygons are defined as located inside a sphere surrounding the studied polygon and having a diameter Ds. The direct light is computed by projection. The exchanges between close polygons are computed by the radiosity method, whereas the contribution from far polygons is estimated by a multi-layer model. The main part of computing time corresponds to the calculations of the geometric coefficients of the radiosity system. Then radiative exchanges can be quickly simulated for various conditions of the angular distribution of incoming light and various optical properties of soil and phytolelements. Simulations compare satisfactorily with those produced by a Monte Carlo ray tracing. They show that considering explicitly the close neighboring of each polygon improves the estimation of organs irradiance, by taking into account the local variability of fluxes. For a virtual maize canopy, these estimations are satisfying with Ds=0.5 m; in these conditions, the simulation time on a workstation was 25 min for a canopy of 100 plants.""") roa.store_description(descr) ROLink.connect(session, roc.id, roa.id, "contains") ROLink.connect(session, ro3.id, roa.id, "use")