Beispiel #1
0
 private void initializeOntology(string path)
 {
     OwlOntology.Ontology         = OwlManager.LoadOntology(path);
     OwlOntology.ObjectProperties = OwlManager.GetObjectProperties();
     OwlOntology.Individuals      = OwlManager.GetIndividuals();
     OwlOntology.Classes          = OwlManager.GetClasses();
     panel_reasoner.BackColor     = Color.Red;
 }
Beispiel #2
0
        private void launchReasonerProcess2(string ontologyFromPath, string ontologyTempPath)
        {
            Locked = true;
            progressBar_reasoner.Visible = true;
            progressBar_reasoner.BringToFront();

            var worker = new BackgroundWorker();

            worker.WorkerReportsProgress      = false;
            worker.WorkerSupportsCancellation = false;
            worker.DoWork += (o, e) =>
            {
                File.WriteAllBytes("executer.jar", resources.executer);

                string executer = "executer.jar";

                var processInfo = new ProcessStartInfo("javaw", string.Format("-jar \"{0}\" \"{1}\" \"{2}\"", executer.Replace("\\", @"\"), ontologyFromPath, ontologyTempPath))
                {
                    WindowStyle            = ProcessWindowStyle.Hidden,
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    ErrorDialog            = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                    //WorkingDirectory = System.IO.Path.GetDirectoryName(Application.ExecutablePath),
                };

                Process process = System.Diagnostics.Process.Start(processInfo);

                process.WaitForExit();
                int exitCode = process.ExitCode;
                process.Close();

                File.SetAttributes(ontologyTempPath, File.GetAttributes(ontologyTempPath) | FileAttributes.Hidden);
            };

            worker.RunWorkerCompleted += (o, e) =>
            {
                progressBar_reasoner.Visible = false;
                progressBar_reasoner.SendToBack();
                Locked = false;

                OwlManager.LoadOntology(getTempFilePath());

                OwlOntology.Ontology         = OwlManager.Ontology;
                OwlOntology.ObjectProperties = OwlManager.GetObjectProperties();
                // OwlOntology.Individuals = new List<string>(OwlManager.GetIndividuals());
                OwlOntology.Classes = OwlManager.GetClasses();
            };

            worker.RunWorkerAsync();
        }