Index: metadata/trunk/toolkit/scripts/check-tools-integrity.py
===================================================================
--- metadata/trunk/toolkit/scripts/check-tools-integrity.py	(revision 2626)
+++ metadata/trunk/toolkit/scripts/check-tools-integrity.py	(revision 2884)
@@ -2,7 +2,8 @@
 # -*- coding: utf-8 -*-
 
-##   Title:      Check tools integry
+##   Title:      Check tools integrity
 ##   Author:     Sander Maijers <sanmai @@ mpi.nl>
 ##   Since:      1-8-2012
+##   Status:     ALPHA
 ##   Description:
 ##   Check the CLARIN tools registry CSV file for problematic 
Index: metadata/trunk/toolkit/scripts/filter_tools_csv.R
===================================================================
--- metadata/trunk/toolkit/scripts/filter_tools_csv.R	(revision 2626)
+++ metadata/trunk/toolkit/scripts/filter_tools_csv.R	(revision 2884)
@@ -4,11 +4,23 @@
 ## for stale/irrelevant/problematic records.
 
-tools_registry 		<- read.csv("/tmp/export_tools", check.names = FALSE, header = TRUE);
-checks_output_table <- read.table("/tmp/output.tab", sep = '\t', check.names = FALSE, header = TRUE);
-colnames(checks_output_table) <- paste(colnames(checks_output_table), "check");
+tools_registry <- 
+	read.csv("/tmp/export_tools", 
+			 check.names = FALSE, 
+			 header = TRUE);
+checks_output_table <- 
+	read.table("/tmp/output.tab", 
+			   sep = '\t', 
+			   check.names = FALSE, 
+			   header = TRUE);
 
-tools_registry <- tools_registry[, -1 * which(colnames(tools_registry) == "URL check result (field_tool_urlcheck)")];
+colnames(checks_output_table) <- 
+	paste(colnames(checks_output_table), "check");
 
-records_to_be_kept 	<- subset(checks_output_table, `Reference link (field_tool_reference_link) check` != "unspecified");
+tools_registry <- 
+	tools_registry[, -1 * which(colnames(tools_registry) == "URL check result (field_tool_urlcheck)")];
+
+records_to_be_kept <- 
+	subset(checks_output_table, 
+			`Reference link (field_tool_reference_link) check` != "unspecified");
 
 
@@ -16,10 +28,12 @@
 
 ## Records whose contact person should be warned.
