Beispiel #1
0
from dbpediaWrapper import DBPediaWrapper
import simplejson as json
from StringIO import StringIO
from Properties import Mapping
import random
from rdflib import Graph, Literal, BNode, Namespace, RDF, RDFS ,  URIRef
import pprint

wikiwrapper = DBPediaWrapper();


#Get a Result from the Wrapper (RDF Graph)
#rdfResult = wikiwrapper.getResults(Mapping.DISTANCE, 400000 ,10000)
rdfResult = wikiwrapper.getResults(Mapping.DISTANCE, 5000800, 10003000);



if rdfResult is not None:
	#rdfResult.serialize(destination='output.txt', format='turtle')

	for stmt in rdfResult:
		pprint.pprint(stmt)






Beispiel #2
0
#Generate Random Division 
orig_value = 45000000
upperBound = orig_value / 1000;
steps = orig_value / 100;
factor = random.randrange(1, upperBound,steps)
if factor == 0:
	factor = 1
value = orig_value  /factor
range = 0.15*value
print(factor)
print(value)


#Get a Result from the Wrapper (RDF Graph)
rdfResult = dpwarpper.getResults(Mapping.DISTANCE, 400000 ,10000)
#print(rdfResult)

if rdfResult is not None:
	rdfResult.serialize(destination='output.txt', format='turtle')

	for stmt in rdfResult:
		pprint.pprint(stmt)