Skip to content

Commit

Permalink
added runnable via command line, readme
Browse files Browse the repository at this point in the history
  • Loading branch information
timrdf committed Oct 12, 2014
1 parent c8ddb19 commit 45d1519
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
30 changes: 24 additions & 6 deletions services/sadi/faqt/discuss/via-hypermail/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def process(self, input, output):
#print 'sleeping...'
#time.sleep(2)

print '- - - - - - - - -'
print 'processing ' + input.subject
print >> sys.stderr, '- - - - - - - - -'
print >> sys.stderr, 'processing ' + input.subject
base = re.sub('/[^/]*$','',input.subject)

Site = output.session.get_class(ns.SIOC['Site'])
Expand All @@ -105,7 +105,7 @@ def process(self, input, output):
groupR.save()
output.dcterms_hasPart.append(groupR)
output.save()
print group + ' ' + groupID
print >> sys.stderr, group + ' ' + groupID

# Get the body as prov:value: print soup.find('pre', {'id': 'body'}).findAll(text=True)

Expand All @@ -118,7 +118,25 @@ def process(self, input, output):
resource = W3CMailingListGroups()

# Used when this service is manually invoked from the command line (for testing).
#
# Usage: <input-rdf-file> [input-rdf-file-syntax] [output-rdf-file]
#
if __name__ == '__main__':
print resource.name + ' running on port ' + str(resource.dev_port) + '. Invoke it with:'
print 'curl -H "Content-Type: text/turtle" -d @my.ttl http://localhost:' + str(resource.dev_port) + '/' + resource.name
sadi.publishTwistedService(resource, port=resource.dev_port)
if len(sys.argv) == 0:
print resource.name + ' running on port ' + str(resource.dev_port) + '. Invoke it with:'
print 'curl -H "Content-Type: text/turtle" -d @my.ttl http://localhost:' + str(resource.dev_port) + '/' + resource.name
sadi.publishTwistedService(resource, port=resource.dev_port)
else:
reader= open(sys.argv[1],"r")
mimeType = "application/rdf+xml"
if len(sys.argv) > 2:
mimeType = sys.argv[2]
if len(sys.argv) > 3:
writer = open(sys.argv[3],"w")

graph = resource.processGraph(reader,mimeType)

if len(sys.argv) > 3:
writer.write(resource.serialize(graph,mimeType))
else:
print resource.serialize(graph,mimeType)
1 change: 1 addition & 0 deletions services/sadi/faqt/discuss/via-hypermail/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/timrdf/prov-wg/wiki/public-prov-wg-mailing-list

0 comments on commit 45d1519

Please sign in to comment.