Run the ontology mapping on the statements.
349691
def map_statements(self):
        """"""
        for stmt in self.statements:
            for agent in stmt.agent_list():
                if agent is None:
                    continue
                all_mappings = []
                for db_name, db_id in agent.db_refs.items():
                    if isinstance(db_id, list):
                        db_id = db_id[0][0]
                    mappings = self._map_id(db_name, db_id)
                    all_mappings += mappings
                for map_db_name, map_db_id, score, orig_db_name in all_mappings:
                    if map_db_name in agent.db_refs:
                        continue
                    if self.scored:
                        # If the original one is a scored grounding,
                        # we take that score and multiply it with the mapping
                        # score. Otherwise we assume the original score is 1.
                        try:
                            orig_score = agent.db_refs[orig_db_name][0][1]
                        except Exception:
                            orig_score = 1.0
                        agent.db_refs[map_db_name] = \
                            [(map_db_id, score * orig_score)]
                    else:
                        if map_db_name in ('UN', 'HUME'):
                            agent.db_refs[map_db_name] = [(map_db_id, 1.0)]
                        else:
                            agent.db_refs[map_db_name] = map_db_id
1109701
public void execute(Runnable statements)
	{
		try (HibernateTransaction tx = start().withAutoRollback())
		{
			statements.run();

			// Success, perform a TX commit
			tx.commit();
		}
	}
1347419
function run(keywordsToRun, keywordsDefined, passedArguments) {
        var vars = helpers.createLocalEnv(passedArguments);
        keywordsToRun = helpers.createKeywords(keywordsToRun);

        return {
            then: function(callback) {
                runKeywords(keywordsToRun, keywordsDefined, vars, callback);
            }
        };
    }
1246800
def _scan(self, verbose=False, hide_base_schemas=True):
        
        if verbose:
            printDebug("Scanning entities...", "green")
            printDebug("----------", "comment")

        self.__extractOntologies()
        if verbose: printDebug("Ontologies.........: %d" % len(self.ontologies), "comment")

        self.__extractClasses(hide_base_schemas)
        if verbose: printDebug("Classes............: %d" % len(self.classes), "comment")

        self.__extractProperties()
        if verbose: printDebug("Properties.........: %d" % len(self.properties), "comment")
        if verbose: printDebug("..annotation.......: %d" % len(self.annotationProperties), "comment")
        if verbose: printDebug("..datatype.........: %d" % len(self.datatypeProperties), "comment")
        if verbose: printDebug("..object...........: %d" % len(self.objectProperties), "comment")

        self.__extractSkosConcepts()
        if verbose: printDebug("Concepts (SKOS)....: %d" % len(self.skosConcepts), "comment")

        self.__computeTopLayer()

        self.__computeInferredProperties()

        if verbose: printDebug("----------", "comment")
1098389
protected void executeWithSchemaAgreement(Statement statement)
            throws SchemaAgreementException {
        ResultSet result = this.session.execute(statement);
        if (checkSchemaAgreement(result)) {
            return;
        }
        if (checkClusterSchemaAgreement()) {
            return;
        }

        throw new SchemaAgreementException(
                "Failed to propagate schema update to all nodes (schema agreement error)");
    }
925341
def run(self):
        """"""
        self.console.load(self.lines, setup=self.setup, teardown=self.teardown)
        return self.console.interpret()
1318369
def runQuery(statDict, query):
  """"""
  parts = [x.strip() for x in OPERATOR.split(query)]
  assert len(parts) in (1, 3)
  queryKey = parts[0]

  result = {}
  for key, value in six.iteritems(statDict):
    if key == queryKey:
      if len(parts) == 3:
        op = OPERATORS[parts[1]]
        try:
          queryValue = type(value)(parts[2]) if value else parts[2]
        except (TypeError, ValueError):
          continue
        if not op(value, queryValue):
          continue
      result[key] = value
    elif isinstance(value, scales.StatContainer) or isinstance(value, dict):
      child = runQuery(value, query)
      if child:
        result[key] = child
  return result
49636
private void createOntology() {
    ontologyEntity = ontologyFactory.create();
    ontologyEntity.setId(idGenerator.generateId());
    ontologyEntity.setOntologyIri(loader.getOntologyIRI());
    ontologyEntity.setOntologyName(loader.getOntologyName());
    ontologyRepository.add(ontologyEntity);
  }
