Skip to content

Commit

Permalink
retrofit to monograph
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno De Bel authored and Bruno De Bel committed Feb 9, 2018
1 parent b2ce37e commit e61b6ad
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 21 deletions.
1 change: 1 addition & 0 deletions loadInventory/inventoryparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ StateParserState* StateParserInventoryRootState::getNext(const char* const name)
map["premis"]=
map["sequenceNumber"]=
map["issueNumber"]=
map["systemNumber"]=
map["barcode"]=
new StateParserParamState();
map["language"]=
Expand Down
15 changes: 4 additions & 11 deletions project/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- working sqlite database : must be define for a campaign -->
<database>C:/Data/DB/SMALLTEST3</database>
<database>C:/Data/DB/SMALLTEST6</database>

<!-- file where inventory of book is store in tabbed format : only needed for book checking -->
<inventoryFile>inventory.xml</inventoryFile>
Expand Down Expand Up @@ -126,16 +126,9 @@

</blocks>
<!-- inventoryBook
performs multiple checks against the inventory:
1. BIBREC_SYSNUM is in the inventory
2. BIBREC245a is correct in MODSMD_COLLECTION and MODSMD_PRINT
3. BIBREC100a is correct in MODSMD_COLLECTION and MODSMD_PRINT
4. whether the language terms used in MODSMD_COLLECTION all exist in the inventory
5. whether the language terms used in MODSMD_PRINT all exist in the inventory
6. add the opposite test wheter all languages in the inventory are use in MODSMD_PRINT and MODSMD_COLLECTION
7. whether the item barcode from the inventory corresponds to the identifier type="local" from MODSMD_PRINT
8. BIBREC_260b in MODSMD_PRINT
9. BIBREC_SYS_NUM with MARCMD_ALEPHSYNC BIBREC_SYS_NUM-->
the inventory become needed for all type of document
so the parser mets must be check active on inventory to check for exemple the name of file agaisnt system number
-->
<inventoryBook>1</inventoryBook>

<dates>0</dates>
Expand Down
1 change: 1 addition & 0 deletions project/inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class inventory{
std::string issuenumber;
std::string yearnumber;
std::string callnumber;
std::string systemnumber;
std::string printer;
std::string publisher;
std::string formaldate;
Expand Down
3 changes: 2 additions & 1 deletion project/sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void database::dberror(std::string sql){
bool database::getInventory(std::string _sysnum, inventory& _inventory){
bool ret = false;
static std::string sql = "SELECT UNIQUEBUILDKEY,AUTHOR,PAPERID,"
" LANGUAGES,FORMALDATE,TYPE,TITLE,TITLECOLLECTION,CALLNUMBER,ISSUENUMBER,YEARNUMBER,PAGES,"
" LANGUAGES,FORMALDATE,TYPE,TITLE,TITLECOLLECTION,CALLNUMBER,ISSUENUMBER,YEARNUMBER,SYSTEMNUMBER,PAGES,"
" CHECKED"
" from INVENTORY where UNIQUEBUILDKEY=?";

Expand Down Expand Up @@ -224,6 +224,7 @@ bool database::getInventory(std::string _sysnum, inventory& _inventory){
_inventory.callnumber = safe_sqlite3_column_text(pStmt, col++);
_inventory.issuenumber = safe_sqlite3_column_text(pStmt, col++);
_inventory.yearnumber = safe_sqlite3_column_text(pStmt, col++);
_inventory.systemnumber = safe_sqlite3_column_text(pStmt, col++);
_inventory.pages = safe_sqlite3_column_text(pStmt, col++);

_inventory.checked = sqlite3_column_int(pStmt, col++);
Expand Down
8 changes: 4 additions & 4 deletions project/verifyBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ std::string verifyBook::buildPartNumber(std::string& yearNumber, std::string& is
int yearLen = yearNumber.length();
int issueLen = issueNumber.length();

std::cout << "YEAR NUMBER:" << yearNumber << std::endl;
std::cout << "ISSUE NUMBER:" << issueNumber << std::endl;
//std::cout << "YEAR NUMBER:" << yearNumber << std::endl;
//std::cout << "ISSUE NUMBER:" << issueNumber << std::endl;

std::stringstream ss;
if ( yearLen != 0 ){
Expand All @@ -87,10 +87,10 @@ std::string verifyBook::buildPartNumber(std::string& yearNumber, std::string& is
ss << ", ";
}

ss << "n°" << issueNumber;
ss << "n\xc2\xba" << issueNumber;
}

std::cout << "RESULTE" << ss.str() << std::endl;
//std::cout << "RESULTE" << ss.str() << std::endl;

return ss.str();
}
Expand Down
34 changes: 29 additions & 5 deletions project/verifyFolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,39 @@ void verifyFolder::check(int check ,metsparserContext& context){
std::string search = "/\\";

int pos = path.find_last_of(search);
std::string uniq = context.inventory.getInventory("MODSMD_PRINT")->uniquebuildkey;
int poss = uniq.find_last_of('/');

uniq = uniq.substr(poss+1);
std::string uniq=context.inventory.getInventory("MODSMD_PRINT")->uniquebuildkey;

int count = 0;
for ( char *tmp=(char*)uniq.c_str();*tmp !=0 ; tmp++){ //
if (*tmp == '/'){
count ++;
}
}



if ( count < 2 ){
inventory invent;
if (!db->getInventory(uniq,invent)){
hError -> getError(cat_bookinventory,"METS","DMDSEC MODSMD_PRINT", "Unable tocheck File Name:" + uniq ,context.currentMetsFile,uniq);
return; // skip all
};
uniq = invent.systemnumber;
// check mets naming file
if ( context.currentMetsFile.compare(uniq + "-mets.xml")!=0 ){
hError->getError(cat_wrongFolderName,"METS","FOLDER", "Wrong Metsfile name: " + uniq + "-mets.xml" + " != Name of folder :" + context.currentMetsFile, context.currentMetsFile,"");
}


}else{
int poss = uniq.find_last_of('/');
uniq = uniq.substr(poss+1);
}
if ( pos + 1 < path.length() ){
std::string sub = path.substr(pos+1);
if ( sub.compare( uniq ) == 0 ) return ; // hoping that inventory is correcltly provided
};

hError->getError(cat_wrongFolderName,"METS","FOLDER", path + " is not UNIQ : "+ uniq ,context.currentMetsFile,uniq);
hError->getError(cat_wrongFolderName,"METS","FOLDER", "Wrong Path:"+ path + " is not UNIQ : "+ uniq ,context.currentMetsFile,uniq);

}

0 comments on commit e61b6ad

Please sign in to comment.