Create prov entities and activities.
493817
def export(self, nidm_version, export_dir):
        
        if nidm_version['major'] < 1 or \
                (nidm_version['major'] == 1 and nidm_version['minor'] < 3):
            self.type = NLX_OLD_FSL

        atts = (
            (PROV['type'], self.type),
            (PROV['type'], PROV['SoftwareAgent']),
            (PROV['label'], Literal(self.label, datatype=XSD_STRING)),
            (NIDM_SOFTWARE_VERSION, self.version)
            )

        if self.feat_version:
            atts = atts + ((FSL_FEAT_VERSION, self.feat_version),)

        self.add_attributes(atts)
1122418
public function build()
    {
        $workflow = new Workflow($this->workflowId, $this->workflowName);

        foreach ($this->roles as $id => $role) {
            list($name) = $role;
            $workflow->addRole(new Role($id, $name));
        }

        foreach ($this->startEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new StartEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->endEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new EndEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->tasks as $id => $task) {
            list($roleId, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new Task($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->serviceTasks as $id => $task) {
            list($roleId, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ServiceTask($id, $workflow->getRole($roleId), $operation, $name));
        }

        foreach ($this->sendTasks as $id => $task) {
            list($roleId, $message, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new SendTask($id, $workflow->getRole($roleId), $message, $operation, $name));
        }

        foreach ($this->exclusiveGateways as $id => $gateway) {
            list($roleId, $name) = $gateway;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ExclusiveGateway($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->sequenceFlows as $id => $flow) {
            list($source, $destination, $name, $condition) = $flow;

            if (array_key_exists($id, $this->defaultableFlowObjects) && $condition !== null) {
                throw new \LogicException(sprintf('The sequence flow "%s" has the condition "%s". A condition cannot be set to the default sequence flow.', $id, $condition));
            }

            $flowObject = $workflow->getFlowObject($source); /* @var $flowObject TransitionalInterface */
            $workflow->addConnectingObject(new SequenceFlow($id, $flowObject, $workflow->getFlowObject($destination), $name, $condition === null ? null : new Expression($condition)));

            if (array_key_exists($id, $this->defaultableFlowObjects)) {
                $flowObject = $workflow->getFlowObject($this->defaultableFlowObjects[$id]);
                /* @var $flowObject ConditionalInterface */$flowObject->setDefaultSequenceFlowId($id);
            }
        }

        return $workflow;
    }
74217
def create_agency(self):
        """"""
        agency = self.agency
        links = self.find_table_links()
        definition_dict = self.find_definition_urls(links)
        with open(agency + '.txt', 'w') as f:
            f.write(str(definition_dict))
331081
def init_prov_graph(self):
        

        try:
            # Use git2prov to get prov on the repo
            repo_prov = check_output(
                ['node_modules/git2prov/bin/git2prov', 'https://github.com/{}/{}/'.format(self.user, self.repo),
                 'PROV-O']).decode("utf-8")
            repo_prov = repo_prov[repo_prov.find('@'):]
            # glogger.debug('Git2PROV output: {}'.format(repo_prov))
            glogger.debug('Ingesting Git2PROV output into RDF graph')
            with open('temp.prov.ttl', 'w') as temp_prov:
                temp_prov.write(repo_prov)

            self.prov_g.parse('temp.prov.ttl', format='turtle')
        except Exception as e:
            glogger.error(e)
            glogger.error("Couldn't parse Git2PROV graph, continuing without repo PROV")
            pass

        self.prov_g.add((self.agent, RDF.type, self.prov.Agent))
        self.prov_g.add((self.entity_d, RDF.type, self.prov.Entity))
        self.prov_g.add((self.activity, RDF.type, self.prov.Activity))

        # entity_d
        self.prov_g.add((self.entity_d, self.prov.wasGeneratedBy, self.activity))
        self.prov_g.add((self.entity_d, self.prov.wasAttributedTo, self.agent))
        # later: entity_d genereated at time (when we know the end time)

        # activity
        self.prov_g.add((self.activity, self.prov.wasAssociatedWith, self.agent))
        self.prov_g.add((self.activity, self.prov.startedAtTime, Literal(datetime.now())))
1007089
def before_processing(eng, objects):
        """"""
        super(InvenioProcessingFactory, InvenioProcessingFactory)\
            .before_processing(eng, objects)
        eng.save(WorkflowStatus.RUNNING)
        db.session.commit()
1256106
public function setupProboCi()
    {
        $filename = ProjectX::projectRoot() . '/.probo.yml';
        $this->taskWriteToFile($filename)
            ->text($this->loadTemplateContents('.probo.yml'))
            ->place('PROJECT_ROOT', $this->getInstallRoot())
            ->run();

        return $this;
    }
993614
def create(fs, channels, application):
    """"""

    result_code = ctypes.c_int()

    result = _create(fs, channels, application, ctypes.byref(result_code))
    if result_code.value is not constants.OK:
        raise OpusError(result_code.value)

    return result
864948
def write_spo(sub, prd, obj):
    '''
        
    '''
    rcvtriples.append(make_spo(sub, prd, obj))
385348
def _create_project(self, path):
        """"""
        self.open_project(path=path)
        self.setup_menu_actions()
        self.add_to_recent(path)
382301
def generate_entities_doc(ctx, out_path, package):
    """"""
    from canari.commands.generate_entities_doc import generate_entities_doc
    generate_entities_doc(ctx.project, out_path, package)
621639
private void createActions() {
        maximizeAction = new MaximizeAction();
        iconifyAction  = new IconifyAction();
        closeAction    = new CloseAction();
        restoreAction  = new RestoreAction();
        moveAction     = new MoveAction();
        sizeAction     = new SizeAction();
    }
858330
def register_processes(self, process_schemas, user, force=False, verbosity=1):
        """"""
        log_processors = []
        log_templates = []

        for p in process_schemas:
            # TODO: Remove this when all processes are migrated to the
            #       new syntax.
            if 'flow_collection' in p:
                if 'entity' in p:
                    self.stderr.write(
                        "Skip processor {}: only one of 'flow_collection' and 'entity' fields "
                        "allowed".format(p['slug'])
                    )
                    continue

                p['entity'] = {'type': p.pop('flow_collection')}

            if p['type'][-1] != ':':
                p['type'] += ':'

            if 'category' in p and not p['category'].endswith(':'):
                p['category'] += ':'

            for field in ['input', 'output']:
                for schema, _, _ in iterate_schema({}, p[field] if field in p else {}):
                    if not schema['type'][-1].endswith(':'):
                        schema['type'] += ':'
            # TODO: Check if schemas validate with our JSON meta schema and Processor model docs.

            if not self.valid(p, PROCESSOR_SCHEMA):
                continue

            if 'entity' in p:
                if 'type' not in p['entity']:
                    self.stderr.write(
                        "Skip process {}: 'entity.type' required if 'entity' defined".format(p['slug'])
                    )
                    continue

                p['entity_type'] = p['entity']['type']
                p['entity_descriptor_schema'] = p['entity'].get('descriptor_schema', p['entity_type'])
                p['entity_input'] = p['entity'].get('input', None)
                p.pop('entity')

                if not DescriptorSchema.objects.filter(slug=p['entity_descriptor_schema']).exists():
                    self.stderr.write(
                        "Skip processor {}: Unknown descriptor schema '{}' used in 'entity' "
                        "field.".format(p['slug'], p['entity_descriptor_schema'])
                    )
                    continue

            if 'persistence' in p:
                persistence_mapping = {
                    'RAW': Process.PERSISTENCE_RAW,
                    'CACHED': Process.PERSISTENCE_CACHED,
                    'TEMP': Process.PERSISTENCE_TEMP,
                }

                p['persistence'] = persistence_mapping[p['persistence']]

            if 'scheduling_class' in p:
                scheduling_class_mapping = {
                    'interactive': Process.SCHEDULING_CLASS_INTERACTIVE,
                    'batch': Process.SCHEDULING_CLASS_BATCH
                }

                p['scheduling_class'] = scheduling_class_mapping[p['scheduling_class']]

            if 'input' in p:
                p['input_schema'] = p.pop('input')

            if 'output' in p:
                p['output_schema'] = p.pop('output')

            slug = p['slug']

            if 'run' in p:
                # Set default language to 'bash' if not set.
                p['run'].setdefault('language', 'bash')

                # Transform output schema using the execution engine.
                try:
                    execution_engine = manager.get_execution_engine(p['run']['language'])
                    extra_output_schema = execution_engine.get_output_schema(p)
                    if extra_output_schema:
                        p.setdefault('output_schema', []).extend(extra_output_schema)
                except InvalidEngineError:
                    self.stderr.write("Skip processor {}: execution engine '{}' not supported".format(
                        slug, p['run']['language']
                    ))
                    continue

            # Validate if container image is allowed based on the configured pattern.
            # NOTE: This validation happens here and is not deferred to executors because the idea
            #       is that this will be moved to a "container" requirement independent of the
            #       executor.
            if hasattr(settings, 'FLOW_CONTAINER_VALIDATE_IMAGE'):
                try:
                    container_image = dict_dot(p, 'requirements.executor.docker.image')
                    if not re.match(settings.FLOW_CONTAINER_VALIDATE_IMAGE, container_image):
                        self.stderr.write("Skip processor {}: container image does not match '{}'".format(
                            slug, settings.FLOW_CONTAINER_VALIDATE_IMAGE,
                        ))
                        continue
                except KeyError:
                    pass

            version = p['version']
            int_version = convert_version_string_to_int(version, VERSION_NUMBER_BITS)

            # `latest version` is returned as `int` so it has to be compared to `int_version`
            latest_version = Process.objects.filter(slug=slug).aggregate(Max('version'))['version__max']
            if latest_version is not None and latest_version > int_version:
                self.stderr.write("Skip processor {}: newer version installed".format(slug))
                continue

            previous_process_qs = Process.objects.filter(slug=slug)
            if previous_process_qs.exists():
                previous_process = previous_process_qs.latest()
            else:
                previous_process = None

            process_query = Process.objects.filter(slug=slug, version=version)
            if process_query.exists():
                if not force:
                    if verbosity > 0:
                        self.stdout.write("Skip processor {}: same version installed".format(slug))
                    continue

                process_query.update(**p)
                log_processors.append("Updated {}".format(slug))
            else:
                process = Process.objects.create(contributor=user, **p)
                assign_contributor_permissions(process)
                if previous_process:
                    copy_permissions(previous_process, process)
                log_processors.append("Inserted {}".format(slug))

        if verbosity > 0:
            if log_processors:
                self.stdout.write("Processor Updates:")
                for log in log_processors:
                    self.stdout.write("  {}".format(log))

            if log_templates:
                self.stdout.write("Default Template Updates:")
                for log in log_templates:
                    self.stdout.write("  {}".format(log))
1074741
public function createAction() {
        $this->setStatusCode(201);
        $createObjects = $this->createActionProcess();

        if(sizeOf($createObjects) == 1) { //Default handling of passing in one
            $createObject = $createObjects[0];
            $this->setErrors($createObject->getErrors());
            $this->setStatusCode($createObject->getStatusCode());
            if(!is_null($createObject->getEntity())) {
                try {
                    $this->showActionInternal($createObject->getEntity());
                } catch(Exception $e) {
                    $this->handleError($e);
                } catch(ValidationException $e) {
                    $this->handleValidationError($e);
                } catch(AclException $e) {
                    $this->handleAclError($e);
                } catch(CatchableException $e) {
                    $this->handleCatchableError($e);
                }
            }
        } else {
            $this->setStatusCode(400);
            $hasOneSuccessful = false;
            $objects = [];
            foreach($createObjects as $createObject) {
                $object = new \stdClass();
                try {
                    if(!is_null($createObject->getEntity())) {
                        $hasOneSuccessful = true;
                        $object->{$createObject->getEntity()->getEntityName()} = $this->generateEntityAction($createObject->getEntity());
                    }
                    $object = $this->addErrorsAndStatus($createObject->getErrors(), $createObject->getStatusCode(), $object);
                } catch(Exception $e) {
                    $this->handleError($e);
                } catch(ValidationException $e) {
                    $this->handleValidationError($e);
                } catch(AclException $e) {
                    $this->handleAclError($e);
                } catch(CatchableException $e) {
                    $this->handleCatchableError($e);
                }
                $objects[] = $object;
            }
            $blankEntity = $this->generateEntity();
            $outputObject = $this->getOutputObject();
            $outputObject->{$blankEntity->getEntityName() . 's'} = $objects;
            $this->setOutputObject($outputObject);
            if($hasOneSuccessful) {
                $this->setStatusCode(201);
            }
        }


    }
99541
def create(self):
        """"""
        body = dict()
        if self.mapping is not None:
            body['mappings'] = self.mapping
        if self.settings is not None:
            body['settings'] = self.settings
        else:
            body['settings'] = self._default_settings()
        self.instance.indices.create(self.index, body)
623147
def create(self):
        """"""

        if not self.exists():
            self._create_path()
            self.create_tables()
            return True

        return False
656868
def create_activity(self, *args, **kwargs):
        
        if self._client.match_app_version(label='wim', version='<2.0.0', default=True):
            return self._client.create_activity(self.process, *args, **kwargs)
        else:
            return self._client.create_activity(self.workflow_root, *args, **kwargs)
206523
public function run(): void
    {
        $this->entityCreator->createTargetFileObject($this->entityFqn)->write();

        $this->abstractEntityFactoryCreator->createTargetFileObject()->writeIfNotExists();

        $this->entityFactoryCreator->createTargetFileObject()->write();

        $this->entityInterfaceCreator->createTargetFileObject()->write();

        $this->abstractEntityRepositoryCreator->createTargetFileObject()->writeIfNotExists();

        $this->entityRepositoryCreator->createTargetFileObject()->write();

        if (true === $this->generateSaver) {
            $this->entitySaverCreator->createTargetFileObject()->write();
        }

        $this->entityFixtureCreator->createTargetFileObject()->write();

        $this->abstractEntityTestCreator->createTargetFileObject()->writeIfNotExists();

        $this->bootstrapCreator->createTargetFileObject()->writeIfNotExists();

        $this->entityTestCreator->createTargetFileObject()->write();

        $this->dataTransferObjectCreator->createTargetFileObject()->write();

        $this->entityDtoFactoryCreator->createTargetFileObject()->write();

        $this->entityUpserterCreator->createTargetFileObject()->write();

        $this->entityUnitOfWorkHelperCreator->createTargetFileObject()->write();
    }