1. edsu
  2. eac-graph-load

Commits

edsu  committed 2874092

seem to be getting blank urls as subjects for hasProvenance assertions

  • Participants
  • Parent commits 60bcf47
  • Branches default

Comments (0)

Files changed (1)

File rdfizer.py

View file
 #!/usr/bin/env python
 
 """
-This experimental script will convert the EAC graphml dump to RDF 
-(xml, turtle) using rdflib: 
+This experimental script will convert the EAC graphml dump to rdf/xml
+using rdflib (which you will need to have installed).
 
     % rdfizer.py graph-snac-example.xml
 
 Which should generate:
 
     eac.rdf
-    eac.ttl
 
 It uses the FOAF [1] and Arch [2] vocabularies.
 
     graph.bind("arch", ARCH)
     graph.bind("foaf", FOAF)
     graph.serialize(file("eac.rdf", "w"), format="xml")
-    graph.serialize(file("eac.ttl", "w"), format="turtle")
     graph.close()
 
 
                 self.graph.add((s, FOAF.name, rdflib.Literal(n['identity'])))
             if n['urls']:
                 for u in n['urls'].replace('\n', ' ').split(' '):
+                    u = u.strip()
+                    if not u:
+                        continue
                     coll = rdflib.URIRef(u)
+                    self.graph.add((coll, rdflib.RDF.type, ARCH.Collection))
+                    self.graph.add((coll, ARCH.hasProvenance, s))
                     self.graph.add((s, ARCH.primaryProvenanceOf, coll))
-                    self.graph.add((coll, ARCH.hasProvenance, s))
             print self.node['identity']
             self.node = None