EPrints Technical Mailing List Archive

Message: #04835


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: [SOLVED] Re: How to set a field to be multilang (autocomplete)


OK, made it.

Thanks again Adam for the help! First of all I changed my archives/myrepo/cfg/workflows/eprint/default.xml to read:

<component><field ref="ml_title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/ml_title_duplicates" input_lookup_params="id={eprintid}&amp;dataset=eprint&amp;field=ml_title"/></component>

for my ml_title field.

Then I created the new lookup script (~eprints/cgi/users/lookup/ml_title_duplicates) based on what Adam suggested. The difference is that I kept the join statement in order to look into the archive (like the previous script did, not sure if this part is needed, if not we can remove it + the join statement), and hence I ended up with an SQL statement like this:

my $sql = "SELECT ep.eprintid, ml_title_text FROM eprint AS ep JOIN eprint_ml_title_text AS ml ON ep.eprintid = ml.eprintid WHERE ";
if ($dataset_name eq "eprint") {
$sql .= " $Q_eprint_status=" . $db->quote_value( "archive" ) . " AND ";
}
$sql .= "ml.ml_title_text IS NOT NULL" .
    " AND ml.ml_title_text " .
    $db->sql_LIKE() .
    $db->quote_value( EPrints::Database::prep_like_value( $q ) . '%' );


This yields a diff from the original title_duplicates like the following:

# diff -u cgi/users/lookup/title_duplicates cgi/users/lookup/ml_title_duplicates
--- cgi/users/lookup/title_duplicates    2015-10-02 16:32:28.571571528 +0300
+++ cgi/users/lookup/ml_title_duplicates 2015-10-02 17:06:23.940698431 +0300
@@ -67,17 +67,15 @@
 my $Q_eprint_status = $db->quote_identifier( "eprint_status" );
 my $Q_field_name = $db->quote_identifier( $field->get_sql_name );

-my $sql = "SELECT $Q_id" .
-    " FROM $Q_table" .
-    " WHERE ";
+my $sql = "SELECT ep.eprintid, ml_title_text FROM eprint AS ep JOIN eprint_ml_title_text AS ml ON ep.eprintid = ml.eprintid WHERE ";
 if ($dataset_name eq "eprint") {
-    $sql .= " $Q_eprint_status=" .  $db->quote_value( "archive" );
-}
-$sql .=    " AND $Q_id!=$id" .
-    " AND $Q_field_name IS NOT NULL" .
-    " AND $Q_field_name " .
-    $db->sql_LIKE() .
-    $db->quote_value( EPrints::Database::prep_like_value( $q ) . '%' );
+ $sql .= " $Q_eprint_status=" . $db->quote_value( "archive" ) . " AND ";
+}
+$sql .= "ml.ml_title_text IS NOT NULL" .
+    " AND ml.ml_title_text " .
+    $db->sql_LIKE() .
+    $db->quote_value( EPrints::Database::prep_like_value( $q ) . '%' );
+

 my $html = $xml->create_element( "div" );


Thanks again, will come back soon asking about the search functionality...:)

On 01/10/2015 02:58 μμ, Field A.N. wrote:
Looking at this, the join is unneccessary.  Just do:


	select eprintid, ml_title_text from eprint_ml_title_text where.....



--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 1 Oct 2015, at 12:54, George Mamalakis wrote:

Hi Adam,

OK, I'll check how your SQL statement works, and I'll have it fixed
soon. Luckily, my SQL skill is not rusty:).

Will come back later (or maybe tomorrow) with results.

Thanks again!

