Allow config files to be generated by a set of foaf files in a directory
This commit is contained in:
parent
d025fe59ac
commit
843a42b982
@ -35,13 +35,13 @@ def load_model(rdf, base_uri):
|
||||
return model
|
||||
|
||||
# input = foaf, output = ConfigParser
|
||||
def foaf2config(rdf, config, subject=None):
|
||||
def foaf2config(rdf, config, subject=None, section=None):
|
||||
|
||||
if not config or not config.sections():
|
||||
return
|
||||
|
||||
# there should be only be 1 section
|
||||
section = config.sections().pop()
|
||||
if not section: section = config.sections().pop()
|
||||
|
||||
try:
|
||||
from RDF import Model, NS, Parser, Statement
|
||||
@ -191,6 +191,7 @@ if __name__ == "__main__":
|
||||
|
||||
for uri in sys.argv[1:]:
|
||||
config.add_section(uri)
|
||||
foaf2config(urllib.urlopen(uri), config)
|
||||
foaf2config(urllib.urlopen(uri), config, section=uri)
|
||||
config.remove_section(uri)
|
||||
|
||||
config.write(sys.stdout)
|
||||
|
Loading…
x
Reference in New Issue
Block a user