Esempio n. 1
0
	def __doTransform(self):
		"""Do the work."""

		uri = fixUri(self.uri)

		# Get template
		tplFile = getTemplate(self.uri)
		if not tplFile:
			print "Could not find matching template file for the URI."
			print "Uri was %s" % self.uri
			return False

		# TODO: Temp fix
		trypath = "./" + tplFile
		if exists(trypath):
			tplFile = trypath
		else:
			tplFile = "./web2rdf/" + tplFile

		self.webTransform = WebTransform(self.uri)

		# Web Cache logic
		cachef = CacheMap(self.uri)
		if not cachef.exists() or cachef.isExpired():
			self.webTransform.download()
			self.webTransform.saveHtml(cachef.getCacheFilename())
		else:
			self.webTransform.load(cachef.getCacheFilename())
		
		# Convert & save result
		self.webTransform.convertWithXslt(tplFile)