On 01/10/2015 02:38 μμ, Field A.N. wrote:
Hi George

	The reason it's in a separate table is because multiple fields get their own table, only singular fields go directly into the eprint table.  Multilang is sort of like a compound multiple field with a text and a lang part.

	I think option (1) is probably your best bet, and the SQL will be more complex because you'll need to join it.  It'll be something like this (just typed into the email, so it probably won't parse):

	SELECT eprint.eprintid, eprint_ml_title_text.pos FROM eprint JOIN eprint_ml_title_text ON eprint.eprintid = eprint_ml_title_text.eprintid WHERE eprint_ml_title_text.ml_title_text IS NOT NULL AND eprint_ml_title_text.ml_title_text COLLATE utf8_general_ci LIKE 'The Limits%' LIMIT 10

	...this will return the eprint id and index of the title in the ml_title field (i.e. whether it's matched the first, second, third, etc title).  You then need to decide what gets sent back to the front end to prompt the user.  Don't forget we're warning the user that there's an item that matches this title, so we might want to just show them the default citation or something.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 29 Sep 2015, at 15:14, George Mamalakis wrote:

Hi again,

As I promised, I'm back for the autocomplete feature with respect to multilang fields. And the one with the "problem" is the ml_title field. Here's some context:

When I replaced the title field in my workflow, I saw that there was an input_lookup_url attribute which was calling the autocomplete script named title_duplicates. The existing entry was:

<component><field ref="title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/title_duplicates" input_lookup_params="id={eprintid}&amp;dataset=eprint&amp;field=title" /></component>

I thought to replace the title string in the url, so I ended up with a line like this:

<component><field ref="ml_title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/title_duplicates" input_lookup_params="id={eprintid}&amp;dataset=eprint&amp;field=ml_title"/></component>

But when I tested it it didn't work. Looking at the POST request I saw that the final call was:

http://mysite/cgi/users/lookup/title_duplicates?q=The%20Limits&_text=The%20Limits%20&id=270&dataset=eprint&field=ml_title&field=ml_title&dataobj=270&dataset=eprint

Which resulted in an SQL statement like (from my mysql logs):
SELECT `eprintid` FROM `eprint` WHERE  `eprint_status`='archive' AND `eprintid`!=270 AND `ml_title` IS NOT NULL AND `ml_title`  COLLATE utf8_general_ci LIKE 'The Limits%' LIMIT 10

Running it by hand returns the error:

ERROR 1054 (42S22): Unknown column 'ml_title' in 'where clause'

Indicating clearly that ml_title field does not exist in table eprint. Which is obviously true.

So, what's the best way of dealing with this problem? By examining my database, I saw that EPrints created two additional tables for my ml_title field, namely:

- eprint_ml_title_lang
- eprint_ml_title_text

And in my case, eprint_ml_title_text contains the information my script would have to search. So, I could:

1) just copy title_duplicates script to a new one on which I'd make the relevant changes to only look into the specific table and fields and return something analogous to what the script would return, or
2) write a new script from scratch (not sure why), or
3) Do something else that I'm missing and is much more elegant design and development wise.

If the answer is (1) (which is most probably the case), any directions would be welcome. And by directions I mean that if someone could tell me which parts to leave out because they won't match in our case, it would be nice.

Thanks all in advance,

George.



On 24/09/2015 01:02 μμ, George Mamalakis wrote:
Adam,

False alarm! After I understood what you initially meant, I commented out the code of get_value and set_value in eprints_fields_local.pl and ran your script again (for both get_value and set_value), and this time, for both runs, the return value was: NOT DEFINED, which means that you can relax now! :):)

But, before finishing with this multilang thing and build the Bazaar package, I'll have to address:

1) the search functions to search in the correct fields
2) the autocompletion feature to run smoothly where applicable

Thanks again!

On 23/09/2015 06:12 μμ, Adam Field wrote:
That's what I was afraid of!  $EPrints::MetaField::UNDEF is a defined value as far as perl is concerned.

A couple for things to try:

if ($field->get_property('get_value') == $EPrints::MetaField::UNDEF)

my $fn = $field->get_property('get_value');
if (ref $fn eq "CODE")

We need a way ot testing to see if we're able to call the function.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services



On 23 Sep 2015, at 13:58, George Mamalakis <mamalos@eng.auth.gr> wrote:

Hi Adam,

Please excuse me for still being mostly unsure as to what you wanted me to do (don't forget, I'm still an EPrints newbie!), but I -think I- followed your directions and ran your script for the two functions: get_value and set_value, and for both functions the outcome was "DEFINED". I hope that this was what you asked me, otherwise you'll have to excuse my ignorance again:).

I just made two corrections in your script in order for it to run, so here it is:

#!/usr/bin/perl -I/usr/share/eprints3/perl_lib

