comparison sparql.py @ 8:bf6b5640e0a8 draft

Uploaded
author sem4j
date Fri, 27 Sep 2013 02:59:16 -0400
parents dba28145ab27
children 2c9827b61b71
comparison
equal deleted inserted replaced
7:10c67e473958 8:bf6b5640e0a8
1 # sparql.py version:0.1
2 # USAGE: python sparql.py <str_select> <input_file> <output_file>
3
4 import sys, os, commands
5
6 argvs = sys.argv
7 if (len(argvs) != 4):
8 print 'Number of argv is incorrect'
9 quit()
10
11 out = open('query.tmp', 'w')
12 out.write(argvs[1])
13 out.close()
14
15 os.system('mv ' + argvs[2] + ' ' + argvs[2] + '.nt')
16 stdout = commands.getoutput('/Users/Ryota/Softwares/jena/apache-jena-2.11.0/bin/sparql --query=query.tmp --data=' + argvs[2] + '.nt -results=TSV')
17 os.system('mv ' + argvs[2] + '.nt ' + argvs[2])
18
19 out = open(argvs[3], 'w')
20 out.write(stdout)
21 out.close()