610419
def execute(self, triple_map, output, **kwargs):
        
        subjects = []
        logical_src_iterator = str(triple_map.logicalSource.iterator)
        json_object = kwargs.get('obj', self.source)
        # Removes '.' as a generic iterator, replace with '@'
        if logical_src_iterator == ".":
            results = [None,]
        else:
            json_path_exp = jsonpath_ng.parse(logical_src_iterator)
            results = [r.value for r in json_path_exp.find(json_object)][0]
        for row in results:
            subject = self.generate_term(term_map=triple_map.subjectMap,
                                         **kwargs)
            for pred_obj_map in triple_map.predicateObjectMap:
                predicate = pred_obj_map.predicate
                if pred_obj_map.template is not None:
                    output.add((
                        subject,
                        predicate,
                        self.generate_term(term_map=pred_obj_map, **kwargs)))

                if pred_obj_map.parentTriplesMap is not None:
                    self.__handle_parents__(
                        output,
                        parent_map=pred_obj_map.parentTriplesMap,
                        subject=subject,
                        predicate=predicate,
                        obj=row,
                        **kwargs)
                if pred_obj_map.reference is not None:
                    ref_exp = jsonpath_ng.parse(str(pred_obj_map.reference))
                    found_objects = [r.value for r in ref_exp.find(row)]
                    for obj in found_objects:
                        if rdflib.term._is_valid_uri(obj):
                            rdf_obj = rdflib.URIRef(str(obj))
                        else:
                            rdf_obj = rdflib.Literal(str(obj))
                        output.add((subject, predicate, rdf_obj))
                if pred_obj_map.constant is not None:
                    output.add((subject,
                                     predicate,
                                     pred_obj_map.constant))
            subjects.append(subject)
        return subjects
760742
def update_ontology(ont_url, rdf_path):
    """"""
    yaml_root = load_yaml_from_url(ont_url)
    G = rdf_graph_from_yaml(yaml_root)
    save_hierarchy(G, rdf_path)
1280836
def run(self):
        
        connectable = engine_from_config(
            self._config.get_section(self._config.config_ini_section),
            prefix='sqlalchemy.',
            poolclass=pool.NullPool)

        with connectable.connect() as connection:
            ensureSchemaExists(connectable, self._schemaName)

            context.configure(
                connection=connection,
                target_metadata=self._targetMetadata,
                include_object=self._includeObjectFilter,
                include_schemas=True,
                version_table_schema=self._schemaName
            )

            with context.begin_transaction():
                context.run_migrations()
1129529
def do_ls(self, line):
        """"""
        opts = self.LS_OPTS
        line = line.split()
        _pattern = ""

        if len(line) == 0:
            # default contextual behaviour [2016-03-01]
            if not self.current:
                line = ["ontologies"]
            elif self.currentEntity:
                self.do_info("")
                return
            else:
                line = ["classes"]

        if (not line) or (line[0] not in opts):
            self.help_ls()
            return
            # self._print("Usage: ls [%s]" % "|".join([x for x in opts]))

        elif line[0] == "ontologies":
            if not self.all_ontologies:
                self._help_nofiles()
            else:
                self._select_ontology(_pattern)

        elif line[0] in opts and not self.current:
            self._help_noontology()
            return

        elif line[0] == "classes":
            g = self.current['graph']

            if g.all_classes:
                self._select_class(_pattern)
            else:
                self._print("No classes available.")

        elif line[0] == "properties":
            g = self.current['graph']
            if g.all_properties:
                self._select_property(_pattern)
            else:
                self._print("No properties available.")

        elif line[0] == "concepts":
            g = self.current['graph']
            if g.all_skos_concepts:
                self._select_concept(_pattern)
            else:
                self._print("No concepts available.")

        else:  # should never arrive here
            pass