use EPrints;
my $ep = EPrints->new();
my $repo = $ep->repository( "myrepo" ); #or whatever

my $ds = $repo->dataset('eprint');
my $field = $ds->field('title'); #or whichever field we're talking about

if (defined $field->get_property('get_value'))
{
     print "DEFINED!!!\n";
}
else
{
     print "NOT DEFINED\n";
}


On 22/09/2015 11:13 μμ, Adam Field wrote:
Sorry for the delays, I've been on leave for a couple of days.

I would write a simple test script.  Something like this:

=====================================================
#!/usr/bin/perl -I/opt/eprints3/perl_lib

use EPrints;
my $ep = EPrints->new();
my $repo = $ep->repository( "myrepo" ); #or whatever

my $ds = $repository->dataset('eprint');
my $field = $ds->field('title'); #or whichever field we're talking about

if (defined $field->get_property('get_value))
{
  print "DEFINED!!!\n";
}
else
{
  print "NOT DEFINED\n";
}
=====================================================

...then use this to test different ways of doing things so that we can be sure the conditional actually does work..  Note I've not compiled this, so it will need some debugging.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

On 18 Sep 2015, at 10:51, George Mamalakis <mamalos@eng.auth.gr> wrote:

OK, I had understood that far :):) I meant if you could tell me how to test it. Should I remove the get_value function from Virtualwithvalue or from eprints_fields.py? And then, test that epadmin reload works OK and that the site shows records in manage deposits?

On 18/09/2015 12:10 μμ, Adam Field wrote:
Well, the specific thing I'd like you to check is that the test:

  if ( defined $self->get_property("get_value") )

...still works as expected now that we've changed:

   $defaults{get_value} = undef;

...to:

   $defaults{get_value} = $EPrints::MetaField::UNDEF;

I think this might be a defined value (it's an EPrints constant), so we may have to test some other way.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

On 18 Sep 2015, at 09:51, George Mamalakis <mamalos@eng.auth.gr> wrote:

Hi Adam,

The syntax you proposed works great; warnings have stopped. I'm quite
unsure, though, as to what you've asked me to test. Could you please be
a bit more specific?

Thanks again, it seems we've finally made it (OK, basically, you've made
it:))!!

On 17/09/2015 02:37 μμ, Field A.N. wrote:
Hmmmm....  In get_property_defaults, change to this kind of thing and see what happens (particularly test for when no get_value function is defined in the field definition):


          $defaults{get_value} = $EPrints::MetaField::UNDEF;


(see https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField/Namedset.pm#L86 )

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 17 Sep 2015, at 09:25, George Mamalakis wrote:

Adam thanks,

The code seems to work just fine (tested). My only problem is that I'm getting a warning about $p_default when reloading the repo, which I am not sure where it's referring to, so if you have any hints it would be great. The warnings are:

$ ./bin/epadmin reload myrepo
Use of uninitialized value $p_default in string eq at /usr/share/eprints3/bin/../perl_lib/EPrints/MetaField.pm line 211.
Use of uninitialized value $p_default in string eq at /usr/share/eprints3/bin/../perl_lib/EPrints/MetaField.pm line 213.
Use of uninitialized value $p_default in string ne at /usr/share/eprints3/bin/../perl_lib/EPrints/MetaField.pm line 217.
defined(@array) is deprecated at /usr/share/eprints3/lib/plugins/EPrints/Plugin/Screen/BulkAction/Remove.pm line 46.
     (Maybe you should just omit the defined()?)


Thanks again for all the help!! As far as multilingual fields is concerned I think we're really getting there! Any other problems (like the import problem that arose) that someone foresees are welcome, so as to address them before making the bazaar package (and updating the wiki).


On 15/09/2015 09:31 μμ, Adam Field wrote:
Hi George



Yes, you're right, you already pretty much solved the problem.  I'm rushing through my email and not paying enough attention.



The other thing you missed was that if there are three languages set in the multilang field, and someone calls set_value on title, it will overwrite everything.  You did, however, do better testing on language than I did, so you should probably incorporate that.



Once you have this finished, perhaps we could put the new metafield in a bazaar package so that others can deploy it easily.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

On 15 Sep 2015, at 18:51, George Mamalakis <mamalos@eng.auth.gr> wrote:

Adam hi!

Don't apologise, I know you had been busy since I had read the emails regarding the hack-day and saw your absent in the list. I'll test your code tomorrow at work and see if it works. The way I see it, it is similar to the code I posted in my last email, but mine was missing the get_property_defaults, which might be the problem.

As far as the wiki is concerned, don't worry, as I promised I'll write a full guide of how to set the title and abstract fields to be multilang, but I'll do it once everything is tested by my library staff (our site is not up yet).

Thanks again for your help, I'll return with feedback tomorrow evening.

George.

PS. Your next task is to make a video showing how to make the Adam Field to be virtual :)

On 15/9/2015 8:19 μμ, Adam Field wrote:
Sorry, I had a UKCoRR event, a German Language User Group Meeting, a Hack Day and a UK User Group Meeting all in the last two weeks, which were my first two weeks back from Annual Leave!

I think we'll need to override set_value on our Virtualwithvalue metafield class.  Before we added code to pull values out of another field.  We need code now to insert values into another field.  Something like this (add it to the code below in the email of June 30th):

#In the field class (Virtualwithvalue?)

sub set_value
{
          my( $self, $object, $value ) = @_;
          if ( defined $self->get_property("set_value") )
          {
              return $self->call_property( "set_value", $object, $value);
          }
          return undef;
}

...and in get_property_defaults:

  $defaults{set_value} = undef;

...then in any field definitions in the repository config (along the lines of get_value discussed previously):

set_value => sub
{
  my ($eprint, $value) = @_;

  #only use this on imports, NOT if the value is already set
  if ($eprint->is_set('ml_title'))
  {
  return;
  }

  $eprint->set_value('title_ml', [text => '$value', lang => $c->{defaultlanguage} ]);
}


I leave is as an exercise for the reader to debug the above code, which hasn't even been parsed, let alone tested.

Please feedback with tested code, and some documentation on the wiki :)

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

On 9 Sep 2015, at 12:49, George Mamalakis <mamalos@eng.auth.gr> wrote:

Yeah, this is whom I'm waiting for...:):)

On 09/09/2015 01:15 μμ, alen vodopijevec wrote:
Hmm.. maybe using similar function that you have in 'title' filed
definition.. I'm not sure in this moment, but it's a good idea and will
check out.

.. Adam would surely know better :)

--
alen

On 09/09/2015 11:16 AM, George Mamalakis wrote:
Hi Alen,

I think that through the use of virtual fields, there could be a way to
finally assign values in the appropriate fields (via some function), but
I'm not sure which function I have to override. And I am talking about
virtual fields, because in our multilingual solution we have created
additional multilingual fields for title and abstract, and have replaced
original the fields with virtual counterparts that calculate their
values through code. Hence my assumption on storing their values as well.

Thanks for your help!

On 09/09/2015 11:52 πμ, alen vodopijevec wrote:
Hi!

You will have to override default import plugins, ie. copy original ones
and make them write to new multilang field(s).

I've made a mistake a long time ago with changing original title,
abstract, keyword fileds into multilang so we are still coping with it :))

Kind regards,
Alen
--
http://fulir.irb.hr

On 09/09/2015 10:34 AM, George Mamalakis wrote:
Hello everybody, and wishes for a happy academical-year!

I am returning to the subject of multilang fields when the title and
subject are created in the way described in the last mail of this
thread, because of a problem that arises when import plugins are used.

As I was informed by our library staff, when they wanted to import (eg.
BibTeX) a document, the title and abstract fields were not filled. I
tried it myself (through the web interface) and they were true (no
errors in apache). I suppose that the import plugins use the title and
abstract field to write data, but in our case these fields are virtual,
so I have no idea how they handle inserts.

Any idea and help would be greatly appreciated, since not being use
EPrints import functionality, practically renders the creation of basic
multilang fields (title and abstract) created in that way unusable.

Thanks all in advance!

On 01/07/2015 01:05 μμ, George Mamalakis wrote:
OK,

I'll keep it in mind.

Thanks

On 01/07/2015 12:15 μμ, Field A.N. wrote:
You don't have a render_value property, but a quick scan of the MetaField object suggests that you might not need one if you're just making a text node from the value.  Not 100% sure though -- if it works, then don't worry about it :)


