[tracker] Doc: Include predefined instances in the class documentation



commit 1ac0e3fe316e22c05f2c487a869b5a8a1a7e429c
Author: Ivan Frade <ivan frade nokia com>
Date:   Mon Nov 23 13:59:26 2009 +0200

    Doc: Include predefined instances in the class documentation

 utils/services/ttl_html.c   |   23 +++++++++++++++++++++++
 utils/services/ttl_loader.c |    8 ++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/utils/services/ttl_html.c b/utils/services/ttl_html.c
index a11ad64..9039182 100644
--- a/utils/services/ttl_html.c
+++ b/utils/services/ttl_html.c
@@ -47,6 +47,21 @@ print_references_list (FILE *f, GList *list)
         g_fprintf (f,"</td>");
 }
 
+static void
+print_list (FILE *f, GList *list)
+{
+        GList *it;
+        gchar *shortname;
+
+
+        g_fprintf (f, "<td>");
+        for (it = list; it != NULL; it = it->next) {
+                shortname = qname_to_shortname ((gchar *)it->data);
+                g_fprintf (f, "%s%s", shortname, (it->next ? ", " : ""));
+                g_free (shortname);
+        }
+        g_fprintf (f, "</td>");
+}
 
 static void
 print_html_header (FILE *f, OntologyDescription *desc)
@@ -176,6 +191,14 @@ print_ontology_class (gpointer key, gpointer value, gpointer user_data)
         g_fprintf (f,"<td>%s</td>\n", (def->description ? def->description : "--"));
         g_fprintf (f,"</tr>\n");
 
+        if (def->instances) {
+                g_fprintf (f,"<tr>");
+                g_fprintf (f,"<td class=\"rowheader\">Predefined instances</td>");
+                print_list (f, def->instances);
+                g_fprintf (f,"</tr>\n");
+        }
+
+
         g_fprintf (f,"</table>\n\n");
 
 }
diff --git a/utils/services/ttl_loader.c b/utils/services/ttl_loader.c
index f8e7855..eef6478 100644
--- a/utils/services/ttl_loader.c
+++ b/utils/services/ttl_loader.c
@@ -54,6 +54,14 @@ load_in_memory (Ontology    *ontology,
                                              ttl_model_property_new (turtle_subject));
 
                 } else {
+                        /* xxx:a-default-instance a xxx:Class */
+                        OntologyClass *def;
+
+                        def = g_hash_table_lookup (ontology->classes, turtle_object);
+                        if (def) {
+                                def->instances = g_list_prepend (def->instances,
+                                                                 g_strdup (turtle_subject));
+                        }
                         /* g_print ("FIXME Ignoring %s %s %s\n",
                                  turtle_subject, turtle_predicate, turtle_object);
                         */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]