[LON-CAPA-cvs] cvs: nsdl /nsdlloncapaorg harvester.pl

www lon-capa-cvs@mail.lon-capa.org
Tue, 29 Jul 2003 14:13:36 -0000


www		Tue Jul 29 10:13:36 2003 EDT

  Modified files:              
    /nsdl/nsdlloncapaorg	harvester.pl 
  Log:
  Continued work.
  
  
Index: nsdl/nsdlloncapaorg/harvester.pl
diff -u nsdl/nsdlloncapaorg/harvester.pl:1.2 nsdl/nsdlloncapaorg/harvester.pl:1.3
--- nsdl/nsdlloncapaorg/harvester.pl:1.2	Mon Jul 28 16:14:17 2003
+++ nsdl/nsdlloncapaorg/harvester.pl	Tue Jul 29 10:13:36 2003
@@ -60,6 +60,8 @@
 #}
 
 my %records = ();;
+print '<?xml version="1.0" encoding="UTF-8"?>'."\n\n";
+
 foreach my $metadata (@loncapa) {
 	chomp $metadata;
 	$metadata=~s/[^\w\d\s\.\;\:\,\|\/]/ /gs;
@@ -128,8 +130,9 @@
 	next if ( $language ne 'seniso');
 	my $primary_language='en-US';
 	my $creation_date = $tkline[10];
-	my ($pub_year,$pub_month,$pub_day) = ( $creation_date =~ /^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/ );
+	my ($pub_year,$pub_month,$pub_day) = ( $creation_date =~ /^(\d{4}) (\d{2}) (\d{2})\s(\d{2}):(\d{2}):(\d{2})$/ );
 	my $revision_date = $tkline[11];
+	my ($rev_year,$rev_month,$rev_day) = ( $revision_date =~ /^(\d{4}) (\d{2}) (\d{2})\s(\d{2}):(\d{2}):(\d{2})$/ );
 	my $owner = $tkline[12];
 	my $rights_description;
 	my $copyright = $tkline[13]; # public,domain,default,private (skip if private and domain)
@@ -148,17 +151,21 @@
 	next if ( $copyright eq 'private');
 	my $platform = "5";     # HTML Browser (not specified but construed from metadata)
 	print (<<ENDMETA);
-<rdf about="lon-capa.nsdl.collections/$baseid">
-    <dc:title>$title</dc:title>
-    <dc:creator>$author_fname $author_lname</dc:creator>
-    <dc:subject>$keywords</dc:subject>
-    <dc:subject>$subject</dc:subject>
-    <dc:identifier scheme="URI">$resourceurl</dc:identifier>
-    <dc:language>$primary_language</dc:language>
-    <dc:description>$abstract<dc:description>
-    <dc:date>$revision_date</dc:date>
-</rdf>
+<oaidc:dc xmlns="http://purl.org/dc/elements/1.1/" 
+          xmlns:oaidc="http://www.openarchives.org/OAI/2.0/oai_dc/" 
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+          xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ 
+                              http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
+>
+    <title>$title</title>
+    <creator>$author_fname $author_lname</creator>
+    <identifier>$resourceurl</identifier>
+    <subject>$keywords</subject>
+    <subject>$subject</subject>
+    <language>$primary_language</language>
+    <description>$abstract</description>
+    <date>$rev_year-$rev_month-$rev_day</date>
+</oaidc:dc>
 
 ENDMETA
 }
-