--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 30 Jun 2015, at 16:39, George Mamalakis wrote:

OK, it's done.

I'll upload the procedure on the wiki when I finish with my project (it'll be after the summer) or if I find free time in the meantime.

The general steps are (in order to replace the title field in this example):

1) Create a MetaField which returns a value ( ~eprints/lib/plugins/EPrints/MetaField/Virtualwithvalue.pm) containing the code found in Adam's video:

package EPrints::MetaField::Virtualwithvalue;

use strict;
use warnings;

use EPrints::MetaField;

our @ISA = qw( EPrints::MetaField );

use strict;

sub get_property_defaults
{
          my ( $self ) = @_;
          my %defaults = $self->SUPER::get_property_defaults;
          $defaults{get_value} = undef;
          return %defaults;
}

sub get_value
{
          my( $self, $object ) = @_;
          if ( defined $self->get_property("get_value") )
          {
              return $self->call_property( "get_value", $object);
          }
          return undef;
}

2) Change ./archives/myarchive/cfg/cfg.d/eprint_fields.pl to contain the new fields (ml_title and the new title field (which is based on our newly created MetaField derivative)), ie:

{
          name => 'ml_title',
          type => 'multilang',
          multiple => 1,
          fields => [ { sub_name => "text", type => "longtext", input_rows => 3, make_single_value_orderkey => 'EPrints::Extras::english_title_orderkey' } ],
          input_add_boxes => 1,
},

{
          name => 'title',
          type => 'virtualwithvalue',
          virtual => 1,

          get_value => sub
          {
              my ($eprint) = @_;
              if ($eprint->is_set('ml_title'))
              {
                  my $vals = $eprint->get_value('ml_title');
                  my $title = '';
                  # set the default lang's text as title
                  foreach my $v1 (@{$vals})
                  {
                      if (%$v1{'lang'} eq $c->{defaultlanguage})
                      {
                          $title = %$v1{'text'};
                      }
                  }
                  # if not a default lang found, get the first object's text as title
                  if ($title eq '')
                  {
                      $title = ${$$vals[0]}{'text'} ;
                  }
                  return $title;

              }
              return undef;
          }
},

3) Update your archive in order to create the new field:

$ ./bin/epadmin update myarchive

4) Add the appropriate phrases in ~/archives/myarchive/cfg/lang/en/phrases/local.xml (and do it for any other language you may have):

<!-- multilang title related phrases -->
          <epp:phrase id="eprint_fieldname_ml_title">Title</epp:phrase>
          <epp:phrase id="eprint_fieldname_ml_title_text">Text</epp:phrase>
          <epp:phrase id="eprint_fieldname_ml_title_lang">Language</epp:phrase>
          <epp:phrase id="eprint_fieldhelp_ml_title">The title of the item. The title should not end with a full stop, but may end with a question mark. There is no way to make italic text, please enter it normally. If you have a subtitle, it should be preceded with a colon [:]. Use capitals only for the first word and for proper nouns.
<br/>Example: <span class="ep_form_example">A brief history of time</span>
<br/>Example: <span class="ep_form_example">Life: an unauthorised biography</span>
<br/>Example: <span class="ep_form_example">Mathematics for engineers and scientists. 5th edition</span>
<br/>Example: <span class="ep_form_example">Ecosystems of the world. Vol. 26. Estuaries of the world</span>
</epp:phrase>

5) Add (and remove) the appropriate entries in you workflows (~/archives/myarchive/cfg/workflows/eprint/default.xml) in the "core" section:

<!--    <component><field ref="title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/title_duplicates" input_lookup_params="id={eprintid}&amp;dataset=eprint&amp;field=title" /></component>
-->
          <component><field ref="ml_title" required="yes"/></component>

6) Test and reload your archive for your changes to take effect:
$ ./bin/epadmin test
$ ./bin/epadmin reload myarchive


Thanks everyone for the help, and especially Tim and Adam for making it possible!! :):)


PS. Hope I haven't forgotten anything...:)


On 26/06/2015 05:27 μμ, George Mamalakis wrote:
Tim,

