added support for directly generate specifications from n3 files
authorSergio Fernandez <sergio.fernandez@fundacionctic.org>
Thu, 20 Oct 2011 09:45:43 +0200
changeset 179 318b65255b9a
parent 178 bb952d3dab79
child 180 2816bade4b4f
added support for directly generate specifications from n3 files
ontologies/specgen/libvocab.py
--- a/ontologies/specgen/libvocab.py	Thu Oct 20 01:13:06 2011 +0200
+++ b/ontologies/specgen/libvocab.py	Thu Oct 20 09:45:43 2011 +0200
@@ -236,7 +236,12 @@
 		self.dir = dir
 		self.filename = os.path.join(dir, f)
 		# print "ontology file name ", self.filename 
-		self.graph.parse(self.filename)
+		if (self.filename.endswith(".n3")):
+			self.graph.parse(self.filename, format="n3")
+		elif(self.filename.endswith(".rdf")):
+			self.graph.parse(self.filename, format="xml")
+		else:
+			self.graph.parse(self.filename)
 		self.terms = []
 		self.uterms = []
 		# should also load translations here?
@@ -244,7 +249,8 @@
 
 		##if f != None:    
 		##  self.index()
-		self.ns_list = { "http://www.w3.org/1999/02/22-rdf-syntax-ns#"   : "rdf",
+		self.ns_list = { 
+					"http://www.w3.org/1999/02/22-rdf-syntax-ns#"   : "rdf",
 					"http://www.w3.org/2000/01/rdf-schema#"         : "rdfs",
 					"http://www.w3.org/2002/07/owl#"                : "owl",
 					"http://www.w3.org/2001/XMLSchema#"             : "xsd",