added support for skos:editorialNote
authorSergio Fernandez <sergio.fernandez@fundacionctic.org>
Tue, 18 Oct 2011 11:34:21 +0200
changeset 171 22a60d8915ab
parent 170 16b30a1f5e9c
child 172 327e6763e79f
added support for skos:editorialNote
ontologies/rdfa/template_cert.html
ontologies/specgen/libvocab.py
--- a/ontologies/rdfa/template_cert.html	Tue Oct 18 10:22:36 2011 +0200
+++ b/ontologies/rdfa/template_cert.html	Tue Oct 18 11:34:21 2011 +0200
@@ -10,6 +10,7 @@
 xmlns:cert="http://www.w3.org/ns/auth/cert#"
 xmlns:foaf="http://xmlns.com/foaf/0.1/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+xmlns:skos="http://www.w3.org/2004/02/skos/core#"
 version="XHTML+RDFa 1.0" typeof="owl:Ontology" about="http://www.w3.org/ns/auth/cert#">
 <head>
 <title>The Cert Ontology Specification</title>
--- a/ontologies/specgen/libvocab.py	Tue Oct 18 10:22:36 2011 +0200
+++ b/ontologies/specgen/libvocab.py	Tue Oct 18 11:34:21 2011 +0200
@@ -70,6 +70,7 @@
 SIOC = Namespace('http://rdfs.org/sioc/ns#')
 SIOCTYPES = Namespace('http://rdfs.org/sioc/types#')
 SIOCSERVICES = Namespace('http://rdfs.org/sioc/services#')
+SKOS = Namespace('http://www.w3.org/2004/02/skos/core#')
 #
 # TODO: rationalise these two lists. or at least check they are same.
 
@@ -1073,7 +1074,7 @@
 
   			q = 'SELECT * WHERE { <%s> rdf:type <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> } ' % (term.uri)
   			relations = g.query(q)
-  			startStr = '<tr><th colspan="2">RDF Property</th>\n'
+  			startStr = '<tr><th>RDF Property</th>\n'
 
   			if (len(relations) > 0):
   				if (str(term.type) != "rdf:Property"):
@@ -1087,7 +1088,7 @@
 
   			q = 'SELECT * WHERE { <%s> rdf:type <http://www.w3.org/2002/07/owl#ObjectProperty> } ' % (term.uri)
   			relations = g.query(q)
-  			startStr = '<tr><th colspan="2">Object Property</th>\n'
+  			startStr = '<tr><th>Object Property</th>\n'
 
   			if (len(relations) > 0):
   				if (str(term.type) != "owl:ObjectProperty"):
@@ -1101,7 +1102,7 @@
 
   			q = 'SELECT * WHERE { <%s> rdf:type <http://www.w3.org/2002/07/owl#DatatypeProperty> } ' % (term.uri)
   			relations = g.query(q)
-  			startStr = '<tr><th colspan="2">Datatype Property</th>\n'
+  			startStr = '<tr><th>Datatype Property</th>\n'
 
   			if (len(relations) > 0):
   				if (str(term.type) != "owl:DatatypeProperty"):
@@ -1115,7 +1116,7 @@
 
   			q = 'SELECT * WHERE { <%s> rdf:type <http://www.w3.org/2002/07/owl#InverseFunctionalProperty> } ' % (term.uri)
   			relations = g.query(q)
-  			startStr = '<tr><th colspan="2">Inverse Functional Property</th>\n'
+  			startStr = '<tr><th>Inverse Functional Property</th>\n'
 
   			if (len(relations) > 0):
   				if (str(term.type) != "owl:InverseFunctionalProperty"):
@@ -1128,13 +1129,25 @@
 
   			q = 'SELECT * WHERE { <%s> rdf:type <http://www.w3.org/2002/07/owl#FunctionalProperty> } ' % (term.uri)
   			relations = g.query(q)
-  			startStr = '<tr><th colspan="2">Functional Property</th>\n'
+  			startStr = '<tr><th>Functional Property</th>\n'
 
   			if (len(relations) > 0):
   				if (str(term.type) != "owl:FunctionalProperty"):
   					termStr = """<span rel="rdf:type" href="http://www.w3.org/2002/07/owl#FunctionalProperty"></span>"""
   				fp = "%s <td> %s </td></tr>" % (startStr, termStr)
 
+  			# editorial note
+  			editorialNote = ""
+
+  			q = 'SELECT ?en WHERE { <%s> <http://www.w3.org/2004/02/skos/core#editorialNote> ?en } ' % (term.uri)
+  			editorialNotesResult = g.query(q)
+
+  			for (en) in editorialNotesResult:
+				startStr = '<tr style="vertical-align:text-top;"><th>Editorial Note</th>\n'
+				termStr = '<span property="skos:editorialNote">%s</span>' % en
+				editorialNote = "%s <td> %s </td></tr>" % (startStr, termStr)
+				break # we only want the first editorial note
+
   			# end
 
   			dn = os.path.join(self.basedir, "doc")
@@ -1151,7 +1164,7 @@
   			s = termlink(s)
 
   			# danbri added another term.id 20010101
-  			zz = eg % (term.id, term.uri, term.type, "Property", sn, term.label, term.comment, term.status, domainsOfProperty, rangesOfProperty + subPropertyOf + hasSubProperty + inverseOf + hasInverseProperty + propertyIsDefinedBy + rp + op + dp + ifp + fp, s, term.id, term.id)
+  			zz = eg % (term.id, term.uri, term.type, "Property", sn, term.label, term.comment, term.status, domainsOfProperty, rangesOfProperty + subPropertyOf + hasSubProperty + inverseOf + hasInverseProperty + propertyIsDefinedBy + rp + op + dp + ifp + fp + editorialNote, s, term.id, term.id)
 
   			## we add to the relevant string - stable, unstable, testing or archaic
   			if(term.status == "stable"):