Now that I got illuminated (:-P) by the video regarding EPrints' virtual fields, I am trying to think how I could take advantage of them in order to use to solve my multilanguage-fields problem, and I think I'm a bit stuck.

I'll speak my thoughts out loud and please correct me if I'm wrong. Let the target field be the "title".

So, we need the title to be stored in more than one languages in the database, which should be "easily" accomplished using a multi-row field. Hence, multilang fields are a perfect candidate for this. We therefore create a new field, let's say ml_title (as you proposed) and store our values in it. Now, in order for EPrints not to break, we change the title                                           field to be a virtual field and compose its output based on ml_title field. In the end, we'll have two fields for the title. The title field (of type virtualfield) that will be calculating its value each time it's called, and the ml_title field (of type multilang). Is that correct?

Now that I've written my thoughts, I think I'm no more stuck and I see that your idea is brilliant and very easy!! :):). And if the above paragraph is not your idea, and it's even easier than that, then it'll be even more brilliant!! :):)

Cheers again, I'll give it a try on Monday!

Once again, nice work Adam and thanks Tim and all of you for your help!

PS. It would be extremely beneficial if there were a guide as to how EPrints' internals work. Something that is a little be more explanatory than the "anatomy of a request (http://wiki.eprints.org/w/Anatomy_of_a_request)" and explain how the coders of EPrints really think of EPrints in their minds.

On 25/06/2015 11:42 πμ, Timothy Miles-Board wrote:
The "problem" is that when you ask $eprint->get_value() for the value of a multilang field it gives you a perl data structure - in this case arrayref (array of                                                           {langcode=>text} hashrefs) - ie. the same behaviour as you would expect for a compound field or any field with a multiple value.

$eprint->get_value() is used everywhere - including in export plugins. So any field where the plugin implicitly expects a string - like title, abstract etc - it will output something like ARRAYx01123123

So your options are:

* Fix up all the plugins to be cleverer about how they get the "best" value of multilang field (ie. use get_value() then look at the user's lang / default lang to pull out the best string from the multilang structure) - but this would mean repeating the same routine in every plugin..

* Change the way that get_value() works so that it somehow decides which behaviour to use (arrayref vs best lang string) based on calling context etc. -                                                           get_value is used everywhere in EPrints so this would probably break everything..

* Add a layer of abstraction between the low level get_value() and the plugins that defines an API for returning language dependent strings - then change all the             plugins to use that (so instead of get_value(), plugins could call get_lang_string() or something - something like this would be the best approach...

In the meantime, what you could do is instead of changing the default title, abstract etc fields, just define new multilang versions.

So eg. ml_title, ml_abstract ...

Then use these in your workflow instead of the default title, abstract .. etc.

Finally in eprint_fields_automatic.pl, write some code to take the ml_* fields and populate the equivalent scalar fields. So eg. get the value of ml_title, pull out the text in the default language (or if the default language version is not defined, some other language in order of preference - the EPrints::Language module already does stuff like this with phrases) and write that value into the title field.

Then anything that expects $eprint->get_value( "title" ) to return a string will be happy (albeit they will always give the default/preferred language).

Or...

Change the default title, abstract etc. fields to a virtual field so that you can dynamically work out the (string) value by looking at ml_title, ml_abstract etc - as long as the value returned is always a string this shouldn't break anything.

Food for thought I hope,

Tim

Timothy Miles-Board
Web & Repositories Development Specialist, University of London Computer Centre
020 7863 1342  |  07742 970 351  | timothy.miles-board@london.ac.uk | @drtjmb
The University of London is an exempt charity in England and Wales


From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of George Mamalakis <mamalos@eng.auth.gr>
Sent: 25 June 2015 8:38 AM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: [spam?] Re: How to set a field to be multilang

Thanks Alen, I'll look into it deeper.

It's sad, though, that default Import/Export plugins break. Could you give a few hints on how to customise these plugins? (general guidelines). Could the                                                           changes be applied on the parent Import and Export plugin, or most child plugins tend to override functions dealing with title, abstract, etc?

And that being the case, isn't it equivalent to adding extra fields for an additional language? Either way same things are broken, right? :)

Lastly, where are these metadata fields stored in the database? Reading the article in the link you provided diagonally, it seems that I need to update the database in order to                                             create them, right?

Thanks again!

On 24/06/2015 11:18 μμ, Alen Vodopijevec wrote:
Hi!

You have Metadata Field Types documented here:
http://wiki.eprints.org/w/Category:EPrints_Metadata_Fields

But, be aware that changing title, keywords and abstract fields to
'compound' breaks default EPrints plugins - export/import .. these
plugins expect title/keywords/abstract to be simple and not compound
(hash) value.

I'm using it that way but there is some extra effort to customize and
maintain import/export plugins.

If anybody have a suggestion or a better solution please let me know.

Maybe this is a good opportunity to discuss that i18n issues in EPrints.

Kind regards,
--
Alen

On 06/24/2015 10:15 AM, George Mamalakis wrote:
Ah,

And by the way, is there any documentation on this "fields" attribute
somewhere? Cos I think it wasn't mentioned anywhere.

Thanks again!

On 24/06/2015 10:29 πμ, Timothy Miles-Board wrote:
---------- Forwarded message ----------
From: Timothy Miles-Board <timothy.miles-board@ulcc.ac.uk>
Date: 18 Jun 2015 11:30 pm
Subject: Re: [EP-tech] How to set a field to be multilang
To: eprints-tech@ecs.soton.ac.uk
Cc:

{
name => 'title',
type => 'multilang',
multiple => 1,
fields => [ { sub_name => "text", type => "longtext",
input_rows => 3, make_single_value_orderkey =>
'EPrints::Extras::english_title_orderkey' } ],
input_add_boxes => 1,
},


Tim

On 23 Jun 2015 9:09 am, George Mamalakis <mamalos@eng.auth.gr> wrote:

Guys (and girls),

Any news on multilingual fields? Anybody using them?

Thanks!

George

On 18/06/2015 06:31 μμ, George Mamalakis wrote:
Hello again,

I am trying to make my EPrints installation support
multilanguage fields
(eg. title, abstract, etc.). The thing I did that worked (which
doesn't
feel right to me, though) was adding a new Metadata field (eg.
title_en)
and add it to the database and workflow. On the documentation,
on the
other hand, I saw that there is a Multilang field type
(./perl_lib/EPrints/MetaField/Multilang.pm) which should be
used for
this purpose. The strange thing is that its perldoc DESCRIPTION
section
starts with "not done", probably meaning that it's not implemented?
Disregarding the last comment, when I changed
./archives/myarchive/cfg/cfg.d/eprint_fields.pl title field to
read:
{
name => 'title',
type => 'multilang',
input_rows => 3,
make_single_value_orderkey =>
'EPrints::Extras::english_title_orderkey',
},

and I reloaded epadmin, I got the following error:

"Error in field property for eprint.title: fields on a multilang
metafield can't be undefined"

So, which is the proper way for adding multilanguage support in
fields
and display them in workflows?

Thanks for all help in advance!

--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options:
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/



*** Options:http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive:http://www.eprints.org/tech.php/
*** EPrints community wiki:http://wiki.eprints.org/
*** EPrints developers Forum:http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379




----------------------------- Upozorenje -----------------------------

Automatskom detekcijom utvrdjeno je da tekst ove poruke
podsjeca na tzv. phishing poruku.

AKO SE U PORUCI TRAZI DA POSALJETE VASU IRB LOZINKU ILI
DA UNESETE IRB PODATKE NA NAVEDENOM LINKU, RADI SE O
NAPADU S CILJEM KRADJE I ZLOUPOTREBE PODATAKA.

Centar za informatiku i racunarstvo,
Institut Rudjer Boskovic

----------------------------- Upozorenje -----------------------------


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379





*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379





*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer
Electrical and Computer Engineer (Aristotle Un. of Thessaloniki),
PhD (Aristotle Un. of Thessaloniki),
MSc (Imperial College of London)

Department of Electrical and Computer Engineering
Faculty of Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379





*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive:
http://www.eprints.org/tech.php/

*** EPrints community wiki:
http://wiki.eprints.org/

*** EPrints developers Forum:
http://forum.eprints.org/
--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/



--
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379