135072
def run(self, context):
        """"""
        # Don't do something when running non-interactive.
        if not sys.stdout.isatty():
            return

        with local.cwd(context.in_container):
            from benchbuild.projects.gentoo import gentoo
            gentoo.setup_networking()
            gentoo.configure_portage()

            sed_in_chroot = uchroot.uchroot()["/bin/sed"]
            emerge_in_chroot = uchroot.uchroot()["/usr/bin/emerge"]
            has_pkg = uchroot.uchroot()["/usr/bin/qlist", "-I"]

            run.run(sed_in_chroot["-i", '/CC=/d', "/etc/portage/make.conf"])
            run.run(sed_in_chroot["-i", '/CXX=/d', "/etc/portage/make.conf"])

            want_sync = bool(CFG["container"]["strategy"]["polyjit"]["sync"])
            want_upgrade = bool(
                CFG["container"]["strategy"]["polyjit"]["upgrade"])

            packages = \
                CFG["container"]["strategy"]["polyjit"]["packages"].value
            with local.env(MAKEOPTS="-j{0}".format(int(CFG["jobs"]))):
                if want_sync:
                    LOG.debug("Synchronizing portage.")
                    run.run(emerge_in_chroot["--sync"])
                if want_upgrade:
                    LOG.debug("Upgrading world.")
                    run.run(emerge_in_chroot["--autounmask-only=y", "-uUDN",
                                             "--with-bdeps=y", "@world"])
                for pkg in packages:
                    if has_pkg[pkg["name"]] & TF:
                        continue
                    env = pkg["env"]
                    with local.env(**env):
                        run.run(emerge_in_chroot[pkg["name"]])

            gentoo.setup_benchbuild()

        print("Packing new container image.")
        with local.cwd(context.builddir):
            pack_container(context.in_container, context.out_container)
688465
def main(argv=None):
	

	print("Ontospy " + ontospy.VERSION)
	ontospy.get_or_create_home_repo()

	if argv:
		print("Argument passing not implemented yet")
		if False:
			onto = Model(argv[0])
			for x in onto.get_classes():
				print(x)
			onto.buildPythonClasses()
			s = Sketch()

	else:

		intro = """Good morning. Ready to Turtle away. Type docs() for help."""
		# idea: every time provide a different ontology maxim!

		def docs():
			print("\n".join([x.strip() for x in Sketch.__doc__.splitlines()]))

		default_sketch = Sketch()

		def add(text=""):
			default_sketch.add(text)
		def show(aformat=None):
			if aformat:
				default_sketch.show(aformat)
			else:
				default_sketch.show()
		def bind(prefixTuple):
			default_sketch.bind(prefixTuple)
		def clear():
			default_sketch.clear()
		def omnigraffle():
			default_sketch.omnigraffle()


		try:
			# note: this requires IPython 0.11 or above
			import IPython
			IPython.embed(banner1=intro)
		except:
			import code
			code.interact(banner=intro, local=dict(globals(), **locals()))
	# finally
	sys.exit(0)
821532
def run(self):
        """"""

        # Create dictonary of signatures
        database_signatures = {}
        for entry in self._model.reactions:
            signature = reaction_signature(
                entry.equation, direction=self._args.compare_direction,
                stoichiometry=self._args.compare_stoichiometry)
            database_signatures.setdefault(signature, set()).add(
                (entry.id, entry.equation, entry.filemark))

        for reaction_set in itervalues(database_signatures):
            if len(reaction_set) > 1:
                print('Found {} duplicate reactions:'.format(
                    len(reaction_set)))
                for reaction, equation, filemark in reaction_set:
                    result = ' - {}: {}'.format(reaction, equation)
                    if filemark is not None:
                        result += ' (found in {})'.format(filemark)
                    print(result)
355120
def run(dataset):
    """"""
    config = _get_config()

    if dataset:
        _print("getting dataset from brains...")
        cprint("done", 'green')

        # check dataset cache for dataset
        # if not exists
        # r = requests.get('https://api.github.com/events', stream=True)
        # with open(filename, 'wb') as fd:
        #     for chunk in r.iter_content(chunk_size):
        #         fd.write(chunk)

    cprint('Running "%s"' % config["run"], 'green', attrs=("underline",))
    call(config["run"].split())
145167
private BootstrappingResults bootstrapMappingAndOntology(String baseIRI, Optional<SQLPPMapping> inputPPMapping,
															 Optional<OWLOntology> inputOntology)
			throws MappingBootstrappingException {

		this.baseIRI = fixBaseURI(baseIRI);

		try {
			SQLPPMapping newPPMapping = extractPPMapping(inputPPMapping);

			OWLOntology ontology = inputOntology.isPresent()
                    ? inputOntology.get()
                    : OWLManager.createOWLOntologyManager().createOntology(IRI.create(baseIRI));

            // update ontology
            OWLOntologyManager manager = ontology.getOWLOntologyManager();
            Set<OWLDeclarationAxiom> declarationAxioms = extractDeclarationAxioms(manager,
                    newPPMapping.getTripleMaps().stream()
                            .flatMap(ax -> ax.getTargetAtoms().stream()));
            manager.addAxioms(ontology, declarationAxioms);

            return new DefaultBootstrappingResults(newPPMapping, ontology);
		}
		catch (SQLException | MappingException | OWLOntologyCreationException e) {
			throw new MappingBootstrappingException(e);
		}
	}