[cc-commits] [CC SVN] r10976 - metadata_scraper/trunk/src/cc/deedscraper

webmaster at creativecommons.org webmaster at creativecommons.org
Tue Oct 14 13:38:56 EDT 2008


Author: nyergler
Date: 2008-10-14 17:38:56 +0000 (Tue, 14 Oct 2008)
New Revision: 10976

Modified:
   metadata_scraper/trunk/src/cc/deedscraper/app.py
Log:
Use a set-based triple sink.


Modified: metadata_scraper/trunk/src/cc/deedscraper/app.py
===================================================================
--- metadata_scraper/trunk/src/cc/deedscraper/app.py	2008-10-14 17:38:00 UTC (rev 10975)
+++ metadata_scraper/trunk/src/cc/deedscraper/app.py	2008-10-14 17:38:56 UTC (rev 10976)
@@ -32,9 +32,7 @@
 from decorator import decorator
 from support import LOG
 
-if sys.version < (2,5):
-    # import set support
-    from sets import Set as set
+from rdfadict.sink import DictSetTripleSink
 
 FOLLOW_PREDICATES = (
      'http://www.w3.org/1999/02/22-rdf-syntax-ns#seeAlso',
@@ -79,6 +77,10 @@
             contents= opener.open(request).read()
             subjects.append(url)
 
+            # default to a set-based triple sink
+            if sink is None:
+                sink = DictSetTripleSink()
+
             triples = parser.parse_string(contents, url, sink)
 
             # look for possible predicates to follow
@@ -112,6 +114,11 @@
         # parse the RDFa from the document
         triples = self._load_source(url)
 
+        # post-process the Object sets into lists
+        for s in triples.keys():
+            for p in triples[s].keys():
+                triples[s][p] = list(triples[s][p])
+        
         ns_cc = 'http://creativecommons.org/ns#'
         ns_wr = 'http://web.resource.org/cc/'
 




More information about the cc-commits mailing list