-records_any_unspecified <- subset(records_to_be_kept, `Reference link (field_tool_reference_link) check` 			== "unspecified" 
-													| `Documentation link (field_tool_document_link) check` 		== "unspecified" 
-													| `Webservice link (field_tool_webservice_link) check`		== "unspecified");
+records_any_unspecified <- 
+	subset(records_to_be_kept, `Reference link (field_tool_reference_link) check` 			== "unspecified" 
+								| `Documentation link (field_tool_document_link) check` 	== "unspecified" 
+								| `Webservice link (field_tool_webservice_link) check`		== "unspecified");
 
 
-complete_extended_table 					<- cbind(tools_registry, checks_output_table);
+complete_extended_table <- 
+	cbind(tools_registry, checks_output_table);
 
 write.table(complete_extended_table, 
@@ -30,8 +44,11 @@
 
 
-records_relevant_links_specified 	<- subset(records_to_be_kept, (`Reference link (field_tool_reference_link) check` 	    != "unspecified"
-																	| `Webservice link (field_tool_webservice_link) check` 	!= "unspecified") 
-																	& `Documentation link (field_tool_document_link) check` 	!= "unspecified");
-links_specified_table				<- cbind(tools_registry[row.names(records_relevant_links_specified),], records_relevant_links_specified);
+records_relevant_links_specified <- 
+	subset(records_to_be_kept, (`Reference link (field_tool_reference_link) check` 	    != "unspecified"
+								| `Webservice link (field_tool_webservice_link) check` 	!= "unspecified") 
+							& `Documentation link (field_tool_document_link) check` 	!= "unspecified");
+links_specified_table <- 
+	cbind(tools_registry[row.names(records_relevant_links_specified),], records_relevant_links_specified);
+
 write.table(links_specified_table, 
 			file 			= "/tmp/export_tools__relevant_links_specified__7-8-2012.csv", 
@@ -41,8 +58,11 @@
 
 
-records_relevant_links_work 	    <- subset(records_to_be_kept, (`Reference link (field_tool_reference_link) check` 	    == "works"
-																	| `Webservice link (field_tool_webservice_link) check` 	== "works") 
-																	& `Documentation link (field_tool_document_link) check` 	== "works");
-links_work_table 					<- cbind(tools_registry[row.names(records_relevant_links_work),], records_relevant_links_work);
+records_relevant_links_work <- 
+	subset(records_to_be_kept, (`Reference link (field_tool_reference_link) check`  == "works"
+							| `Webservice link (field_tool_webservice_link) check` 	== "works") 
+							& `Documentation link (field_tool_document_link) check` == "works");
+links_work_table <- 
+	cbind(tools_registry[row.names(records_relevant_links_work),], records_relevant_links_work);
+
 write.table(links_work_table, 
 			file 			= "/tmp/export_tools__relevant_links_work__7-8-2012.csv", 
@@ -51,9 +71,10 @@
 			col.names 		= TRUE);
 
-URLs 				<- tools_registry[row.names(records_problematic),17]
+URLs <-
+	tools_registry[row.names(records_problematic),17];
 
 ## To inspect the problematic records manually:
-edit(records_problematic)
+edit(records_problematic);
 
 ## Bar plot of frequencies of problematic Reference link values by country.
-plot(factor(tools_registry[row.names(records_problematic),10]))
+plot(factor(tools_registry[row.names(records_problematic),10]));
Index: metadata/trunk/toolkit/scripts/lrt2cmdi.py
===================================================================
--- metadata/trunk/toolkit/scripts/lrt2cmdi.py	(revision 2626)
+++ metadata/trunk/toolkit/scripts/lrt2cmdi.py	(revision 2884)
@@ -7,5 +7,5 @@
 from curses.ascii import ascii
 
-if sys.version_info < (2, 7) :
+if sys.version_info < (2, 7) or sys.version_info >= (3, 0):
     sys.stderr.write("WARNING: this script was only tested with Python version 2.7.3! You are running version " + str(sys.version_info[1]) + "." + str(sys.version_info[2]) + " instead.\n")
 
@@ -16,5 +16,6 @@
         self.xmlTree        = ElementTree.ElementTree(ElementTree.fromstring(template))
         self.parentmap      = dict((c, p) for p in self.xmlTree.getiterator() for c in p)
-        self.fillElement("//MdCreationDate", datetime.datetime.now().strftime("%Y-%m-%d"))
+        self.current_date   = datetime.datetime.now().strftime("%Y-%m-%d")
+        self.fillElement("//MdCreationDate", self.current_date)
         self.fillElement("//MdSelfLink", "http://lrt.clarin.eu/node/%s" % nodeId)
 
@@ -151,11 +152,12 @@
             collectionList  = frozenset(("Spoken Corpus", "Written Corpus", "Multimodal Corpus", "Aligned Corpus", "Treebank", "N-Gram Model",))
             lexiconList     = frozenset(("Grammar", "Lexicon / Knowledge Source", "Terminological Resource",))
-
+           
             if typeList.intersection(collectionList):
                 self.addCollectionDetails(record, isoList)
             if typeList.intersection(lexiconList):
                 self.addLexiconDetails(record, isoList)
-            #if "Web Service" in typeList:
-            #    self.addServiceDetails(record)
+            if "Web Service" in typeList:
+                #pdb.set_trace()
+                self.addServiceDetails(record)
 
     def addCollectionDetails(self, record, isoList):
@@ -163,34 +165,65 @@
 
 
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/LongTermPreservationBy",    record["field_longterm_preservation"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Location",                  record["field_location_0"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/ContentType",               record["field_content_type"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/FormatDetailed",            record["field_format_detailed"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Quality",                   record["field_quality"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Applications",              record["field_applications"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Size",                      record["field_size"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/DistributionForm",          record["field_distribution_form"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Size",                      record["field_size"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Access",                    record["field_access"])
-        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Source",                    record["field_source_0"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/LongTermPreservationBy",    
+                                 record["field_longterm_preservation"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Location",                  
+                                 record["field_location_0"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/ContentType",               
+                                 record["field_content_type"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/FormatDetailed",            
+                                 record["field_format_detailed"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Quality",                   
+                                 record["field_quality"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Applications",              
+                                 record["field_applications"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Size",                      
+                                 record["field_size"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/DistributionForm",          
+                                 record["field_distribution_form"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Size",                      
+                                 record["field_size"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Access",                    
+                                 record["field_access"])
+        self.fillOptionalElement(LrtCollectionDetails_XPath + "/Source",                    
+                                 record["field_source_0"])
 
         # ok - this can be done in a cleaner way
-        self.addLanguages(isoList, record["field_working_languages"], 1, LrtCollectionDetails_XPath + "/WorkingLanguages")
+        self.addLanguages(isoList, 
+                          record["field_working_languages"], 
+                          1, 
+                          LrtCollectionDetails_XPath + "/WorkingLanguages")
 
     def addLexiconDetails(self, record, isoList):
-        LrtLexiconDetails_XPath     = "//LrtInventoryResource/LrtLexiconDetails"
-
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Date",                         record["field_date_0"])
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Type",                         record["field_type"])
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/FormatDetailed",               record["field_format_detailed_1"])
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/SchemaReference",              record["field_schema_reference"])
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Size",                         record["field_size_0"])
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Access",                       record["field_access_1"])
-        self.addLanguages(isoList, record["field_working_languages_0"], 1, LrtLexiconDetails_XPath + "/WorkingLanguages")
+        LrtLexiconDetails_XPath = "//LrtInventoryResource/LrtLexiconDetails"
+
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Date",                         
+                                 record["field_date_0"])
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Type",                         
+                                 record["field_type"])
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/FormatDetailed",               
+                                 record["field_format_detailed_1"])
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/SchemaReference",              
+                                 record["field_schema_reference"])
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Size",                         
+                                 record["field_size_0"])
+        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Access",                       
+                                 record["field_access_1"])
+        self.addLanguages(isoList, 
+                          record["field_working_languages_0"], 
+                          1, 
+                          LrtLexiconDetails_XPath + "/WorkingLanguages")
 
     def addServiceDetails(self, record):
+
+        #pdb.set_trace()
         LrtLexiconDetails_XPath  = "//LrtInventoryResource/LrtServiceDetails"
 
-        self.fillOptionalElement(LrtLexiconDetails_XPath + "/Date",                         record["field_date_0"])
+        if str(record["field_date_0"]).strip() == '' :
+            service_date = self.current_date
+        else :
+            service_date = record["field_date_0"] 
+
+        self.fillElement(LrtLexiconDetails_XPath + "/Date",
+                         service_date)
 
     def addResourceProxy(self, link) :
@@ -298,11 +331,11 @@
         cmdi.fillElement("//LrtCommon/MetadataLink", record["field_metadata_link"])
         cmdi.fillElement("//LrtCommon/Publications", record["field_publications"])
-        cmdi.fillElement("//LrtCommon/ReadilyAvailable", record["field_resource_available"].replace("Yes","true").replace("No","false"))
+        cmdi.fillElement("//LrtCommon/ReadilyAvailable", record["field_resource_available"].replace("Yes", "true").replace("No", "false"))
         cmdi.fillElement("//LrtCommon/ReferenceLink", record["field_reference_link"])
 
         cmdi.fillElement("//LrtDistributionClassification/DistributionType", record["distribution_type"])
-        cmdi.fillElement("//LrtDistributionClassification/ModificationsRequireRedeposition", record["modifications_require_redeposition"].replace("1","true").replace("0","false"))
-        cmdi.fillElement("//LrtDistributionClassification/NonCommercialUsageOnly", record["non-commercial_usage_only"].replace("1","true").replace("0","false"))
-        cmdi.fillElement("//LrtDistributionClassification/UsageReportRequired", record["usage_report_required"].replace("1","true").replace("0","false"))
+        cmdi.fillElement("//LrtDistributionClassification/ModificationsRequireRedeposition", record["modifications_require_redeposition"].replace("1", "true").replace("0","false"))
+        cmdi.fillElement("//LrtDistributionClassification/NonCommercialUsageOnly", record["non-commercial_usage_only"].replace("1", "true").replace("0", "false"))
+        cmdi.fillElement("//LrtDistributionClassification/UsageReportRequired", record["usage_report_required"].replace("1", "true").replace("0", "false"))
         cmdi.fillElement("//LrtDistributionClassification/OtherDistributionRestrictions", record["other_distribution_restrictions"])
 
