OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Type Mapping plug-in

Open Harvester Systems support questions and answers, bug reports, and development issues.

Moderators: jmacgreg, michael, John

Forum rules
Developer Resources:

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome.

Type Mapping plug-in

Postby germanbio » Mon Feb 11, 2013 11:58 am

Hi everybody

I've tried to use the type mapping plug-in that is included in OHS 2.32.
Following the instructions I've created a typemap-[archive id].xml file, the plug-in is activated and created a public Crosswalk named type. But none transformation is applied in harvesting process via PHP CLI or via metadata index web interface.

Trying to follow the code, looking at TypeMapPreprocessorPlugin.inc.php, previous to identify the affected fields

$crosswalkDao =& DAORegistry::getDAO('CrosswalkDAO');
$typeCrosswalk =& $crosswalkDao->getCrosswalkByPublicCrosswalkId('type');


echo $typeCrosswalk;
echo "DAo".$crosswalkDao;
die;

It looks like $crosswalkDao is null, and of course $typeCrosswalk is null. I assume that is the reason of the none mapping applied.
Somebody knows how could it be fixed?

Regards & thanks
German
germanbio
 
Posts: 5
Joined: Wed Jul 11, 2012 8:16 am

Re: Type Mapping plug-in

Postby asmecher » Tue Feb 12, 2013 5:46 pm

Hi German,

If $crosswalkDao were null, then you would be seeing a "Call to a member function on a non-object" fatal error; try using "print_r" instead of "echo".

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7743
Joined: Wed Aug 10, 2005 12:56 pm

Re: Type Mapping plug-in

Postby germanbio » Thu Feb 14, 2013 8:00 am

Hi Alec

Thank you very much for your answer. I've tried with a fresh install of ohs 2.32 and included the archive that I want to harvest, created the "type" crosswalk, enabled type mapping plugin and created typemap-1.xml (and verified that is a valid XML). But after all, the plug-in is never called, I've tried to flush metadata index and to re-harvest...nothing.

Trying to debug, I've followed your suggestion and included print_r, then TypeMapPreprocessorPlugin.inc.php is called when I've tried to enable/disable the plug-in and it shows the correct plug-in. The conclusions are:

1. CrosswalkDao is found
2. $typeCrosswalk =& $crosswalkDao->getCrosswalkByPublicCrosswalkId('type') is OK.
3. $this->typeCrosswalkFieldIds[] = $field->getFieldId(); is reached
4. Its value is ( [0] => 8 ) that I assume is relative to Dublin Core metadata type id.

I've included several die´s in another code parts, for instance

&_getMapCache(&$archive)
_mapCacheMiss(&$cache, $id)
preprocessEntry(&$archive, &$record, &$field, &$value, &$attributes)

And none of these die's are reached when you try to reharvest. I'm assuming then, that the plug-in is never called. Is there a way to continue this debug?

Regards & Thanks
German
germanbio
 
Posts: 5
Joined: Wed Jul 11, 2012 8:16 am

Re: Type Mapping plug-in

Postby asmecher » Tue Feb 19, 2013 10:19 am

Hi German,

Sorry for the wait. I've found a problem with the preprocessor plugin category (see http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8122) -- it depends on a hook that no longer gets called from anywhere, which explains the behavior you're seeing.

Unfortunately we don't currently have the resources to fix this immediately, but if you're interested in tinkering, a good place to start would be in classes/plugins/PreprocessorPlugin.inc.php in the "register" function. Instead of registering the Harvester::insertEntry hook, it should register Harvester::insertRecord (which is called from classes/harvester/Harvester.inc.php in the _insertRecord function); note that the new hook has a substantially different parameter list so some additional adjustments will be required.

If that's Greek to you, please let me know and I'll see what I can do.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7743
Joined: Wed Aug 10, 2005 12:56 pm

Re: Type Mapping plug-in

Postby germanbio » Thu Feb 21, 2013 9:39 pm

Hi Alec

Thank you very much for your reply.
I've been looking at the source code point that you're referring and I see at PreprocessorPlugin.inc.php the line

HookRegistry::register('Harvester::insertEntry', array(&$this, '_preprocessEntry'));

This should be changed to register the Harvester::insertRecord isn't it?

But in TypeMapPreprocessorPlugin.inc.php has only preprocessEntry method defined. At PreprocessorPlugin.inc.php it should left

HookRegistry::register('Harvester::insertRecord, array(&$this, '_preprocessEntry'));?

Probably yes, it's greek for me.
Kind Regards
germanbio
 
Posts: 5
Joined: Wed Jul 11, 2012 8:16 am

Re: Type Mapping plug-in

Postby asmecher » Fri Feb 22, 2013 4:03 pm

Hi German,

I've posted a patch in that Bugzilla entry, though it's not been tested against any particular release; have a look at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8122#c2. It should rehabilitate the pre- and post-processor filter categories.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7743
Joined: Wed Aug 10, 2005 12:56 pm

Re: Type Mapping plug-in

Postby germanbio » Mon Feb 25, 2013 9:24 pm

Dear Alec

Thank you very much by your answer.

I've tried to download a zip copy from git for harvester project (that I've seen that you've updated) and pkp-lib. Uncompressed into my server and put pkp-lib inside lib/pkp folder of harvester.

Everything works fine until the moment of accesing Plug-ins administration option, It seems to have an AJAX problem. Bugzilla says

------------------

NetworkError: 404 Not Found - http://200.0.206.180/harvester/styles/lib.css"

lib.css

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/lib/pkp/ ... troller.js"

fontController.js

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/js/pages ... Handler.js"

Search...dler.js

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/plugins/ ... Handler.js"

Lucene...dler.js

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/lib/pkp/ ... troller.js"

fontController.js

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/js/pages ... Handler.js"

Search...dler.js

"NetworkError: 404 Not Found - http://200.0.206.180/harvester/plugins/ ... Handler.js"

------------------
Really it's strange because looking at the git's pkp-lib

https://github.com/pkp/pkp-lib/tree/master/js/functions

fontController.js does not exists.

Additionally if I try to go to Archive Managers it says

Fatal error: Call to undefined method RoleDAO::getRoleName() in /var/www/harvester/pages/admin/PeopleHandler.inc.php on line 38

But this is completely unrelated. What I need is to test typemap plugin.
Do you think that I have a mistake in the deploy?

Regards & thanks again
German
germanbio
 
Posts: 5
Joined: Wed Jul 11, 2012 8:16 am

Re: Type Mapping plug-in

Postby asmecher » Mon Feb 25, 2013 9:46 pm

Hi German,

You're better off using the stable release and applying the patch to it; the git master version will not be stable.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7743
Joined: Wed Aug 10, 2005 12:56 pm


Return to Open Harvester Systems Support and Development

Who is online

Users browsing this forum: No registered users and 1 guest