omeka / omeka-s

Omeka S is a web publication system for universities, galleries, libraries, archives, and museums. It consists of a local network of independently curated exhibits sharing a collaboratively built pool of items, media, and their metadata.
GNU General Public License v3.0
411 stars 138 forks source link

Testing: Convert data types #2232

Open jimsafley opened 1 month ago

jimsafley commented 1 month ago

The convert-data-types branch adds the ability to batch-convert resource values from one data type to another data type. To test this, batch edit a few items, click on the "Convert data type" button at the bottom of the page, select a property and a target data type, and submit the form. Go to the items and see if the values have been converted. You should be able to convert more than one data type at a time.

Note that conversions are not possible when data would be lost. For example, a URI value with a label cannot be converted into a Text value because the label would be lost. In these situations, it ignores the conversion and adds a message to the application log describing what happened.

allanaaa commented 1 day ago

This will just convert to text, resources, and URIs? Not numeric data types or other types created by modules (Value Suggest controlled vocabulary entries, e.g.)?

How would a value be converted into an Omeka resource - by ID, by title?

I tried to convert a linked resource to text, but nothing happened. Nothing in the log about it.

Converting a numeric date to text worked. Converting a URI to text also worked (when it had no label).

When I intentionally tried a URI with a label, nothing happened, but I also got nothing in the log about it.

zerocrates commented 1 day ago

The code for logging that stuff is definitely there, so as long as you have the S log enabled. Note that the log file has to be writable by the server to log anything.

allanaaa commented 23 hours ago

I was sure I had that all set up ages ago on this installation, but the file was set to 775; now 777. Is that what we recommend? I could be clearer about that in the manual.

Okay, I got a log entry for the URI with label > text test. And a log entry for resource > text. How should that one work?

jimsafley commented 23 hours ago

This will just convert to text, resources, and URIs? Not numeric data types or other types created by modules (Value Suggest controlled vocabulary entries, e.g.)?

I've enabled the conversion of the native data types. I plan to enable types introduced by modules at a later date.

How would a value be converted into an Omeka resource - by ID, by title?

It will convert a value into a resource only if the value already has a resource ID attached to it. It has very specific utility.

And a log entry for resource > text. How should that one work?

A resource cannot be converted to text.

allanaaa commented 23 hours ago

It will convert a value into a resource only if the value already has a resource ID attached to it.

I'm not clear what this means. How can a text or URI value "have a resource ID attached"?

jimsafley commented 23 hours ago

If, for example, a module adds a resource-like data type that attaches a resource ID to the value. A user may want to convert from this module-added data type to the native resource data type.

allanaaa commented 22 hours ago

If you have an example of one of our modules that operates like that, I can test it - if we don't currently have one, but a third party does, I can test that instead. Otherwise, I think I've covered all the bases and everything works as intended.

For documentation I've got: Text value > URI (if it's already a URI) URI > text (if it has no label) Resources cannot be converted to text or URI. Core text and URI values cannot be converted into a resource.

As well as NDT > text (into their ISO equivalents) ValueSuggest > URI but not text for external vocabs (VS sends a URI and a label) ValueSuggest > text but not URI for internal Omeka properties (currently it sends the VS value as a URI with an empty label)

If you'd like me to mention those module details, I can remind users that NDT adds its own batch-conversion feature; maybe you could combine the module's dropdown into this dropdown in the future.