protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
971 stars 229 forks source link

Unable to save file #1106

Open RatnaPathak opened 1 year ago

RatnaPathak commented 1 year ago

I am a first-time user of protege and working on it. I installed v5.6.0 and when I click on save, it prompts me to select the file type. After that nothing happens and the file is not saved. I have tried to re-install, and restart my system and everything but I am getting the same error. protege.log

I am not getting any errors and do not know how to resolve the error.

Attached is the log file and screenshot

Screenshot 2023-02-20 at 9 17 16 PM
Elise1711 commented 1 year ago

I have the same problem. I am using Protege 5.6.0 on macOS Monterey 12.6.2.

Elise1711 commented 1 year ago

The problem of the file manager not being opened also occurs when trying to load a file in Protege. (file > open > 'open in current window' message > then nothing happens no matter what option you choose)

SepidehAlassi commented 1 year ago

I have the same issue with file management, I cannot open or save files with protege 5.6.1 on macOS Ventura 13.2.1. Any update on this?

gouttegd commented 1 year ago

Unfortunately I can’t reproduce the issue, so I don’t have the beginning of an idea what could be the cause…

Could any of you affected by the issue run the following tests:

1) Open Protégé. 2) From the macOS Finder (not from Protégé itself!), double-click on a OWL file. => Is the file correctly loaded into Protégé?

If it is, then:

3) Do any kind of changes in the opened ontology. 4) Try saving the modified ontology under the same filename (i.e. Save, not Save as…). => Are your changes saved into the original file?

SepidehAlassi commented 1 year ago

@gouttegd

From the macOS Finder (not from Protégé itself!), double-click on a OWL file. => Is the file correctly loaded into Protégé?

No, nothing at all is imported into Protégé, it shows a completely empty ontology. Does not even recognize the ontology iri, nothing. I just tried it with pizza.owl, the same, nothing is imported.

When I create my own ontology and want to save it. File menu -> Save as ... It asks me for the serialization format, and no matter which format I choose, the prompt window of format is closed, and nothing happens. In my other computer that still runs older mac os, when I try to save the ontology, after selecting the serialization format, I can choose the output file path in a file dialog window. But in my new Mac (M1 Max with MacOS ventura), this file dialog window is not shown in Protégé.

matthewhorridge commented 1 year ago

Just as another data point, no solution or insight into what was happening... I have seen this issue once before, in person, when teaching a class earlier this year. I believe that this was before the 5.6.0 release, so with Protege 5.5.0. There was no error message and nothing obviously wrong except that the file dialog did not appear. Nothing in the logs. In the end the person restarted their machine and the problem went away.

SepidehAlassi commented 1 year ago

@gouttegd I have tried this problem on several Mac computers with Apple Silicon chips with the latest Protégé, Regarding opening the ontologies:

Regarding writing the ontologies to file:

In all these cases, the log is empty; no error is shown. I am guessing that this might be an architectural incompatibility issue with arm64. I hope this information helps.

gouttegd commented 1 year ago

It is not possible to open files, .owl or .ttl, by double-clicking on them.

Even when Protégé is already running? The fact that you cannot open a file by double-clicking on them when Protégé is not running is a known issue (#1102), but if you already have an instance of Protégé running, it should work.

I am guessing that this might be an architectural incompatibility issue with arm64.

Unlikely. I know that Protégé is working fine on several arm64 Apple computers – including mine. Whatever the issue is, there is no fundamental incompatibilities between Protégé and arm64.

gouttegd commented 1 year ago

Of note, there have been several known weird bugs with Java file-choosing dialogs on macOS in the past (e.g. JDK-813613, JDK-822457), so maybe it’s another one of those.

SepidehAlassi commented 1 year ago

@gouttegd

Even when Protégé is already running? The fact that you cannot open a file by double-clicking on them when Protégé is not running is a known issue (#1102), but if you already have an instance of Protégé running, it should work.

With Protégé running, opening the file with a double click works; thanks for the tip.

The greatest issue is that it is not possible to save the ontology since the file dialog window does not show. I am using Protégé in my course now, and 16 students have problems with saving the files (all Mac users, all using the latest Protégé). I myself have to switch to my old Mac whenever I have to show students something in Protégé.

gouttegd commented 1 year ago

The greatest issue is that it is not possible to save the ontology since the file dialog window does not show.

Right. Alas, until I or another Protégé developer can reproduce the issue, this is not going to be fixed. :(

I myself have to switch to my old Mac whenever I have to show students something in Protégé.

On your old Mac, are you using also an older Protégé version (like 5.5.0), or the newer 5.6.1?

matthewhorridge commented 1 year ago

@SepidehAlassi can you confirm that this happens with 5.5.0?

SepidehAlassi commented 1 year ago

@matthewhorridge This problem happens on Mac M1 Max, OS Ventura, Protégé version 5.6.1

Everything works fine on both my old Macs with Intel chip (one with OS Catalina, the other OS Mojave), both with Protégé 5.6.1

gouttegd commented 1 year ago

@SepidehAlassi Are you willing or can you afford to spend some time helping us debugging the issue? If I provide you with a custom build of Protégé 5.6.1, can you try it on your machine and report some results to me?

SepidehAlassi commented 1 year ago

@SepidehAlassi Are you willing or can you afford to spend some time helping us debugging the issue? If I provide you with a custom build of Protégé 5.6.1, can you try it on your machine and report some results to me?

sure

gouttegd commented 1 year ago

@SepidehAlassi Great! Can you download the build from here: https://incenp.org/protege-5.6.1-os-x.zip, start it, and try to save something? Then open the log window and paste its contents (at least the 30 or so last lines) here.

There’s a small chance saving may already works with that build, but even if it does not, the log will hopefully help me to figure out where exactly the problem is.

bwbohl commented 1 year ago

Works with your custom build. Here's the log:

   INFO  22:44:28  ------------------------------------ Protege -----------------------------------
   INFO  22:44:28  Protege Desktop
   INFO  22:44:28  Version 5.6.1, Build 
   INFO  22:44:28  
   INFO  22:44:28  
   INFO  22:44:28  ----------------------------------- Platform -----------------------------------
   INFO  22:44:28  Java: JVM 11.0.17+8  Memory: 17179M
   INFO  22:44:28  Language: en, Country: DE
   INFO  22:44:28  Framework: Apache Software Foundation (1.9) 
   INFO  22:44:28  OS: macosx (12.6.5)
   INFO  22:44:28  Processor: aarch64

   INFO  22:44:28  
   INFO  22:44:28  ------------------------------------ Plugins -----------------------------------
   INFO  22:44:28  Plugin: OWLAPI RDF Library (3.0.0)
   INFO  22:44:28  Plugin: SPARQL Query Plugin (3.0.0)
   INFO  22:44:28  Plugin: Existential Query (2.0.0)
   INFO  22:44:28  Plugin: Explanation Workbench (3.0.1)
   INFO  22:44:28  Plugin: OntoGraf (2.0.3)
   INFO  22:44:28  Plugin: Browser View (OWLDoc) (3.0.3)
   INFO  22:44:28  Plugin: Proof Utility Library (0.1.0)
   INFO  22:44:28  Plugin: OWLViz (5.0.3)
   INFO  22:44:28  Plugin: HermiT Reasoner (1.4.3.456)
   INFO  22:44:28  Plugin: Cellfie Protege 5.0+ Plugin (2.1.1)
   INFO  22:44:28  Plugin: ELK Reasoner Protege Plug-in (0.5.0)
   INFO  22:44:28  Plugin: SWRLTab Plugin (2.1.0)
   INFO  22:44:28  Plugin: DL Query (4.0.1)
   INFO  22:44:28  Plugin: OWL Code Generation Plug-in (2.0.0)
   INFO  22:44:28  
   INFO  22:44:29  Creating and setting up empty (default) editor kit
   INFO  22:44:29  Received request to edit document at file:/Users/bwb/Downloads/pizza.owl
   INFO  22:44:29  Application is initialized.  Opening URI.
   INFO  22:44:29  Creating and setting up (default) editor kit for file:/Users/bwb/Downloads/pizza.owl
   INFO  22:44:29  OWL API Version: 4.5.25.2023-02-15T19:15:49Z
   INFO  22:44:29  Cannot generate ontology catalog for ontology at http://www.semanticweb.org/bwb/ontologies/2023/3/untitled-ontology-14. URI scheme is not "file"
   INFO  22:44:30  ------------------------------- Auto-update Check ------------------------------
   INFO  22:44:30  OWL API Version: 4.5.25.2023-02-15T19:15:49Z
   INFO  22:44:30  Auto-update last performed: Thu Apr 20 20:43:20 CEST 2023
   INFO  22:44:30  Auto-update has been performed today.  Not performing it again.
   INFO  22:44:30  
   INFO  22:44:30  ------------------------------- Loading Ontology -------------------------------
   INFO  22:44:30  Loading ontology from file:/Users/bwb/Downloads/pizza.owl
   INFO  22:44:30  Finished loading file:/Users/bwb/Downloads/pizza.owl
   INFO  22:44:30  Loading for ontology and imports closure successfully completed in 168 ms
   INFO  22:44:30  
   INFO  22:44:30  ---------------------------- Disposing of Workspace ----------------------------
   INFO  22:44:30  Saved tab state for 'Active ontology' tab
   INFO  22:44:30  Saved tab state for 'Individuals by class' tab
   INFO  22:44:30  Saved tab state for 'Entities' tab
   INFO  22:44:30  Saved workspace
   INFO  22:44:30  Disposed of 'Active ontology' tab
   INFO  22:44:30  Disposed of 'Individuals by class' tab
   INFO  22:44:30  Disposed of 'Entities' tab
   INFO  22:44:30  Disposed of workspace
   INFO  22:44:30  
   INFO  22:44:35  [IdRanges] Updating entity creation preferences
   INFO  22:44:55  ------------------------ Saving Workspace and Ontologies -----------------------
   INFO  22:44:55  Will save the pizza ontology because it has been modified
   INFO  22:44:55  Saving pizza
   INFO  22:44:55  Saving ontology to temp file: /var/folders/1l/ql6mcyts07d34vp86vv666xr0000gp/T/temp-ontology11783542820465760088
   INFO  22:44:55  Copying ontology from temp file (/var/folders/1l/ql6mcyts07d34vp86vv666xr0000gp/T/temp-ontology11783542820465760088) to actual destination (/Users/bwb/Downloads/pizza.owl)
   INFO  22:44:55  Removing temp file: /var/folders/1l/ql6mcyts07d34vp86vv666xr0000gp/T/temp-ontology11783542820465760088
   INFO  22:44:55  Saved ontology OntologyID(OntologyIRI(<http://www.co-ode.org/ontologies/pizza>) VersionIRI(<http://www.co-ode.org/ontologies/pizza/2.0.0>)) to file:/Users/bwb/Downloads/pizza.owl in RDF/XML Syntax format
   INFO  22:44:55  Saved tab state for 'Active ontology' tab
   INFO  22:44:55  Saved tab state for 'Entities' tab
   INFO  22:44:55  Saved tab state for 'Individuals by class' tab
   INFO  22:44:55  Saved workspace
   INFO  22:44:55  

Great work!

yannis1962 commented 1 year ago

A small comment to let you know that I had the same problem on an Intel-based Mac, and the patch solved it.

gouttegd commented 1 year ago

Thanks @yannis1962 . This suggests that the problem lies with the macOS-specificcode path to show a file-choosing dialog window. If other people who reported the problem on M1 macs (@SepidehAlassi ?) could confirm the above build also works for them, that'd be great.

SepidehAlassi commented 1 year ago

Thanks @yannis1962 . This suggests that the problem lies with the macOS-specificcode path to show a file-choosing dialog window. If other people who reported the problem on M1 macs (@SepidehAlassi ?) could confirm the above build also works for them, that'd be great.

Yes, it works on my M1. Thanks for the fix!

gouttegd commented 1 year ago

Thanks for testing.

So here is the problem as I understand it.

When Protégé needs to get a filename to save the current ontology, ultimately it calls the org.protege.editor.core.ui.util.UIUtil#saveFile() method. The interesting bit in that method is:

if(OSUtils.isOSX() && parentWindow != null) {
    return  MacUIUtil.saveFile(parentWindow, title, extensions, initialName);
}
JFileChooser fileDialog = new JFileChooser(getCurrentFileDirectory());
...

That is, if we’re running on macOS, the call is diverted to the macOS-specific org.protege.editor.core.platform.apple.MacUIUtil#saveFile() method, which is supposed to display a “native” file saving dialog – this is so that macOS users are in familiar territory. Otherwise (on Windows and GNU/Linux), the method proceeds to show an OS-independent file saving dialog.

The problem is that sometimes, for whatever reasons, the macOS-specific code path fails. The MacUIUtil#saveFile() method returns null as if the native file saving dialog had been shown and the user had clicked “Cancel”, but the dialog had actually never been displayed at all! I have no idea how this can happen (a bug in the JRE?), but clearly on some Macs it does happen.

There is an easy workaround, but it has one drawback.

The workaround is simply to fallback to the OS-independent file saving dialog if the macOS-specific one fails. This is what I did in the build above:

if(OSUtils.isOSX() && parentWindow != null) {
    File f = MacUIUtil.saveFile(parentWindow, title, extensions, initialName);
    if (f != null) // Only return if we actually got a file
        return f;

    // Otherwise allow the method to continue and show the OS-independent dialog
}
JFileChooser fileDialog = new JFileChooser(getCurrentFileDirectory());
...

The drawback is that we have no way of distinguishing between the case where MacUIUtil#saveFile() is returning null because it somehow failed to even show the dialog to the user, and the case where it is returning null because the dialog did show up and the user decided to cancel the operation. As a result, in the latter case, the user would be be presented with a second file saving dialog immediately after having cancelled the first one (so they would have to cancel twice).

I am inclined to think this is only a minor annoyance, and that the workaround is still worth it if it allows users affected by the bug to still save their files as they need.

matthewhorridge commented 1 year ago

I am inclined to think this is only a minor annoyance, and that the workaround is still worth it if it allows users affected by the bug to still save their files as they need.

+1. Definitely worth it IMO

Awesome work @gouttegd

gouttegd commented 1 year ago

Protégé 5.6.2 has been released with the workaround mentioned above. All users who have reported this bug are invited to upgrade.

teleaslamellatus commented 11 months ago

I still cannot save my files / neither can Protégé open a file.

AntonioLeites commented 8 months ago

I have the same issue (version 5.6.3) in an intel Mac with Ventura 13.6...

ghost commented 6 months ago

I am on Mac M1 Sonoma 14.2 with the 5.6.3 version of Protégé. I had issues with access requests to documents, contacts, camera etc. I managed to sort this out. However, as soon as I save the file, I am unable to reopen it and the app stops working. When trying to open only the file I saved, it stays in the "loading" stage and never opens. I have updated my java, OS and have tried installing multiple versions of Protégé.

Can anyone help ?

nbuckenwolf commented 3 months ago

I am also having this problem. Using Sonoma 14.4 Mac M1, Protege 5.6.3. I have tried resigning per this issue, uninstalling, installing older versions, allowing Protege to access all my files, not allowing Protege to access all my files - doesn't seem to matter. It continues to ask for access to various folders, then Protege hangs until it must be force quit. Cannot save anything. This is really frustrating and would love to know how it can be fixed!!