OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



hardcoding the archive_id in RecordDao.inc.php

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.

hardcoding the archive_id in RecordDao.inc.php

Postby singhkarki » Tue Jan 28, 2014 10:02 am

hello Sir,
I have harvested an archive with archive_id 28, everything fine till here. Now it has 9000 records, with opac 192.168.8.143/...
I now harvest another archive with archive_id=29 and around 18000 records, using command line, with opac 192.168.8.151/...
but, something strange happens,
The verbose logs are as follows: UPDATE records SET archive_id='28' // it should have been 29
schema_plugin_id='1'
identifier='KOHA-OAI-TEST:916',
and when i do a ,
SELECT archive_id from record where identifier='KOHA-OAI-TEST:916'
i get : archive_id = 28

why it doesn't take identifier for archive_id=29?

other stats are :

SELECT * from archive_settings;
28 Last Indexed Date 1
29 Last Indexed Date NULL

In the end what happens is , i have archive 29 with only 9000 records, opac 192.168.8.151/... (opac is correct) // record count should have been 18000
and the previous archive 28 ,has 9000 records but all of it's identifiers have incorrect opac 192.168.8.151/... , earlier the opac was correct 192.168.8.143/... //archive 29 overwrote opac of archive 28


To fix this , i opened RecordDAO.inc.php and
at line 170-176 for inserting a new record
function insertReord(&$record){
$this-update(sprintf('INSERT INTO RECORDS(archive_id, ) VALUES(? ,?,?);

i hardcodeed VALUE 29

similarly, at line 195-204 for updating an existing record
i hardcoded archive_id=29

now , it started harvesting the record for archive_id=29, but in the end it gave me error in ADODB.inc.php, harvester.inc.php, OAIHarvester.inc.php

please suggest me how can i take care of this error. i have around 14 archives set up for harvesting, and i am not able to move to 2nd archive .

And, Sir, please guide me how can i resolve the issue of archives serving the same record identifier.This will be really helpful. Where can i find the same record identifiers for various archives and how can i resolve that. please guide me.

thanks and regards,
Vijay
Last edited by singhkarki on Tue Jan 28, 2014 10:12 am, edited 1 time in total.
singhkarki
 
Posts: 41
Joined: Fri Nov 29, 2013 3:28 pm

Re: hardcoding the archive_id in RecordDao.inc.php

Postby asmecher » Tue Jan 28, 2014 10:10 am

Hi Vijay,

This is the same issue you've posted about here, here, and here; please try to keep each issue to a single thread as it'll help keep the forum readable. What data sources are you harvesting? If it's OJS or OCS, then you can change the OAI prefix by editing config.inc.php. If it's another repository, I'm not sure how to ensure that your record IDs are unique; you'll need to check the documentation for that software.

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

Re: hardcoding the archive_id in RecordDao.inc.php

Postby singhkarki » Tue Jan 28, 2014 10:16 am

hello ,
I am hrvesting records from KOHA an open source ILMS.It's OAI_PMH compliant.What does OAI prefix do in config.inc.php ?

thanks,
regards,
Vijay
singhkarki
 
Posts: 41
Joined: Fri Nov 29, 2013 3:28 pm

Re: hardcoding the archive_id in RecordDao.inc.php

Postby asmecher » Tue Jan 28, 2014 10:28 am

Hi Vijay,

The OAI prefix in config.inc.php would only be relevant if you were harvesting from other PKP software like OJS or OCS. Since you're harvesting from KOHA, you'll have to find out how to configure that software to provide unique IDs. Unfortunately I'm not familiar with it.

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

Re: hardcoding the archive_id in RecordDao.inc.php

Postby singhkarki » Tue Jan 28, 2014 10:54 am

thanks for reply ,
Is there a possibility by any chance ,that the record identifiers are distinct for different instances of koha.
That is ,different koha repositories are serving distinct record identifiers, and that the record identifiers are not common.

thanks ,

Vijay
singhkarki
 
Posts: 41
Joined: Fri Nov 29, 2013 3:28 pm

Re: hardcoding the archive_id in RecordDao.inc.php

Postby asmecher » Tue Jan 28, 2014 11:08 am

Hi Vijay,

I don't know, but the behavior you're describing is consistent with multiple archives providing non-unique record identifiers.

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

Re: hardcoding the archive_id in RecordDao.inc.php

Postby singhkarki » Wed Jan 29, 2014 5:25 am

hello Sir,
When i am trying to harvest data from two different repositories as told before, it overwrites on the rows with same column data(identifier) ,although column identifier has a contraint of uniqueness and upon my mannual attempt to insert data with same identifier name into the database,it shows an error for duplicacy("ERROR 1062 (23000): Duplicate entry 'KOHA-OAI-TEST:11238' for key 'record_identifier'").

So my query is regarding if you could please explain me the mechanism for the following:
"when the harvester tries to write data into database named "records" with same values on a column with constraint,it overwrites the values successfully,but when i tried to insert a row with same values as stored in a column that is constraint based,it shows duplicacy error. Why is it so that harvester is able to do and when i try myself,it gives the error ".

thanks,
regrads,

Vijay
singhkarki
 
Posts: 41
Joined: Fri Nov 29, 2013 3:28 pm

Re: hardcoding the archive_id in RecordDao.inc.php

Postby JasonNugent » Wed Jan 29, 2014 12:41 pm

Hi Vijay,

Are you using an INSERT statement or a REPLACE INTO? The former will attempt to create a new record. The latter creates or replaces, if the constraint is already present.

Regards
Jason
JasonNugent
Site Admin
 
Posts: 893
Joined: Tue Jan 10, 2006 6:20 am

Re: hardcoding the archive_id in RecordDao.inc.php

Postby singhkarki » Thu Feb 20, 2014 4:03 am

hello ,
thanks for your reply, KOHA UI had some settings which i had to work upon, i also hardcoded the archive id in the code .this finally took care of the issue.

thanks,
Vijay
singhkarki
 
Posts: 41
Joined: Fri Nov 29, 2013 3:28 pm


Return to Open Harvester Systems Support and Development

Who is online

Users browsing this forum: No registered users and 2 guests