added support to owl:equivalentClass
authorSergio Fernandez <sergio.fernandez@fundacionctic.org>
Tue, 18 Oct 2011 14:09:35 +0200
changeset 172 327e6763e79f
parent 171 22a60d8915ab
child 173 a2e21cab1e34
added support to owl:equivalentClass
ontologies/specgen/libvocab.py
--- a/ontologies/specgen/libvocab.py	Tue Oct 18 11:34:21 2011 +0200
+++ b/ontologies/specgen/libvocab.py	Tue Oct 18 14:09:35 2011 +0200
@@ -261,6 +261,7 @@
 					"http://purl.org/ontology/co/core#"             : "co",
 					"http://purl.org/ontology/olo/core#"            : "olo",
 					"http://purl.org/ontology/is/core#"             : "is",
+					"http://xmlns.com/wot/0.1/"						: "wot",
 					"http://www.w3.org/ns/auth/cert#"               : "cert",
 					"http://www.w3.org/ns/auth/rsa#"                : "rsa"
 		}
@@ -750,6 +751,25 @@
   					hasSubClass = "%s <td> %s </td></tr>" % (startStr, contentStr)
 
 
+  			# equivalent class
+  			q = 'SELECT ?ec WHERE { <%s> <http://www.w3.org/2002/07/owl#equivalentClass> ?ec } ' % (term.uri)
+			print q
+  			equivalents = g.query(q)
+  			startStr = '<tr><th>Equivalent Class:</th>\n'
+  			contentStr = ''
+			equivalentClass = ''
+			print "Class: ", term.uri
+  			for (ec) in equivalents:
+  				cls = Term(ec)
+				print "Equivalent Class: ", cls.uri
+  				curie = "%s:%s" % (self.vocab.ns_list[cls.ns], cls.id)
+  				termStr = """<a href="#%s">%s</a>\n""" % (cls.id, curie)
+  				contentStr = "%s %s" % (contentStr, termStr)
+
+  			if (contentStr != ""):
+  				equivalentClass = "%s <td> %s </td></tr>" % (startStr, contentStr)
+
+
   			# is defined by
   			classIsDefinedBy = ''
 
@@ -835,7 +855,7 @@
   			s = termlink(s)
 
   			# danbri added another term.id 20010101 and removed term.status
-  			zz = eg % (term.id, term.uri, term.type, "Class", sn, term.label, term.comment, term.status, domainsOfClass, rangesOfClass + subClassOf + restriction + hasSubClass + classIsDefinedBy + isDisjointWith + oc + rc, s, term.id, term.id)
+  			zz = eg % (term.id, term.uri, term.type, "Class", sn, term.label, term.comment, term.status, domainsOfClass, rangesOfClass + subClassOf + restriction + hasSubClass + equivalentClass + classIsDefinedBy + isDisjointWith + oc + rc, s, term.id, term.id)
 
   			## we add to the relevant string - stable, unstable, testing or archaic
   			if(term.status == "stable"):