GateNLP / gate-core

The GATE Embedded core API and GATE Developer application
GNU Lesser General Public License v3.0
75 stars 29 forks source link

Should the default for the ResourceReference really be a creole rather than a file URL? #133

Closed johann-petrak closed 3 years ago

johann-petrak commented 3 years ago

I find this behavior weird: when the input field for a ResourceReference is filled with some name, the result is a creole URL, pointing into the JAR, instead of a file URL pointing at the local file system. Only if the File selection dialog is opened it is possible to choose file URL (potentially of a file which does not exist).

I would assume that I am not the only one who would expect that entering just a name here would get interpreted as a file path, relative to whatever directory one would see when clicking the file selection dialog, or relative to the current directory, especially since selecting defaults to the file, not the JAR dialog.

ianroberts commented 3 years ago

This is to make creole parameter default values work properly - with a directory plugin a relative path for a URL or ResourceReference parameter resolves against the plugin directory (as it always has done since GATE 2.0), for a Maven style plugin the equivalent behaviour is to resolve to a resource inside the JAR.

You should be able to use file:relative-path.py to get a URL relative to the CWD of the java process.

johann-petrak commented 3 years ago

I am not sure why values without a scheme have to be interpreted as creole instead of file there as in interactive use, I am sure creole URLs are used much more rarely.

I think this did not show up yet as a problem because probably only few plugins allow using non-existing files, so most of the times people would just press the file select button.

When using file:somerelativypath.py, sadly the gate.util.Files.fileFromURL(pythonProgramUrl) call then gives an exception: "java.lang.IllegalArgumentException: URI is not hierarchical" Only if I enter a full absolute file:///... path there does it work.