irods-contrib / metalnx-web

Metalnx Web Application
https://metalnx.github.io/
BSD 3-Clause "New" or "Revised" License
36 stars 36 forks source link

Metadata not shown #234

Closed fh-afk closed 3 years ago

fh-afk commented 3 years ago

I have a test file called 0 with a little nonsense Text and see this:

image

There should be some metadata, as I can verify with "imeta ls -d 0" on the iRODS server:

image

Of course the values do not make much sense, but this is not the point, I would still expect it to work.

trel commented 3 years ago

Hmm, that is curious. You're logged into Metalnx as the same user who is doing the imeta ls -d 0?

trel commented 3 years ago

I haven't been able to reproduce it yet... What version of Metalnx is this?

trel commented 3 years ago

Upon closer inspection of what you've got in your database, I see that often... your attribute or value are empty. This is not allowed, in general - AVUs must have at least the attribute and value filled in. The unit is optional.

How did your metadata get to this state?

fh-afk commented 3 years ago

It is the same user. I have tried reproducing it with another file, but failed as well. Metadata works fine for other data. It is version 2.2.0-RELEASE.

The value is not empty, it is space - you do not see that in the command line interface. This is probably not the issue, I tried that for reproducing this, too.

trel commented 3 years ago

Okay, I confirm that spaces work - still seeing them list correctly locally.

Can you share the text version of the imeta ls -d 0 output? I'm interested in the attribute you have for 'Datum'.

Please also look for a clue or error in the Metalnx logs (via docker logs -f <containername>).

trel commented 3 years ago

Can you confirm the database you're using is Postgres?

We know that some of the queries used by Metalnx were not tested on other databases.

fh-afk commented 3 years ago

Yes, I use Postgres for metalnx and also for iRODS.

imeta ls -d 0 for 'Datum'

attribute: Datum value: 48095tzß units:

From the log for the Postgres Docker, I find this a bit suspicious:

ERROR: column t1.tgconstrname does not exist at character 113

I will investigate further on monday.

trel commented 3 years ago

I agree with your assessment of 'suspicious'.

I confirm Datum with 48095tzß is rendering correctly locally, so that doesn't appear to be the problem, directly.

fh-afk commented 3 years ago

I managed to reproduce that behavior. There really was an empty attribute (instead of space). I do not see an obvious way to create this with metalnx or the iRODS CLI. However, I was also testing the python-irodsclient on the same iRODS server. Apparently, you can write empty attributes via metadata.apply_atomic_operations into iCAT and then you get

image

which is indistinguishable from space in the command line, but in my python GUI it shows None, which is indistinguishable from the string "None", but both can't be true simultaneously. In my understanding, this is not really a metalnx issue nor is it a python-irodsclient issue, this looks like something that should not be allowed in iRODS iCAT and hence get rejected by the server itself. Sorry for the false alarm.

trel commented 3 years ago

Ah, very good. I agree the server should enforce this more tightly. I'm transferring this issue into irods/irods and will track it there. Thanks!

Edit: Just learned transfers are not allowed across GitHub organizations. So... will box it in and follow up here.

trel commented 3 years ago

New issue in the server (irods/irods#5618).

We'll use this one to make sure Metalnx itself still displays even if the server does have an empty string.

fh-afk commented 3 years ago

I can cause a similar issue with iRODS rule engine using msiApplyDCMetadataTemplate - this microservice creates attribute names and leaves values empty which also causes metalnx to not show the metadata. I may have used that microservice incorrectly, since I am just looking into this, but then again, I think iRODS should probably reject this.

Edit: Looks like using it incorrectly is not the issue here, this microservice is documented exactly that way: https://docs.irods.org/4.2.8/doxygen/miscMS_8cpp.html#a109caab5c02c547ba0ebb07cdcacfcb5

korydraughn commented 3 years ago

New issue in the server (irods/irods#5618).

We'll use this one to make sure Metalnx itself still displays even if the server does have an empty string.

The following line explains why the metadata is not shown. https://github.com/DICE-UNC/jargon/blob/b033be98ea9383762184ccd166bcdf8ac68a5dbf/jargon-core/src/main/java/org/irods/jargon/core/query/MetaDataAndDomainData.java#L187

Removing the check for an empty string allows the metadata to be shown. If the server is enforcing non-empty attribute names, then it should be safe to remove the check.

See the following PRs for the necessary changes: