Merge lp:~mhr3/libzeitgeist/symbols into lp:libzeitgeist

Proposed by Michal Hruby
Status: Merged
Merged at revision: 159
Proposed branch: lp:~mhr3/libzeitgeist/symbols
Merge into: lp:libzeitgeist
Diff against target: 2181 lines (+2043/-1)
14 files modified
bindings/zeitgeist-1.0-custom.vala (+12/-0)
bindings/zeitgeist-1.0.gi (+30/-1)
bindings/zeitgeist-1.0.metadata (+4/-0)
bindings/zeitgeist-1.0.vapi (+11/-0)
doc/reference/zeitgeist-1.0-docs.sgml (+1/-0)
doc/reference/zeitgeist-1.0-sections.txt (+9/-0)
src/Makefile.am (+3/-0)
src/zeitgeist-symbols.c (+1389/-0)
src/zeitgeist-symbols.h (+42/-0)
src/zeitgeist.h (+1/-0)
tests/Makefile.am (+4/-0)
tests/test-symbols.c (+220/-0)
tools/symboltree2c.py (+107/-0)
tools/zeitgeist-symbols.template (+210/-0)
To merge this branch: bzr merge lp:~mhr3/libzeitgeist/symbols
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen Approve
Review via email: mp+32040@code.launchpad.net

Description of the change

First stab at a Symbol API, currently exposes only zeitgeist_symbol_is_a function, which can tell that a VECTOR_IMAGE is descendant of MEDIA etc. The C code is generated by the symboltree2c python script extracted from ZG ontology. I wonder if also other methods could be useful for libzg users?

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Nice! Some comments:

 1) I'd like to see a symbol_info_new() that takes ownership of the arguments since you introduce a lot of memory reallocation when building the symbol tree.

 2) Author in test-symbols.c is you, not me :-)

 3) I'd like to see get_children(), get_all_children(), and get_parents() as well. At least it is my experience that you quickly end up needing those once you start getting into it

 4) API documentation is needed for the public functions

 5) a VAPI update?

 6) Nice and thorough work on the unit tests!

review: Needs Fixing
lp:~mhr3/libzeitgeist/symbols updated
159. By Michal Hruby

Act upon review comments

Revision history for this message
Michal Hruby (mhr3) wrote :

Fixed 2) 3) 4) 5).

As for 1) I'm not inclined to make it take ownership, because it's taking GStrv, and therefore it'd suggest to free the data using g_strfreev(), but I pass static strings, so they don't need freeing. Also the SymbolInfo doesn't directly use the strings, it creates quarks from them.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Ok, I'll accept your choice on 1). One last nitpick :-)

The namespace for the VAPI should be Zeitgeist.Symbol.* that way it's consistent with how we expose the Zeitgeist.Timestamp.* namespace as well as closer to the Python API for zeitgeist.datamodel.Symbol

review: Needs Fixing
lp:~mhr3/libzeitgeist/symbols updated
160. By Michal Hruby

Move the functions to Zeitgeist.Symbol namespace

161. By Michal Hruby

Add new header to zeitgeist.h

Revision history for this message
Michal Hruby (mhr3) wrote :

Moved to Zeitgeist.Symbol namespace. Should be good to go. ;)

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Cool. Nice work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bindings/zeitgeist-1.0-custom.vala'
--- bindings/zeitgeist-1.0-custom.vala 2010-06-23 09:43:18 +0000
+++ bindings/zeitgeist-1.0-custom.vala 2010-08-09 22:06:44 +0000
@@ -32,6 +32,18 @@
32 }32 }
33}33}
3434
35namespace Zeitgeist.Symbol
36{
37 [CCode (cheader_filename = "zeitgeist.h")]
38 public static GLib.List<weak string> get_all_children (string symbol);
39 [CCode (cheader_filename = "zeitgeist.h")]
40 public static GLib.List<weak string> get_children (string symbol);
41 [CCode (cheader_filename = "zeitgeist.h")]
42 public static GLib.List<weak string> get_parents (string symbol);
43 [CCode (cheader_filename = "zeitgeist.h")]
44 public static bool is_a (string symbol, string parent);
45}
46
35namespace Zeitgeist.Timestamp47namespace Zeitgeist.Timestamp
36{48{
37 [CCode (cname = "ZEITGEIST_TIMESTAMP_SECOND", cheader_filename = "zeitgeist.h")]49 [CCode (cname = "ZEITGEIST_TIMESTAMP_SECOND", cheader_filename = "zeitgeist.h")]
3850
=== modified file 'bindings/zeitgeist-1.0.gi'
--- bindings/zeitgeist-1.0.gi 2010-07-23 13:21:14 +0000
+++ bindings/zeitgeist-1.0.gi 2010-08-09 22:06:44 +0000
@@ -34,6 +34,31 @@
34 <parameter name="manifestation_type" type="gchar*"/>34 <parameter name="manifestation_type" type="gchar*"/>
35 </parameters>35 </parameters>
36 </function>36 </function>
37 <function name="symbol_get_all_children" symbol="zeitgeist_symbol_get_all_children">
38 <return-type type="GList*"/>
39 <parameters>
40 <parameter name="symbol" type="gchar*"/>
41 </parameters>
42 </function>
43 <function name="symbol_get_children" symbol="zeitgeist_symbol_get_children">
44 <return-type type="GList*"/>
45 <parameters>
46 <parameter name="symbol" type="gchar*"/>
47 </parameters>
48 </function>
49 <function name="symbol_get_parents" symbol="zeitgeist_symbol_get_parents">
50 <return-type type="GList*"/>
51 <parameters>
52 <parameter name="symbol" type="gchar*"/>
53 </parameters>
54 </function>
55 <function name="symbol_is_a" symbol="zeitgeist_symbol_is_a">
56 <return-type type="gboolean"/>
57 <parameters>
58 <parameter name="symbol" type="gchar*"/>
59 <parameter name="parent" type="gchar*"/>
60 </parameters>
61 </function>
37 <function name="timestamp_for_now" symbol="zeitgeist_timestamp_for_now">62 <function name="timestamp_for_now" symbol="zeitgeist_timestamp_for_now">
38 <return-type type="gint64"/>63 <return-type type="gint64"/>
39 </function>64 </function>
@@ -105,7 +130,11 @@
105 <member name="ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ACTOR" value="6"/>130 <member name="ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ACTOR" value="6"/>
106 <member name="ZEITGEIST_RESULT_TYPE_LEAST_POPULAR_ACTOR" value="7"/>131 <member name="ZEITGEIST_RESULT_TYPE_LEAST_POPULAR_ACTOR" value="7"/>
107 <member name="ZEITGEIST_RESULT_TYPE_MOST_RECENT_ACTOR" value="8"/>132 <member name="ZEITGEIST_RESULT_TYPE_MOST_RECENT_ACTOR" value="8"/>
108 <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ACTOR" value="6"/>133 <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ACTOR" value="9"/>
134 <member name="ZEITGEIST_RESULT_TYPE_MOST_RECENT_ORIGIN" value="10"/>
135 <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ORIGIN" value="11"/>
136 <member name="ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ORIGIN" value="12"/>
137 <member name="ZEITGEIST_RESULT_TYPE_LEAST_POPULAR_ORIGIN" value="13"/>
109 <member name="ZEITGEIST_RESULT_TYPE_RELEVANCY" value="100"/>138 <member name="ZEITGEIST_RESULT_TYPE_RELEVANCY" value="100"/>
110 </enum>139 </enum>
111 <enum name="ZeitgeistStorageState" type-name="ZeitgeistStorageState" get-type="zeitgeist_storage_state_get_type">140 <enum name="ZeitgeistStorageState" type-name="ZeitgeistStorageState" get-type="zeitgeist_storage_state_get_type">
112141
=== modified file 'bindings/zeitgeist-1.0.metadata'
--- bindings/zeitgeist-1.0.metadata 2010-07-22 09:21:47 +0000
+++ bindings/zeitgeist-1.0.metadata 2010-08-09 22:06:44 +0000
@@ -40,6 +40,10 @@
40zeitgeist_event_set_payload.payload transfer_ownership="1"40zeitgeist_event_set_payload.payload transfer_ownership="1"
41zeitgeist_monitor_new.event_templates transfer_ownership="1"41zeitgeist_monitor_new.event_templates transfer_ownership="1"
4242
43Zeitgeist.Symbol cheader_filename="zeitgeist.h"
44zeitgeist_symbol_get* hidden="1" #transfer_ownership="1" type_arguments="unowned string"
45zeitgeist_symbol_is_a hidden="1"
46
43zeitgeist_data_source_registry_*.cancellable nullable="1"47zeitgeist_data_source_registry_*.cancellable nullable="1"
44zeitgeist_log_*.cancellable nullable="1"48zeitgeist_log_*.cancellable nullable="1"
45zeitgeist_index_*.cancellable nullable="1"49zeitgeist_index_*.cancellable nullable="1"
4650
=== modified file 'bindings/zeitgeist-1.0.vapi'
--- bindings/zeitgeist-1.0.vapi 2010-08-05 13:08:34 +0000
+++ bindings/zeitgeist-1.0.vapi 2010-08-09 22:06:44 +0000
@@ -2,6 +2,17 @@
22
3[CCode (cprefix = "Zeitgeist", lower_case_cprefix = "zeitgeist_")]3[CCode (cprefix = "Zeitgeist", lower_case_cprefix = "zeitgeist_")]
4namespace Zeitgeist {4namespace Zeitgeist {
5 [CCode (cprefix = "ZeitgeistSymbol", lower_case_cprefix = "zeitgeist_symbol_")]
6 namespace Symbol {
7 [CCode (cheader_filename = "zeitgeist.h")]
8 public static GLib.List<weak string> get_all_children (string symbol);
9 [CCode (cheader_filename = "zeitgeist.h")]
10 public static GLib.List<weak string> get_children (string symbol);
11 [CCode (cheader_filename = "zeitgeist.h")]
12 public static GLib.List<weak string> get_parents (string symbol);
13 [CCode (cheader_filename = "zeitgeist.h")]
14 public static bool is_a (string symbol, string parent);
15 }
5 [CCode (cprefix = "ZeitgeistTimestamp", lower_case_cprefix = "zeitgeist_timestamp_")]16 [CCode (cprefix = "ZeitgeistTimestamp", lower_case_cprefix = "zeitgeist_timestamp_")]
6 namespace Timestamp {17 namespace Timestamp {
7 [CCode (cname = "ZEITGEIST_TIMESTAMP_DAY", cheader_filename = "zeitgeist.h")]18 [CCode (cname = "ZEITGEIST_TIMESTAMP_DAY", cheader_filename = "zeitgeist.h")]
819
=== modified file 'doc/reference/zeitgeist-1.0-docs.sgml'
--- doc/reference/zeitgeist-1.0-docs.sgml 2010-07-22 18:08:43 +0000
+++ doc/reference/zeitgeist-1.0-docs.sgml 2010-08-09 22:06:44 +0000
@@ -23,6 +23,7 @@
23 <title>Utility Functions</title>23 <title>Utility Functions</title>
24 <xi:include href="xml/zeitgeist-mimetypes.xml"/>24 <xi:include href="xml/zeitgeist-mimetypes.xml"/>
25 <xi:include href="xml/zeitgeist-timestamp.xml"/>25 <xi:include href="xml/zeitgeist-timestamp.xml"/>
26 <xi:include href="xml/zeitgeist-symbols.xml"/>
26 </chapter>27 </chapter>
27 28
28 <chapter>29 <chapter>
2930
=== modified file 'doc/reference/zeitgeist-1.0-sections.txt'
--- doc/reference/zeitgeist-1.0-sections.txt 2010-07-22 18:08:43 +0000
+++ doc/reference/zeitgeist-1.0-sections.txt 2010-08-09 22:06:44 +0000
@@ -265,6 +265,15 @@
265</SECTION>265</SECTION>
266266
267<SECTION>267<SECTION>
268<FILE>zeitgeist-symbols</FILE>
269<TITLE>Symbol comprehension</TITLE>
270zeitgeist_symbol_get_parents
271zeitgeist_symbol_get_children
272zeitgeist_symbol_get_all_children
273zeitgeist_symbol_is_a
274</SECTION>
275
276<SECTION>
268<FILE>zeitgeist-ontology-interpretations</FILE>277<FILE>zeitgeist-ontology-interpretations</FILE>
269<TITLE>Interpretation Ontology</TITLE>278<TITLE>Interpretation Ontology</TITLE>
270ZEITGEIST_NCAL_ALARM279ZEITGEIST_NCAL_ALARM
271280
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-07-22 09:21:47 +0000
+++ src/Makefile.am 2010-08-09 22:06:44 +0000
@@ -134,6 +134,8 @@
134 zeitgeist-result-set.c \134 zeitgeist-result-set.c \
135 zeitgeist-subject.c \135 zeitgeist-subject.c \
136 zeitgeist-subject.h \136 zeitgeist-subject.h \
137 zeitgeist-symbols.c \
138 zeitgeist-symbols.h \
137 zeitgeist-timerange.c \139 zeitgeist-timerange.c \
138 zeitgeist-timerange.h \140 zeitgeist-timerange.h \
139 zeitgeist-timestamp.c \141 zeitgeist-timestamp.c \
@@ -165,6 +167,7 @@
165 zeitgeist-ontology-manifestations.h \167 zeitgeist-ontology-manifestations.h \
166 zeitgeist-result-set.h \168 zeitgeist-result-set.h \
167 zeitgeist-subject.h \169 zeitgeist-subject.h \
170 zeitgeist-symbols.h \
168 zeitgeist-timerange.h \171 zeitgeist-timerange.h \
169 zeitgeist-timestamp.h \172 zeitgeist-timestamp.h \
170 zeitgeist.h173 zeitgeist.h
171174
=== added file 'src/zeitgeist-symbols.c'
--- src/zeitgeist-symbols.c 1970-01-01 00:00:00 +0000
+++ src/zeitgeist-symbols.c 2010-08-09 22:06:44 +0000
@@ -0,0 +1,1389 @@
1/*
2 * Copyright (C) 2010 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License
6 * version 3.0 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License version 3.0 for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library. If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Michal Hruby <michal.mhr@gmail.com>
18 */
19
20/**
21 * SECTION:zeitgeist-symbols
22 * @short_description: Used to get information about Interpretation and/or
23 * Manifestation symbols
24 * @include: zeitgeist.h
25 */
26
27#include "zeitgeist-ontology-interpretations.h"
28#include "zeitgeist-ontology-manifestations.h"
29#include "zeitgeist-symbols.h"
30
31static void _ensure_symbols_loaded (void);
32
33static gboolean symbols_loaded = FALSE;
34static GHashTable *symbol_uris = NULL;
35
36typedef struct
37{
38 gchar *uri;
39 GSList *parents;
40 GSList *children;
41 GSList *all_children;
42} SymbolInfo;
43
44static SymbolInfo*
45symbol_info_new (gchar *uri,
46 GStrv parents,
47 GStrv children,
48 GStrv all_children)
49{
50 gchar *iter;
51 SymbolInfo *i = g_slice_new0 (SymbolInfo);
52 i->uri = g_strdup (uri);
53
54 while (*parents)
55 {
56 i->parents = g_slist_append (i->parents,
57 GINT_TO_POINTER (g_quark_from_string (*parents)));
58 parents++;
59 }
60
61 while (*children)
62 {
63 i->children = g_slist_append (i->children,
64 GINT_TO_POINTER (g_quark_from_string (*children)));
65 children++;
66 }
67
68 while (*all_children)
69 {
70 i->all_children = g_slist_append (i->all_children,
71 GINT_TO_POINTER (g_quark_from_string (*all_children)));
72 all_children++;
73 }
74
75 return i;
76}
77
78static void
79zeitgeist_register_symbol (SymbolInfo *i)
80{
81 if (symbol_uris == NULL)
82 symbol_uris = g_hash_table_new (g_str_hash, g_str_equal);
83
84 g_hash_table_insert (symbol_uris, i->uri, i);
85}
86
87/**
88 * zeitgeist_symbol_get_parents:
89 * @symbol: A symbol.
90 *
91 * Gets list of parents of the specified symbol.
92 *
93 * Returns: A newly allocated list of parents of this symbol.
94 * The data elements of the list contain strings which you
95 * do not own, use g_strdup() if you intend to work with them.
96 * Free the list with a call to g_list_free().
97 */
98GList*
99zeitgeist_symbol_get_parents (const gchar *symbol)
100{
101 GSList *iter;
102 GList *result = NULL;
103 g_return_val_if_fail (symbol != NULL, NULL);
104
105 _ensure_symbols_loaded ();
106
107 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
108 g_return_val_if_fail (info != NULL, NULL);
109
110 for (iter = info->parents; iter; iter = iter->next)
111 {
112 result = g_list_prepend (result,
113 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
114 }
115
116 return g_list_reverse (result);
117}
118
119/**
120 * zeitgeist_symbol_get_children:
121 * @symbol: A symbol.
122 *
123 * Gets list of direct children of the specified symbol.
124 *
125 * Returns: A newly allocated list of direct children of this symbol.
126 * The data elements of the list contain strings which you
127 * do not own, use g_strdup() if you intend to work with them.
128 * Free the list with a call to g_list_free().
129 */
130GList*
131zeitgeist_symbol_get_children (const gchar *symbol)
132{
133 GSList *iter;
134 GList *result = NULL;
135 g_return_val_if_fail (symbol != NULL, NULL);
136
137 _ensure_symbols_loaded ();
138
139 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
140 g_return_val_if_fail (info != NULL, NULL);
141
142 for (iter = info->children; iter; iter = iter->next)
143 {
144 result = g_list_prepend (result,
145 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
146 }
147
148 return g_list_reverse (result);
149}
150
151/**
152 * zeitgeist_symbol_get_all_children:
153 * @symbol: A symbol.
154 *
155 * Gets list of all children of the specified symbol.
156 *
157 * Returns: A newly allocated list of all children of this symbol (includes
158 * also children of children).
159 * The data elements of the list contain strings which you
160 * do not own, use g_strdup() if you intend to work with them.
161 * Free the list with a call to g_list_free().
162 */
163GList*
164zeitgeist_symbol_get_all_children (const gchar *symbol)
165{
166 GSList *iter;
167 GList *result = NULL;
168 g_return_val_if_fail (symbol != NULL, NULL);
169
170 _ensure_symbols_loaded ();
171
172 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
173 g_return_val_if_fail (info != NULL, NULL);
174
175 for (iter = info->all_children; iter; iter = iter->next)
176 {
177 result = g_list_prepend (result,
178 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
179 }
180
181 return g_list_reverse (result);
182}
183
184/**
185 * zeitgeist_symbol_is_a:
186 * @symbol: A symbol.
187 * @parent: Parent symbol.
188 *
189 * Determines if @symbol is child of @parent.
190 *
191 * Returns: True if @symbol is child of @parent (or equal to @parent),
192 * FALSE otherwise.
193 */
194gboolean
195zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent)
196{
197 if (parent == NULL || symbol == NULL) return FALSE;
198
199 _ensure_symbols_loaded ();
200
201 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, parent);
202 if (info == NULL) return FALSE;
203
204 GQuark symbol_quark = g_quark_try_string (symbol);
205 if (symbol_quark == 0) return FALSE;
206 // catch equal symbols
207 if (symbol_quark == g_quark_try_string (parent)) return TRUE;
208
209 return g_slist_find (info->all_children, GINT_TO_POINTER (symbol_quark)) != NULL;
210}
211
212static void
213_ensure_symbols_loaded (void)
214{
215 gchar **parents;
216 gchar **children;
217 gchar **all_children;
218 gchar *uri;
219 SymbolInfo *info;
220
221 if (symbols_loaded) return;
222
223 uri = ZEITGEIST_NFO_EXECUTABLE;
224 parents = g_new (char*, 1);
225 parents[0] = NULL;
226 children = g_new (char*, 1);
227 children[0] = NULL;
228 all_children = g_new (char*, 1);
229 all_children[0] = NULL;
230 info = symbol_info_new (uri, parents, children, all_children);
231 zeitgeist_register_symbol (info);
232 g_free (parents);
233 g_free (children);
234 g_free (all_children);
235
236 uri = ZEITGEIST_NFO_SPREADSHEET;
237 parents = g_new (char*, 2);
238 parents[0] = ZEITGEIST_NFO_DOCUMENT;
239 parents[1] = NULL;
240 children = g_new (char*, 1);
241 children[0] = NULL;
242 all_children = g_new (char*, 1);
243 all_children[0] = NULL;
244 info = symbol_info_new (uri, parents, children, all_children);
245 zeitgeist_register_symbol (info);
246 g_free (parents);
247 g_free (children);
248 g_free (all_children);
249
250 uri = ZEITGEIST_ZG_MODIFY_EVENT;
251 parents = g_new (char*, 2);
252 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
253 parents[1] = NULL;
254 children = g_new (char*, 1);
255 children[0] = NULL;
256 all_children = g_new (char*, 1);
257 all_children[0] = NULL;
258 info = symbol_info_new (uri, parents, children, all_children);
259 zeitgeist_register_symbol (info);
260 g_free (parents);
261 g_free (children);
262 g_free (all_children);
263
264 uri = ZEITGEIST_NFO_TRASH;
265 parents = g_new (char*, 2);
266 parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
267 parents[1] = NULL;
268 children = g_new (char*, 1);
269 children[0] = NULL;
270 all_children = g_new (char*, 1);
271 all_children[0] = NULL;
272 info = symbol_info_new (uri, parents, children, all_children);
273 zeitgeist_register_symbol (info);
274 g_free (parents);
275 g_free (children);
276 g_free (all_children);
277
278 uri = ZEITGEIST_NMO_MESSAGE;
279 parents = g_new (char*, 1);
280 parents[0] = NULL;
281 children = g_new (char*, 3);
282 children[0] = ZEITGEIST_NMO_EMAIL;
283 children[1] = ZEITGEIST_NMO_IMMESSAGE;
284 children[2] = NULL;
285 all_children = g_new (char*, 3);
286 all_children[0] = ZEITGEIST_NMO_EMAIL;
287 all_children[1] = ZEITGEIST_NMO_IMMESSAGE;
288 all_children[2] = NULL;
289 info = symbol_info_new (uri, parents, children, all_children);
290 zeitgeist_register_symbol (info);
291 g_free (parents);
292 g_free (children);
293 g_free (all_children);
294
295 uri = ZEITGEIST_NFO_WEBSITE;
296 parents = g_new (char*, 1);
297 parents[0] = NULL;
298 children = g_new (char*, 1);
299 children[0] = NULL;
300 all_children = g_new (char*, 1);
301 all_children[0] = NULL;
302 info = symbol_info_new (uri, parents, children, all_children);
303 zeitgeist_register_symbol (info);
304 g_free (parents);
305 g_free (children);
306 g_free (all_children);
307
308 uri = ZEITGEIST_NCAL_TODO;
309 parents = g_new (char*, 1);
310 parents[0] = NULL;
311 children = g_new (char*, 1);
312 children[0] = NULL;
313 all_children = g_new (char*, 1);
314 all_children[0] = NULL;
315 info = symbol_info_new (uri, parents, children, all_children);
316 zeitgeist_register_symbol (info);
317 g_free (parents);
318 g_free (children);
319 g_free (all_children);
320
321 uri = ZEITGEIST_ZG_CREATE_EVENT;
322 parents = g_new (char*, 2);
323 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
324 parents[1] = NULL;
325 children = g_new (char*, 1);
326 children[0] = NULL;
327 all_children = g_new (char*, 1);
328 all_children[0] = NULL;
329 info = symbol_info_new (uri, parents, children, all_children);
330 zeitgeist_register_symbol (info);
331 g_free (parents);
332 g_free (children);
333 g_free (all_children);
334
335 uri = ZEITGEIST_NFO_MEDIA_LIST;
336 parents = g_new (char*, 1);
337 parents[0] = NULL;
338 children = g_new (char*, 2);
339 children[0] = ZEITGEIST_NMM_MUSIC_ALBUM;
340 children[1] = NULL;
341 all_children = g_new (char*, 2);
342 all_children[0] = ZEITGEIST_NMM_MUSIC_ALBUM;
343 all_children[1] = NULL;
344 info = symbol_info_new (uri, parents, children, all_children);
345 zeitgeist_register_symbol (info);
346 g_free (parents);
347 g_free (children);
348 g_free (all_children);
349
350 uri = ZEITGEIST_NFO_FILESYSTEM;
351 parents = g_new (char*, 2);
352 parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
353 parents[1] = NULL;
354 children = g_new (char*, 2);
355 children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
356 children[1] = NULL;
357 all_children = g_new (char*, 2);
358 all_children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
359 all_children[1] = NULL;
360 info = symbol_info_new (uri, parents, children, all_children);
361 zeitgeist_register_symbol (info);
362 g_free (parents);
363 g_free (children);
364 g_free (all_children);
365
366 uri = ZEITGEIST_NFO_MIND_MAP;
367 parents = g_new (char*, 2);
368 parents[0] = ZEITGEIST_NFO_DOCUMENT;
369 parents[1] = NULL;
370 children = g_new (char*, 1);
371 children[0] = NULL;
372 all_children = g_new (char*, 1);
373 all_children[0] = NULL;
374 info = symbol_info_new (uri, parents, children, all_children);
375 zeitgeist_register_symbol (info);
376 g_free (parents);
377 g_free (children);
378 g_free (all_children);
379
380 uri = ZEITGEIST_NCAL_CALENDAR;
381 parents = g_new (char*, 1);
382 parents[0] = NULL;
383 children = g_new (char*, 1);
384 children[0] = NULL;
385 all_children = g_new (char*, 1);
386 all_children[0] = NULL;
387 info = symbol_info_new (uri, parents, children, all_children);
388 zeitgeist_register_symbol (info);
389 g_free (parents);
390 g_free (children);
391 g_free (all_children);
392
393 uri = ZEITGEIST_NFO_BOOKMARK;
394 parents = g_new (char*, 1);
395 parents[0] = NULL;
396 children = g_new (char*, 1);
397 children[0] = NULL;
398 all_children = g_new (char*, 1);
399 all_children[0] = NULL;
400 info = symbol_info_new (uri, parents, children, all_children);
401 zeitgeist_register_symbol (info);
402 g_free (parents);
403 g_free (children);
404 g_free (all_children);
405
406 uri = ZEITGEIST_NMO_IMMESSAGE;
407 parents = g_new (char*, 2);
408 parents[0] = ZEITGEIST_NMO_MESSAGE;
409 parents[1] = NULL;
410 children = g_new (char*, 1);
411 children[0] = NULL;
412 all_children = g_new (char*, 1);
413 all_children[0] = NULL;
414 info = symbol_info_new (uri, parents, children, all_children);
415 zeitgeist_register_symbol (info);
416 g_free (parents);
417 g_free (children);
418 g_free (all_children);
419
420 uri = ZEITGEIST_NCAL_EVENT;
421 parents = g_new (char*, 1);
422 parents[0] = NULL;
423 children = g_new (char*, 1);
424 children[0] = NULL;
425 all_children = g_new (char*, 1);
426 all_children[0] = NULL;
427 info = symbol_info_new (uri, parents, children, all_children);
428 zeitgeist_register_symbol (info);
429 g_free (parents);
430 g_free (children);
431 g_free (all_children);
432
433 uri = ZEITGEIST_ZG_LEAVE_EVENT;
434 parents = g_new (char*, 2);
435 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
436 parents[1] = NULL;
437 children = g_new (char*, 1);
438 children[0] = NULL;
439 all_children = g_new (char*, 1);
440 all_children[0] = NULL;
441 info = symbol_info_new (uri, parents, children, all_children);
442 zeitgeist_register_symbol (info);
443 g_free (parents);
444 g_free (children);
445 g_free (all_children);
446
447 uri = ZEITGEIST_NFO_ARCHIVE;
448 parents = g_new (char*, 2);
449 parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
450 parents[1] = NULL;
451 children = g_new (char*, 1);
452 children[0] = NULL;
453 all_children = g_new (char*, 1);
454 all_children[0] = NULL;
455 info = symbol_info_new (uri, parents, children, all_children);
456 zeitgeist_register_symbol (info);
457 g_free (parents);
458 g_free (children);
459 g_free (all_children);
460
461 uri = ZEITGEIST_ZG_ACCESS_EVENT;
462 parents = g_new (char*, 2);
463 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
464 parents[1] = NULL;
465 children = g_new (char*, 1);
466 children[0] = NULL;
467 all_children = g_new (char*, 1);
468 all_children[0] = NULL;
469 info = symbol_info_new (uri, parents, children, all_children);
470 zeitgeist_register_symbol (info);
471 g_free (parents);
472 g_free (children);
473 g_free (all_children);
474
475 uri = ZEITGEIST_NFO_VECTOR_IMAGE;
476 parents = g_new (char*, 2);
477 parents[0] = ZEITGEIST_NFO_IMAGE;
478 parents[1] = NULL;
479 children = g_new (char*, 1);
480 children[0] = NULL;
481 all_children = g_new (char*, 1);
482 all_children[0] = NULL;
483 info = symbol_info_new (uri, parents, children, all_children);
484 zeitgeist_register_symbol (info);
485 g_free (parents);
486 g_free (children);
487 g_free (all_children);
488
489 uri = ZEITGEIST_NFO_CURSOR;
490 parents = g_new (char*, 2);
491 parents[0] = ZEITGEIST_NFO_RASTER_IMAGE;
492 parents[1] = NULL;
493 children = g_new (char*, 1);
494 children[0] = NULL;
495 all_children = g_new (char*, 1);
496 all_children[0] = NULL;
497 info = symbol_info_new (uri, parents, children, all_children);
498 zeitgeist_register_symbol (info);
499 g_free (parents);
500 g_free (children);
501 g_free (all_children);
502
503 uri = ZEITGEIST_NFO_VIDEO;
504 parents = g_new (char*, 2);
505 parents[0] = ZEITGEIST_NFO_VISUAL;
506 parents[1] = NULL;
507 children = g_new (char*, 3);
508 children[0] = ZEITGEIST_NMM_TVSHOW;
509 children[1] = ZEITGEIST_NMM_MOVIE;
510 children[2] = NULL;
511 all_children = g_new (char*, 3);
512 all_children[0] = ZEITGEIST_NMM_TVSHOW;
513 all_children[1] = ZEITGEIST_NMM_MOVIE;
514 all_children[2] = NULL;
515 info = symbol_info_new (uri, parents, children, all_children);
516 zeitgeist_register_symbol (info);
517 g_free (parents);
518 g_free (children);
519 g_free (all_children);
520
521 uri = ZEITGEIST_NFO_BOOKMARK_FOLDER;
522 parents = g_new (char*, 1);
523 parents[0] = NULL;
524 children = g_new (char*, 1);
525 children[0] = NULL;
526 all_children = g_new (char*, 1);
527 all_children[0] = NULL;
528 info = symbol_info_new (uri, parents, children, all_children);
529 zeitgeist_register_symbol (info);
530 g_free (parents);
531 g_free (children);
532 g_free (all_children);
533
534 uri = ZEITGEIST_NFO_HTML_DOCUMENT;
535 parents = g_new (char*, 2);
536 parents[0] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
537 parents[1] = NULL;
538 children = g_new (char*, 1);
539 children[0] = NULL;
540 all_children = g_new (char*, 1);
541 all_children[0] = NULL;
542 info = symbol_info_new (uri, parents, children, all_children);
543 zeitgeist_register_symbol (info);
544 g_free (parents);
545 g_free (children);
546 g_free (all_children);
547
548 uri = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
549 parents = g_new (char*, 2);
550 parents[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
551 parents[1] = NULL;
552 children = g_new (char*, 3);
553 children[0] = ZEITGEIST_NFO_SOURCE_CODE;
554 children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
555 children[2] = NULL;
556 all_children = g_new (char*, 3);
557 all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
558 all_children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
559 all_children[2] = NULL;
560 info = symbol_info_new (uri, parents, children, all_children);
561 zeitgeist_register_symbol (info);
562 g_free (parents);
563 g_free (children);
564 g_free (all_children);
565
566 uri = ZEITGEIST_NFO_FONT;
567 parents = g_new (char*, 1);
568 parents[0] = NULL;
569 children = g_new (char*, 1);
570 children[0] = NULL;
571 all_children = g_new (char*, 1);
572 all_children[0] = NULL;
573 info = symbol_info_new (uri, parents, children, all_children);
574 zeitgeist_register_symbol (info);
575 g_free (parents);
576 g_free (children);
577 g_free (all_children);
578
579 uri = ZEITGEIST_NFO_DATA_CONTAINER;
580 parents = g_new (char*, 1);
581 parents[0] = NULL;
582 children = g_new (char*, 5);
583 children[0] = ZEITGEIST_NFO_FILESYSTEM;
584 children[1] = ZEITGEIST_NFO_ARCHIVE;
585 children[2] = ZEITGEIST_NFO_FOLDER;
586 children[3] = ZEITGEIST_NFO_TRASH;
587 children[4] = NULL;
588 all_children = g_new (char*, 6);
589 all_children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
590 all_children[1] = ZEITGEIST_NFO_ARCHIVE;
591 all_children[2] = ZEITGEIST_NFO_FOLDER;
592 all_children[3] = ZEITGEIST_NFO_TRASH;
593 all_children[4] = ZEITGEIST_NFO_FILESYSTEM;
594 all_children[5] = NULL;
595 info = symbol_info_new (uri, parents, children, all_children);
596 zeitgeist_register_symbol (info);
597 g_free (parents);
598 g_free (children);
599 g_free (all_children);
600
601 uri = ZEITGEIST_NFO_RASTER_IMAGE;
602 parents = g_new (char*, 2);
603 parents[0] = ZEITGEIST_NFO_IMAGE;
604 parents[1] = NULL;
605 children = g_new (char*, 2);
606 children[0] = ZEITGEIST_NFO_CURSOR;
607 children[1] = NULL;
608 all_children = g_new (char*, 2);
609 all_children[0] = ZEITGEIST_NFO_CURSOR;
610 all_children[1] = NULL;
611 info = symbol_info_new (uri, parents, children, all_children);
612 zeitgeist_register_symbol (info);
613 g_free (parents);
614 g_free (children);
615 g_free (all_children);
616
617 uri = ZEITGEIST_NFO_IMAGE;
618 parents = g_new (char*, 2);
619 parents[0] = ZEITGEIST_NFO_VISUAL;
620 parents[1] = NULL;
621 children = g_new (char*, 4);
622 children[0] = ZEITGEIST_NFO_ICON;
623 children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
624 children[2] = ZEITGEIST_NFO_RASTER_IMAGE;
625 children[3] = NULL;
626 all_children = g_new (char*, 5);
627 all_children[0] = ZEITGEIST_NFO_ICON;
628 all_children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
629 all_children[2] = ZEITGEIST_NFO_CURSOR;
630 all_children[3] = ZEITGEIST_NFO_RASTER_IMAGE;
631 all_children[4] = NULL;
632 info = symbol_info_new (uri, parents, children, all_children);
633 zeitgeist_register_symbol (info);
634 g_free (parents);
635 g_free (children);
636 g_free (all_children);
637
638 uri = ZEITGEIST_ZG_EVENT_INTERPRETATION;
639 parents = g_new (char*, 1);
640 parents[0] = NULL;
641 children = g_new (char*, 8);
642 children[0] = ZEITGEIST_ZG_LEAVE_EVENT;
643 children[1] = ZEITGEIST_ZG_MODIFY_EVENT;
644 children[2] = ZEITGEIST_ZG_CREATE_EVENT;
645 children[3] = ZEITGEIST_ZG_SEND_EVENT;
646 children[4] = ZEITGEIST_ZG_ACCESS_EVENT;
647 children[5] = ZEITGEIST_ZG_DELETE_EVENT;
648 children[6] = ZEITGEIST_ZG_RECEIVE_EVENT;
649 children[7] = NULL;
650 all_children = g_new (char*, 8);
651 all_children[0] = ZEITGEIST_ZG_LEAVE_EVENT;
652 all_children[1] = ZEITGEIST_ZG_MODIFY_EVENT;
653 all_children[2] = ZEITGEIST_ZG_CREATE_EVENT;
654 all_children[3] = ZEITGEIST_ZG_SEND_EVENT;
655 all_children[4] = ZEITGEIST_ZG_ACCESS_EVENT;
656 all_children[5] = ZEITGEIST_ZG_DELETE_EVENT;
657 all_children[6] = ZEITGEIST_ZG_RECEIVE_EVENT;
658 all_children[7] = NULL;
659 info = symbol_info_new (uri, parents, children, all_children);
660 zeitgeist_register_symbol (info);
661 g_free (parents);
662 g_free (children);
663 g_free (all_children);
664
665 uri = ZEITGEIST_ZG_SEND_EVENT;
666 parents = g_new (char*, 2);
667 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
668 parents[1] = NULL;
669 children = g_new (char*, 1);
670 children[0] = NULL;
671 all_children = g_new (char*, 1);
672 all_children[0] = NULL;
673 info = symbol_info_new (uri, parents, children, all_children);
674 zeitgeist_register_symbol (info);
675 g_free (parents);
676 g_free (children);
677 g_free (all_children);
678
679 uri = ZEITGEIST_NFO_APPLICATION;
680 parents = g_new (char*, 2);
681 parents[0] = ZEITGEIST_NFO_SOFTWARE;
682 parents[1] = NULL;
683 children = g_new (char*, 1);
684 children[0] = NULL;
685 all_children = g_new (char*, 1);
686 all_children[0] = NULL;
687 info = symbol_info_new (uri, parents, children, all_children);
688 zeitgeist_register_symbol (info);
689 g_free (parents);
690 g_free (children);
691 g_free (all_children);
692
693 uri = ZEITGEIST_NFO_DOCUMENT;
694 parents = g_new (char*, 1);
695 parents[0] = NULL;
696 children = g_new (char*, 5);
697 children[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
698 children[1] = ZEITGEIST_NFO_PRESENTATION;
699 children[2] = ZEITGEIST_NFO_MIND_MAP;
700 children[3] = ZEITGEIST_NFO_SPREADSHEET;
701 children[4] = NULL;
702 all_children = g_new (char*, 9);
703 all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
704 all_children[1] = ZEITGEIST_NFO_SPREADSHEET;
705 all_children[2] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
706 all_children[3] = ZEITGEIST_NFO_TEXT_DOCUMENT;
707 all_children[4] = ZEITGEIST_NFO_HTML_DOCUMENT;
708 all_children[5] = ZEITGEIST_NFO_MIND_MAP;
709 all_children[6] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
710 all_children[7] = ZEITGEIST_NFO_PRESENTATION;
711 all_children[8] = NULL;
712 info = symbol_info_new (uri, parents, children, all_children);
713 zeitgeist_register_symbol (info);
714 g_free (parents);
715 g_free (children);
716 g_free (all_children);
717
718 uri = ZEITGEIST_NMM_MUSIC_PIECE;
719 parents = g_new (char*, 2);
720 parents[0] = ZEITGEIST_NFO_MEDIA;
721 parents[1] = NULL;
722 children = g_new (char*, 1);
723 children[0] = NULL;
724 all_children = g_new (char*, 1);
725 all_children[0] = NULL;
726 info = symbol_info_new (uri, parents, children, all_children);
727 zeitgeist_register_symbol (info);
728 g_free (parents);
729 g_free (children);
730 g_free (all_children);
731
732 uri = ZEITGEIST_NMO_MAILBOX;
733 parents = g_new (char*, 1);
734 parents[0] = NULL;
735 children = g_new (char*, 1);
736 children[0] = NULL;
737 all_children = g_new (char*, 1);
738 all_children[0] = NULL;
739 info = symbol_info_new (uri, parents, children, all_children);
740 zeitgeist_register_symbol (info);
741 g_free (parents);
742 g_free (children);
743 g_free (all_children);
744
745 uri = ZEITGEIST_NFO_TEXT_DOCUMENT;
746 parents = g_new (char*, 2);
747 parents[0] = ZEITGEIST_NFO_DOCUMENT;
748 parents[1] = NULL;
749 children = g_new (char*, 3);
750 children[0] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
751 children[1] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
752 children[2] = NULL;
753 all_children = g_new (char*, 5);
754 all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
755 all_children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
756 all_children[2] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
757 all_children[3] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
758 all_children[4] = NULL;
759 info = symbol_info_new (uri, parents, children, all_children);
760 zeitgeist_register_symbol (info);
761 g_free (parents);
762 g_free (children);
763 g_free (all_children);
764
765 uri = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
766 parents = g_new (char*, 2);
767 parents[0] = ZEITGEIST_NFO_FILESYSTEM;
768 parents[1] = NULL;
769 children = g_new (char*, 1);
770 children[0] = NULL;
771 all_children = g_new (char*, 1);
772 all_children[0] = NULL;
773 info = symbol_info_new (uri, parents, children, all_children);
774 zeitgeist_register_symbol (info);
775 g_free (parents);
776 g_free (children);
777 g_free (all_children);
778
779 uri = ZEITGEIST_NCAL_JOURNAL;
780 parents = g_new (char*, 1);
781 parents[0] = NULL;
782 children = g_new (char*, 1);
783 children[0] = NULL;
784 all_children = g_new (char*, 1);
785 all_children[0] = NULL;
786 info = symbol_info_new (uri, parents, children, all_children);
787 zeitgeist_register_symbol (info);
788 g_free (parents);
789 g_free (children);
790 g_free (all_children);
791
792 uri = ZEITGEIST_NFO_ICON;
793 parents = g_new (char*, 2);
794 parents[0] = ZEITGEIST_NFO_IMAGE;
795 parents[1] = NULL;
796 children = g_new (char*, 1);
797 children[0] = NULL;
798 all_children = g_new (char*, 1);
799 all_children[0] = NULL;
800 info = symbol_info_new (uri, parents, children, all_children);
801 zeitgeist_register_symbol (info);
802 g_free (parents);
803 g_free (children);
804 g_free (all_children);
805
806 uri = ZEITGEIST_NFO_PRESENTATION;
807 parents = g_new (char*, 2);
808 parents[0] = ZEITGEIST_NFO_DOCUMENT;
809 parents[1] = NULL;
810 children = g_new (char*, 1);
811 children[0] = NULL;
812 all_children = g_new (char*, 1);
813 all_children[0] = NULL;
814 info = symbol_info_new (uri, parents, children, all_children);
815 zeitgeist_register_symbol (info);
816 g_free (parents);
817 g_free (children);
818 g_free (all_children);
819
820 uri = ZEITGEIST_NMM_MUSIC_ALBUM;
821 parents = g_new (char*, 2);
822 parents[0] = ZEITGEIST_NFO_MEDIA_LIST;
823 parents[1] = NULL;
824 children = g_new (char*, 1);
825 children[0] = NULL;
826 all_children = g_new (char*, 1);
827 all_children[0] = NULL;
828 info = symbol_info_new (uri, parents, children, all_children);
829 zeitgeist_register_symbol (info);
830 g_free (parents);
831 g_free (children);
832 g_free (all_children);
833
834 uri = ZEITGEIST_NFO_SOURCE_CODE;
835 parents = g_new (char*, 2);
836 parents[0] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
837 parents[1] = NULL;
838 children = g_new (char*, 1);
839 children[0] = NULL;
840 all_children = g_new (char*, 1);
841 all_children[0] = NULL;
842 info = symbol_info_new (uri, parents, children, all_children);
843 zeitgeist_register_symbol (info);
844 g_free (parents);
845 g_free (children);
846 g_free (all_children);
847
848 uri = ZEITGEIST_NFO_VISUAL;
849 parents = g_new (char*, 2);
850 parents[0] = ZEITGEIST_NFO_MEDIA;
851 parents[1] = NULL;
852 children = g_new (char*, 3);
853 children[0] = ZEITGEIST_NFO_IMAGE;
854 children[1] = ZEITGEIST_NFO_VIDEO;
855 children[2] = NULL;
856 all_children = g_new (char*, 9);
857 all_children[0] = ZEITGEIST_NMM_TVSHOW;
858 all_children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
859 all_children[2] = ZEITGEIST_NFO_VIDEO;
860 all_children[3] = ZEITGEIST_NMM_MOVIE;
861 all_children[4] = ZEITGEIST_NFO_CURSOR;
862 all_children[5] = ZEITGEIST_NFO_ICON;
863 all_children[6] = ZEITGEIST_NFO_IMAGE;
864 all_children[7] = ZEITGEIST_NFO_RASTER_IMAGE;
865 all_children[8] = NULL;
866 info = symbol_info_new (uri, parents, children, all_children);
867 zeitgeist_register_symbol (info);
868 g_free (parents);
869 g_free (children);
870 g_free (all_children);
871
872 uri = ZEITGEIST_NMO_EMAIL;
873 parents = g_new (char*, 2);
874 parents[0] = ZEITGEIST_NMO_MESSAGE;
875 parents[1] = NULL;
876 children = g_new (char*, 1);
877 children[0] = NULL;
878 all_children = g_new (char*, 1);
879 all_children[0] = NULL;
880 info = symbol_info_new (uri, parents, children, all_children);
881 zeitgeist_register_symbol (info);
882 g_free (parents);
883 g_free (children);
884 g_free (all_children);
885
886 uri = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
887 parents = g_new (char*, 2);
888 parents[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
889 parents[1] = NULL;
890 children = g_new (char*, 1);
891 children[0] = NULL;
892 all_children = g_new (char*, 1);
893 all_children[0] = NULL;
894 info = symbol_info_new (uri, parents, children, all_children);
895 zeitgeist_register_symbol (info);
896 g_free (parents);
897 g_free (children);
898 g_free (all_children);
899
900 uri = ZEITGEIST_NMM_TVSHOW;
901 parents = g_new (char*, 2);
902 parents[0] = ZEITGEIST_NFO_VIDEO;
903 parents[1] = NULL;
904 children = g_new (char*, 1);
905 children[0] = NULL;
906 all_children = g_new (char*, 1);
907 all_children[0] = NULL;
908 info = symbol_info_new (uri, parents, children, all_children);
909 zeitgeist_register_symbol (info);
910 g_free (parents);
911 g_free (children);
912 g_free (all_children);
913
914 uri = ZEITGEIST_NMM_TVSERIES;
915 parents = g_new (char*, 1);
916 parents[0] = NULL;
917 children = g_new (char*, 1);
918 children[0] = NULL;
919 all_children = g_new (char*, 1);
920 all_children[0] = NULL;
921 info = symbol_info_new (uri, parents, children, all_children);
922 zeitgeist_register_symbol (info);
923 g_free (parents);
924 g_free (children);
925 g_free (all_children);
926
927 uri = ZEITGEIST_NFO_AUDIO;
928 parents = g_new (char*, 2);
929 parents[0] = ZEITGEIST_NFO_MEDIA;
930 parents[1] = NULL;
931 children = g_new (char*, 1);
932 children[0] = NULL;
933 all_children = g_new (char*, 1);
934 all_children[0] = NULL;
935 info = symbol_info_new (uri, parents, children, all_children);
936 zeitgeist_register_symbol (info);
937 g_free (parents);
938 g_free (children);
939 g_free (all_children);
940
941 uri = ZEITGEIST_NFO_OPERATING_SYSTEM;
942 parents = g_new (char*, 2);
943 parents[0] = ZEITGEIST_NFO_SOFTWARE;
944 parents[1] = NULL;
945 children = g_new (char*, 1);
946 children[0] = NULL;
947 all_children = g_new (char*, 1);
948 all_children[0] = NULL;
949 info = symbol_info_new (uri, parents, children, all_children);
950 zeitgeist_register_symbol (info);
951 g_free (parents);
952 g_free (children);
953 g_free (all_children);
954
955 uri = ZEITGEIST_NFO_SOFTWARE;
956 parents = g_new (char*, 1);
957 parents[0] = NULL;
958 children = g_new (char*, 3);
959 children[0] = ZEITGEIST_NFO_APPLICATION;
960 children[1] = ZEITGEIST_NFO_OPERATING_SYSTEM;
961 children[2] = NULL;
962 all_children = g_new (char*, 3);
963 all_children[0] = ZEITGEIST_NFO_OPERATING_SYSTEM;
964 all_children[1] = ZEITGEIST_NFO_APPLICATION;
965 all_children[2] = NULL;
966 info = symbol_info_new (uri, parents, children, all_children);
967 zeitgeist_register_symbol (info);
968 g_free (parents);
969 g_free (children);
970 g_free (all_children);
971
972 uri = ZEITGEIST_NMM_MOVIE;
973 parents = g_new (char*, 2);
974 parents[0] = ZEITGEIST_NFO_VIDEO;
975 parents[1] = NULL;
976 children = g_new (char*, 1);
977 children[0] = NULL;
978 all_children = g_new (char*, 1);
979 all_children[0] = NULL;
980 info = symbol_info_new (uri, parents, children, all_children);
981 zeitgeist_register_symbol (info);
982 g_free (parents);
983 g_free (children);
984 g_free (all_children);
985
986 uri = ZEITGEIST_NCAL_TIMEZONE;
987 parents = g_new (char*, 1);
988 parents[0] = NULL;
989 children = g_new (char*, 1);
990 children[0] = NULL;
991 all_children = g_new (char*, 1);
992 all_children[0] = NULL;
993 info = symbol_info_new (uri, parents, children, all_children);
994 zeitgeist_register_symbol (info);
995 g_free (parents);
996 g_free (children);
997 g_free (all_children);
998
999 uri = ZEITGEIST_NCAL_ALARM;
1000 parents = g_new (char*, 1);
1001 parents[0] = NULL;
1002 children = g_new (char*, 1);
1003 children[0] = NULL;
1004 all_children = g_new (char*, 1);
1005 all_children[0] = NULL;
1006 info = symbol_info_new (uri, parents, children, all_children);
1007 zeitgeist_register_symbol (info);
1008 g_free (parents);
1009 g_free (children);
1010 g_free (all_children);
1011
1012 uri = ZEITGEIST_NFO_FOLDER;
1013 parents = g_new (char*, 2);
1014 parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
1015 parents[1] = NULL;
1016 children = g_new (char*, 1);
1017 children[0] = NULL;
1018 all_children = g_new (char*, 1);
1019 all_children[0] = NULL;
1020 info = symbol_info_new (uri, parents, children, all_children);
1021 zeitgeist_register_symbol (info);
1022 g_free (parents);
1023 g_free (children);
1024 g_free (all_children);
1025
1026 uri = ZEITGEIST_NMO_MIME_ENTITY;
1027 parents = g_new (char*, 1);
1028 parents[0] = NULL;
1029 children = g_new (char*, 1);
1030 children[0] = NULL;
1031 all_children = g_new (char*, 1);
1032 all_children[0] = NULL;
1033 info = symbol_info_new (uri, parents, children, all_children);
1034 zeitgeist_register_symbol (info);
1035 g_free (parents);
1036 g_free (children);
1037 g_free (all_children);
1038
1039 uri = ZEITGEIST_NCAL_FREEBUSY;
1040 parents = g_new (char*, 1);
1041 parents[0] = NULL;
1042 children = g_new (char*, 1);
1043 children[0] = NULL;
1044 all_children = g_new (char*, 1);
1045 all_children[0] = NULL;
1046 info = symbol_info_new (uri, parents, children, all_children);
1047 zeitgeist_register_symbol (info);
1048 g_free (parents);
1049 g_free (children);
1050 g_free (all_children);
1051
1052 uri = ZEITGEIST_NFO_MEDIA;
1053 parents = g_new (char*, 1);
1054 parents[0] = NULL;
1055 children = g_new (char*, 4);
1056 children[0] = ZEITGEIST_NFO_VISUAL;
1057 children[1] = ZEITGEIST_NFO_AUDIO;
1058 children[2] = ZEITGEIST_NMM_MUSIC_PIECE;
1059 children[3] = NULL;
1060 all_children = g_new (char*, 12);
1061 all_children[0] = ZEITGEIST_NMM_TVSHOW;
1062 all_children[1] = ZEITGEIST_NMM_MUSIC_PIECE;
1063 all_children[2] = ZEITGEIST_NFO_AUDIO;
1064 all_children[3] = ZEITGEIST_NFO_VECTOR_IMAGE;
1065 all_children[4] = ZEITGEIST_NFO_VIDEO;
1066 all_children[5] = ZEITGEIST_NMM_MOVIE;
1067 all_children[6] = ZEITGEIST_NFO_VISUAL;
1068 all_children[7] = ZEITGEIST_NFO_CURSOR;
1069 all_children[8] = ZEITGEIST_NFO_ICON;
1070 all_children[9] = ZEITGEIST_NFO_IMAGE;
1071 all_children[10] = ZEITGEIST_NFO_RASTER_IMAGE;
1072 all_children[11] = NULL;
1073 info = symbol_info_new (uri, parents, children, all_children);
1074 zeitgeist_register_symbol (info);
1075 g_free (parents);
1076 g_free (children);
1077 g_free (all_children);
1078
1079 uri = ZEITGEIST_ZG_DELETE_EVENT;
1080 parents = g_new (char*, 2);
1081 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
1082 parents[1] = NULL;
1083 children = g_new (char*, 1);
1084 children[0] = NULL;
1085 all_children = g_new (char*, 1);
1086 all_children[0] = NULL;
1087 info = symbol_info_new (uri, parents, children, all_children);
1088 zeitgeist_register_symbol (info);
1089 g_free (parents);
1090 g_free (children);
1091 g_free (all_children);
1092
1093 uri = ZEITGEIST_ZG_RECEIVE_EVENT;
1094 parents = g_new (char*, 2);
1095 parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
1096 parents[1] = NULL;
1097 children = g_new (char*, 1);
1098 children[0] = NULL;
1099 all_children = g_new (char*, 1);
1100 all_children[0] = NULL;
1101 info = symbol_info_new (uri, parents, children, all_children);
1102 zeitgeist_register_symbol (info);
1103 g_free (parents);
1104 g_free (children);
1105 g_free (all_children);
1106
1107 uri = ZEITGEIST_NFO_HARD_DISK_PARTITION;
1108 parents = g_new (char*, 1);
1109 parents[0] = NULL;
1110 children = g_new (char*, 1);
1111 children[0] = NULL;
1112 all_children = g_new (char*, 1);
1113 all_children[0] = NULL;
1114 info = symbol_info_new (uri, parents, children, all_children);
1115 zeitgeist_register_symbol (info);
1116 g_free (parents);
1117 g_free (children);
1118 g_free (all_children);
1119
1120 uri = ZEITGEIST_NFO_ARCHIVE_ITEM;
1121 parents = g_new (char*, 2);
1122 parents[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1123 parents[1] = NULL;
1124 children = g_new (char*, 1);
1125 children[0] = NULL;
1126 all_children = g_new (char*, 1);
1127 all_children[0] = NULL;
1128 info = symbol_info_new (uri, parents, children, all_children);
1129 zeitgeist_register_symbol (info);
1130 g_free (parents);
1131 g_free (children);
1132 g_free (all_children);
1133
1134 uri = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1135 parents = g_new (char*, 1);
1136 parents[0] = NULL;
1137 children = g_new (char*, 4);
1138 children[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1139 children[1] = ZEITGEIST_NFO_DELETED_RESOURCE;
1140 children[2] = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1141 children[3] = NULL;
1142 all_children = g_new (char*, 6);
1143 all_children[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1144 all_children[1] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1145 all_children[2] = ZEITGEIST_NFO_DELETED_RESOURCE;
1146 all_children[3] = ZEITGEIST_NCAL_ATTACHMENT;
1147 all_children[4] = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1148 all_children[5] = NULL;
1149 info = symbol_info_new (uri, parents, children, all_children);
1150 zeitgeist_register_symbol (info);
1151 g_free (parents);
1152 g_free (children);
1153 g_free (all_children);
1154
1155 uri = ZEITGEIST_NFO_SOFTWARE_SERVICE;
1156 parents = g_new (char*, 1);
1157 parents[0] = NULL;
1158 children = g_new (char*, 1);
1159 children[0] = NULL;
1160 all_children = g_new (char*, 1);
1161 all_children[0] = NULL;
1162 info = symbol_info_new (uri, parents, children, all_children);
1163 zeitgeist_register_symbol (info);
1164 g_free (parents);
1165 g_free (children);
1166 g_free (all_children);
1167
1168 uri = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1169 parents = g_new (char*, 2);
1170 parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1171 parents[1] = NULL;
1172 children = g_new (char*, 1);
1173 children[0] = NULL;
1174 all_children = g_new (char*, 1);
1175 all_children[0] = NULL;
1176 info = symbol_info_new (uri, parents, children, all_children);
1177 zeitgeist_register_symbol (info);
1178 g_free (parents);
1179 g_free (children);
1180 g_free (all_children);
1181
1182 uri = ZEITGEIST_NFO_MEDIA_STREAM;
1183 parents = g_new (char*, 1);
1184 parents[0] = NULL;
1185 children = g_new (char*, 1);
1186 children[0] = NULL;
1187 all_children = g_new (char*, 1);
1188 all_children[0] = NULL;
1189 info = symbol_info_new (uri, parents, children, all_children);
1190 zeitgeist_register_symbol (info);
1191 g_free (parents);
1192 g_free (children);
1193 g_free (all_children);
1194
1195 uri = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1196 parents = g_new (char*, 2);
1197 parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1198 parents[1] = NULL;
1199 children = g_new (char*, 3);
1200 children[0] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1201 children[1] = ZEITGEIST_NFO_ATTACHMENT;
1202 children[2] = NULL;
1203 all_children = g_new (char*, 3);
1204 all_children[0] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1205 all_children[1] = ZEITGEIST_NCAL_ATTACHMENT;
1206 all_children[2] = NULL;
1207 info = symbol_info_new (uri, parents, children, all_children);
1208 zeitgeist_register_symbol (info);
1209 g_free (parents);
1210 g_free (children);
1211 g_free (all_children);
1212
1213 uri = ZEITGEIST_NCAL_ATTACHMENT;
1214 parents = g_new (char*, 2);
1215 parents[0] = ZEITGEIST_NFO_ATTACHMENT;
1216 parents[1] = NULL;
1217 children = g_new (char*, 1);
1218 children[0] = NULL;
1219 all_children = g_new (char*, 1);
1220 all_children[0] = NULL;
1221 info = symbol_info_new (uri, parents, children, all_children);
1222 zeitgeist_register_symbol (info);
1223 g_free (parents);
1224 g_free (children);
1225 g_free (all_children);
1226
1227 uri = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1228 parents = g_new (char*, 2);
1229 parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1230 parents[1] = NULL;
1231 children = g_new (char*, 1);
1232 children[0] = NULL;
1233 all_children = g_new (char*, 1);
1234 all_children[0] = NULL;
1235 info = symbol_info_new (uri, parents, children, all_children);
1236 zeitgeist_register_symbol (info);
1237 g_free (parents);
1238 g_free (children);
1239 g_free (all_children);
1240
1241 uri = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1242 parents = g_new (char*, 2);
1243 parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1244 parents[1] = NULL;
1245 children = g_new (char*, 1);
1246 children[0] = NULL;
1247 all_children = g_new (char*, 1);
1248 all_children[0] = NULL;
1249 info = symbol_info_new (uri, parents, children, all_children);
1250 zeitgeist_register_symbol (info);
1251 g_free (parents);
1252 g_free (children);
1253 g_free (all_children);
1254
1255 uri = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1256 parents = g_new (char*, 1);
1257 parents[0] = NULL;
1258 children = g_new (char*, 6);
1259 children[0] = ZEITGEIST_ZG_USER_ACTIVITY;
1260 children[1] = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1261 children[2] = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1262 children[3] = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1263 children[4] = ZEITGEIST_ZG_WORLD_ACTIVITY;
1264 children[5] = NULL;
1265 all_children = g_new (char*, 6);
1266 all_children[0] = ZEITGEIST_ZG_USER_ACTIVITY;
1267 all_children[1] = ZEITGEIST_ZG_WORLD_ACTIVITY;
1268 all_children[2] = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1269 all_children[3] = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1270 all_children[4] = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1271 all_children[5] = NULL;
1272 info = symbol_info_new (uri, parents, children, all_children);
1273 zeitgeist_register_symbol (info);
1274 g_free (parents);
1275 g_free (children);
1276 g_free (all_children);
1277
1278 uri = ZEITGEIST_NMO_MAILBOX_DATA_OBJECT;
1279 parents = g_new (char*, 1);
1280 parents[0] = NULL;
1281 children = g_new (char*, 1);
1282 children[0] = NULL;
1283 all_children = g_new (char*, 1);
1284 all_children[0] = NULL;
1285 info = symbol_info_new (uri, parents, children, all_children);
1286 zeitgeist_register_symbol (info);
1287 g_free (parents);
1288 g_free (children);
1289 g_free (all_children);
1290
1291 uri = ZEITGEIST_NCAL_CALENDAR_DATA_OBJECT;
1292 parents = g_new (char*, 1);
1293 parents[0] = NULL;
1294 children = g_new (char*, 1);
1295 children[0] = NULL;
1296 all_children = g_new (char*, 1);
1297 all_children[0] = NULL;
1298 info = symbol_info_new (uri, parents, children, all_children);
1299 zeitgeist_register_symbol (info);
1300 g_free (parents);
1301 g_free (children);
1302 g_free (all_children);
1303
1304 uri = ZEITGEIST_ZG_USER_ACTIVITY;
1305 parents = g_new (char*, 2);
1306 parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1307 parents[1] = NULL;
1308 children = g_new (char*, 1);
1309 children[0] = NULL;
1310 all_children = g_new (char*, 1);
1311 all_children[0] = NULL;
1312 info = symbol_info_new (uri, parents, children, all_children);
1313 zeitgeist_register_symbol (info);
1314 g_free (parents);
1315 g_free (children);
1316 g_free (all_children);
1317
1318 uri = ZEITGEIST_NFO_REMOTE_PORT_ADDRESS;
1319 parents = g_new (char*, 1);
1320 parents[0] = NULL;
1321 children = g_new (char*, 1);
1322 children[0] = NULL;
1323 all_children = g_new (char*, 1);
1324 all_children[0] = NULL;
1325 info = symbol_info_new (uri, parents, children, all_children);
1326 zeitgeist_register_symbol (info);
1327 g_free (parents);
1328 g_free (children);
1329 g_free (all_children);
1330
1331 uri = ZEITGEIST_ZG_WORLD_ACTIVITY;
1332 parents = g_new (char*, 2);
1333 parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1334 parents[1] = NULL;
1335 children = g_new (char*, 1);
1336 children[0] = NULL;
1337 all_children = g_new (char*, 1);
1338 all_children[0] = NULL;
1339 info = symbol_info_new (uri, parents, children, all_children);
1340 zeitgeist_register_symbol (info);
1341 g_free (parents);
1342 g_free (children);
1343 g_free (all_children);
1344
1345 uri = ZEITGEIST_NFO_SOFTWARE_ITEM;
1346 parents = g_new (char*, 1);
1347 parents[0] = NULL;
1348 children = g_new (char*, 1);
1349 children[0] = NULL;
1350 all_children = g_new (char*, 1);
1351 all_children[0] = NULL;
1352 info = symbol_info_new (uri, parents, children, all_children);
1353 zeitgeist_register_symbol (info);
1354 g_free (parents);
1355 g_free (children);
1356 g_free (all_children);
1357
1358 uri = ZEITGEIST_NFO_DELETED_RESOURCE;
1359 parents = g_new (char*, 2);
1360 parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1361 parents[1] = NULL;
1362 children = g_new (char*, 1);
1363 children[0] = NULL;
1364 all_children = g_new (char*, 1);
1365 all_children[0] = NULL;
1366 info = symbol_info_new (uri, parents, children, all_children);
1367 zeitgeist_register_symbol (info);
1368 g_free (parents);
1369 g_free (children);
1370 g_free (all_children);
1371
1372 uri = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1373 parents = g_new (char*, 2);
1374 parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1375 parents[1] = NULL;
1376 children = g_new (char*, 1);
1377 children[0] = NULL;
1378 all_children = g_new (char*, 1);
1379 all_children[0] = NULL;
1380 info = symbol_info_new (uri, parents, children, all_children);
1381 zeitgeist_register_symbol (info);
1382 g_free (parents);
1383 g_free (children);
1384 g_free (all_children);
1385
1386
1387 symbols_loaded = TRUE;
1388}
1389
01390
=== added file 'src/zeitgeist-symbols.h'
--- src/zeitgeist-symbols.h 1970-01-01 00:00:00 +0000
+++ src/zeitgeist-symbols.h 2010-08-09 22:06:44 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2010 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License
6 * version 3.0 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License version 3.0 for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library. If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Michal Hruby <michal.mhr@gmail.com>
18 */
19
20#if !defined (_ZEITGEIST_H_INSIDE_) && !defined (ZEITGEIST_COMPILATION)
21#error "Only <zeitgeist.h> can be included directly."
22#endif
23
24#ifndef _ZEITGEIST_SYMBOLS_H_
25#define _ZEITGEIST_SYMBOLS_H_
26
27#include <glib.h>
28#include <glib-object.h>
29
30G_BEGIN_DECLS
31
32GList* zeitgeist_symbol_get_parents (const gchar *symbol);
33
34GList* zeitgeist_symbol_get_children (const gchar *symbol);
35
36GList* zeitgeist_symbol_get_all_children (const gchar *symbol);
37
38gboolean zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent);
39
40G_END_DECLS
41
42#endif /* _ZEITGEIST_SYMBOLS_H_ */
043
=== modified file 'src/zeitgeist.h'
--- src/zeitgeist.h 2010-07-22 09:21:47 +0000
+++ src/zeitgeist.h 2010-08-09 22:06:44 +0000
@@ -36,6 +36,7 @@
36#include <zeitgeist-ontology-manifestations.h>36#include <zeitgeist-ontology-manifestations.h>
37#include <zeitgeist-result-set.h>37#include <zeitgeist-result-set.h>
38#include <zeitgeist-subject.h>38#include <zeitgeist-subject.h>
39#include <zeitgeist-symbols.h>
39#include <zeitgeist-timerange.h>40#include <zeitgeist-timerange.h>
40#include <zeitgeist-timestamp.h>41#include <zeitgeist-timestamp.h>
4142
4243
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2010-07-22 09:21:47 +0000
+++ tests/Makefile.am 2010-08-09 22:06:44 +0000
@@ -40,6 +40,10 @@
40test_timestamp_SOURCES = test-timestamp.c $(helper_sources)40test_timestamp_SOURCES = test-timestamp.c $(helper_sources)
41test_timestamp_LDADD = $(zeitgeist_libs)41test_timestamp_LDADD = $(zeitgeist_libs)
4242
43TEST_PROGS += test-symbols
44test_symbols_SOURCES = test-symbols.c $(helper_sources)
45test_symbols_LDADD = $(zeitgeist_libs)
46
43TEST_PROGS += test-monitor47TEST_PROGS += test-monitor
44test_monitor_SOURCES = test-monitor.c $(helper_sources)48test_monitor_SOURCES = test-monitor.c $(helper_sources)
45test_monitor_LDADD = $(zeitgeist_libs)49test_monitor_LDADD = $(zeitgeist_libs)
4650
=== added file 'tests/test-symbols.c'
--- tests/test-symbols.c 1970-01-01 00:00:00 +0000
+++ tests/test-symbols.c 2010-08-09 22:06:44 +0000
@@ -0,0 +1,220 @@
1/*
2 * Copyright (C) 2010 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Michal Hruby <michal.mhr@gmail.com>
17 *
18 */
19
20#include <glib.h>
21#include <glib-object.h>
22#include <string.h>
23#include "zeitgeist-symbols.h"
24#include "zeitgeist-ontology-interpretations.h"
25
26typedef struct
27{
28
29} Fixture;
30
31static void setup (Fixture *fix, gconstpointer data);
32static void teardown (Fixture *fix, gconstpointer data);
33
34static void
35setup (Fixture *fix, gconstpointer data)
36{
37
38}
39
40static void
41teardown (Fixture *fix, gconstpointer data)
42{
43
44}
45
46static void
47test_null_symbols (Fixture *fix, gconstpointer data)
48{
49 // shouldn't crash
50 zeitgeist_symbol_is_a (NULL, NULL);
51}
52
53static void
54test_null_first (Fixture *fix, gconstpointer data)
55{
56 gboolean res = zeitgeist_symbol_is_a (NULL, ZEITGEIST_NFO_MEDIA);
57
58 g_assert_cmpint (res, ==, FALSE);
59}
60
61static void
62test_null_second (Fixture *fix, gconstpointer data)
63{
64 gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA, NULL);
65
66 g_assert_cmpint (res, ==, FALSE);
67}
68
69static void
70test_not_uri (Fixture *fix, gconstpointer data)
71{
72 gboolean res = zeitgeist_symbol_is_a ("first", "second");
73
74 g_assert_cmpint (res, ==, FALSE);
75}
76
77static void
78test_not_uri_equal (Fixture *fix, gconstpointer data)
79{
80 gboolean res = zeitgeist_symbol_is_a ("something", "something");
81
82 g_assert_cmpint (res, ==, FALSE);
83}
84
85static void
86test_uris_equal (Fixture *fix, gconstpointer data)
87{
88 gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_AUDIO,
89 ZEITGEIST_NFO_AUDIO);
90
91 g_assert_cmpint (res, ==, TRUE);
92}
93
94static void
95test_vector_image_media (Fixture *fix, gconstpointer data)
96{
97 gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_VECTOR_IMAGE,
98 ZEITGEIST_NFO_MEDIA);
99
100 g_assert_cmpint (res, ==, TRUE);
101}
102
103static void
104test_media_vector_image (Fixture *fix, gconstpointer data)
105{
106 gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA,
107 ZEITGEIST_NFO_VECTOR_IMAGE);
108
109 g_assert_cmpint (res, ==, FALSE);
110}
111
112static void
113test_media_software (Fixture *fix, gconstpointer data)
114{
115 gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA,
116 ZEITGEIST_NFO_SOFTWARE);
117
118 g_assert_cmpint (res, ==, FALSE);
119}
120
121static void
122is_uri_valid (gpointer data, gpointer unused)
123{
124 const gchar SEM_D_URI[] = "http://www.semanticdesktop.org/ontologies";
125 gchar *uri = (gchar*) data;
126 g_assert (uri != NULL && g_str_has_prefix (uri, SEM_D_URI));
127 gchar *str = g_strdup_printf ("%s", uri);
128
129 g_free (str);
130}
131
132static void
133test_media_children (Fixture *fix, gconstpointer data)
134{
135 GList* children = zeitgeist_symbol_get_children (ZEITGEIST_NFO_MEDIA);
136
137 g_assert_cmpint (g_list_length (children), >, 0);
138 g_list_foreach (children, is_uri_valid, NULL);
139
140 g_list_free (children);
141}
142
143static void
144test_media_all_children (Fixture *fix, gconstpointer data)
145{
146 GList* children = zeitgeist_symbol_get_all_children (ZEITGEIST_NFO_MEDIA);
147
148 g_assert_cmpint (g_list_length (children), >, 0);
149 g_list_foreach (children, is_uri_valid, NULL);
150
151 g_list_free (children);
152}
153
154static void
155test_vector_image_parents (Fixture *fix, gconstpointer data)
156{
157 GList* parents = zeitgeist_symbol_get_parents (ZEITGEIST_NFO_VECTOR_IMAGE);
158
159 g_assert_cmpint (g_list_length (parents), >, 0);
160 g_list_foreach (parents, is_uri_valid, NULL);
161
162 g_list_free (parents);
163}
164
165static void
166test_media_complex (Fixture *fix, gconstpointer data)
167{
168 GList* iter;
169 GList* children = zeitgeist_symbol_get_children (ZEITGEIST_NFO_MEDIA);
170 GList* all_ch = zeitgeist_symbol_get_all_children (ZEITGEIST_NFO_MEDIA);
171
172 g_assert_cmpint (g_list_length (children), >, 0);
173 g_assert_cmpint (g_list_length (all_ch), >, g_list_length (children));
174
175 for (iter = children; iter; iter = iter->next)
176 {
177 // check that it's also in all_children
178 g_assert (g_list_find_custom (all_ch, iter->data, (GCompareFunc) strcmp));
179 }
180
181 g_list_free (all_ch);
182 g_list_free (children);
183}
184
185int
186main (int argc,
187 char *argv[])
188{
189 g_type_init ();
190 g_test_init (&argc, &argv, NULL);
191
192 g_test_add ("/Zeitgeist/Symbols/NullNull", Fixture, NULL,
193 setup, test_null_symbols, teardown);
194 g_test_add ("/Zeitgeist/Symbols/FirstNull", Fixture, NULL,
195 setup, test_null_first, teardown);
196 g_test_add ("/Zeitgeist/Symbols/SecondNull", Fixture, NULL,
197 setup, test_null_second, teardown);
198 g_test_add ("/Zeitgeist/Symbols/NotUris", Fixture, NULL,
199 setup, test_not_uri, teardown);
200 g_test_add ("/Zeitgeist/Symbols/NotUrisEqual", Fixture, NULL,
201 setup, test_not_uri_equal, teardown);
202 g_test_add ("/Zeitgeist/Symbols/EqualUris", Fixture, NULL,
203 setup, test_uris_equal, teardown);
204 g_test_add ("/Zeitgeist/Symbols/ValidParent", Fixture, NULL,
205 setup, test_vector_image_media, teardown);
206 g_test_add ("/Zeitgeist/Symbols/ValidChild", Fixture, NULL,
207 setup, test_media_vector_image, teardown);
208 g_test_add ("/Zeitgeist/Symbols/Unrelated", Fixture, NULL,
209 setup, test_media_software, teardown);
210 g_test_add ("/Zeitgeist/Symbols/GetChildren", Fixture, NULL,
211 setup, test_media_children, teardown);
212 g_test_add ("/Zeitgeist/Symbols/GetAllChildren", Fixture, NULL,
213 setup, test_media_all_children, teardown);
214 g_test_add ("/Zeitgeist/Symbols/GetParents", Fixture, NULL,
215 setup, test_vector_image_parents, teardown);
216 g_test_add ("/Zeitgeist/Symbols/SymbolInfo", Fixture, NULL,
217 setup, test_media_complex, teardown);
218
219 return g_test_run();
220}
0221
=== added file 'tools/symboltree2c.py'
--- tools/symboltree2c.py 1970-01-01 00:00:00 +0000
+++ tools/symboltree2c.py 2010-08-09 22:06:44 +0000
@@ -0,0 +1,107 @@
1#
2# Utility to transcode the Zeitgeist ontology from Python code
3# to a C header file defining a collection of macros for the
4# members of the ontology
5#
6
7import sys
8import re
9import zeitgeist.datamodel as dm
10
11def caseconv(name):
12 """
13 Converts CamelCase to CAMEL_CASE
14 """
15 result = ""
16 for i in range(len(name) - 1) :
17 if name[i].islower() and name[i+1].isupper():
18 result += name[i].upper() + "_"
19 else:
20 result += name[i].upper()
21 result += name[-1].upper()
22 return result
23
24def symbolname (symbol):
25 try:
26 ns, name = symbol[symbol.rfind("/")+1:].split("#")
27 return "ZEITGEIST_%s_%s" % (ns.upper(), caseconv(name))
28 except Exception, e:
29 return symbol.uri.rpartition("#")[2].upper()
30
31def output_symbol_func (body):
32 header = """
33static void
34_ensure_symbols_loaded (void)
35{
36 gchar **parents;
37 gchar **children;
38 gchar **all_children;
39 gchar *uri;
40 SymbolInfo *info;
41
42 if (symbols_loaded) return;
43
44%s
45
46 symbols_loaded = TRUE;
47}
48"""
49
50 # indent
51 symbols_func = header[1:] % re.sub(r'(?m)^(.+)$', r' \1', body)
52 return symbols_func
53
54def get_symbols (l):
55 s = filter(lambda x: x not in [dm.Interpretation, dm.Manifestation], l)
56 s = map(symbolname, s)
57 s.append("NULL")
58
59 return s
60
61def alloc_array (name, symbols):
62 num_elems = len(symbols)
63 alloc_call = '%s = g_new (char*, %d);' % (name, num_elems)
64 elems = ['%s[%d] = %s;' % (name,i,symbols[i]) for i in xrange(0, num_elems)]
65 elems.insert(0, alloc_call)
66 return '\n'.join(elems)
67
68def register_symbol (symbol):
69 uri = 'uri = %s;' % symbolname(symbol)
70 arrays = ['parents', 'children', 'all_children']
71 parents = alloc_array(arrays[0], get_symbols(symbol.get_parents()))
72 children = alloc_array(arrays[1], get_symbols(symbol.get_children()))
73 all_ch = alloc_array(arrays[2], get_symbols(symbol.get_all_children()))
74
75 si_call = 'info = symbol_info_new (uri, parents, children, all_children);'
76 register_call = 'zeitgeist_register_symbol (info);'
77
78 calls = [uri, parents, children, all_ch, si_call, register_call]
79 calls.extend(['g_free (%s);' % var for var in arrays])
80
81 return '\n'.join(calls) + '\n'
82
83if __name__ == "__main__":
84 interpretations = []
85 manifestations = []
86 for interp in dm.Interpretation.get_all_children():
87 try:
88 stmt = register_symbol (interp)
89 interpretations.append(stmt)
90 except Exception, e:
91 print >> sys.stderr, "Failed to convert %s: %s" % (interp, e)
92
93 for manif in dm.Manifestation.get_all_children():
94 try:
95 stmt = register_symbol (manif)
96 manifestations.append(stmt)
97 except Exception, e:
98 print >> sys.stderr, "Failed to convert %s: %s" % (manif, e)
99
100
101 all_symbols = []
102 all_symbols.extend(interpretations)
103 all_symbols.extend(manifestations)
104
105 f = open('zeitgeist-symbols.template', 'r')
106 print f.read()
107 print output_symbol_func('\n'.join(all_symbols))
0108
=== added file 'tools/zeitgeist-symbols.template'
--- tools/zeitgeist-symbols.template 1970-01-01 00:00:00 +0000
+++ tools/zeitgeist-symbols.template 2010-08-09 22:06:44 +0000
@@ -0,0 +1,210 @@
1/*
2 * Copyright (C) 2010 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License
6 * version 3.0 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License version 3.0 for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library. If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Michal Hruby <michal.mhr@gmail.com>
18 */
19
20/**
21 * SECTION:zeitgeist-symbols
22 * @short_description: Used to get information about Interpretation and/or
23 * Manifestation symbols
24 * @include: zeitgeist.h
25 */
26
27#include "zeitgeist-ontology-interpretations.h"
28#include "zeitgeist-ontology-manifestations.h"
29#include "zeitgeist-symbols.h"
30
31static void _ensure_symbols_loaded (void);
32
33static gboolean symbols_loaded = FALSE;
34static GHashTable *symbol_uris = NULL;
35
36typedef struct
37{
38 gchar *uri;
39 GSList *parents;
40 GSList *children;
41 GSList *all_children;
42} SymbolInfo;
43
44static SymbolInfo*
45symbol_info_new (gchar *uri,
46 GStrv parents,
47 GStrv children,
48 GStrv all_children)
49{
50 gchar *iter;
51 SymbolInfo *i = g_slice_new0 (SymbolInfo);
52 i->uri = g_strdup (uri);
53
54 while (*parents)
55 {
56 i->parents = g_slist_append (i->parents,
57 GINT_TO_POINTER (g_quark_from_string (*parents)));
58 parents++;
59 }
60
61 while (*children)
62 {
63 i->children = g_slist_append (i->children,
64 GINT_TO_POINTER (g_quark_from_string (*children)));
65 children++;
66 }
67
68 while (*all_children)
69 {
70 i->all_children = g_slist_append (i->all_children,
71 GINT_TO_POINTER (g_quark_from_string (*all_children)));
72 all_children++;
73 }
74
75 return i;
76}
77
78static void
79zeitgeist_register_symbol (SymbolInfo *i)
80{
81 if (symbol_uris == NULL)
82 symbol_uris = g_hash_table_new (g_str_hash, g_str_equal);
83
84 g_hash_table_insert (symbol_uris, i->uri, i);
85}
86
87/**
88 * zeitgeist_symbol_get_parents:
89 * @symbol: A symbol.
90 *
91 * Gets list of parents of the specified symbol.
92 *
93 * Returns: A newly allocated list of parents of this symbol.
94 * The data elements of the list contain strings which you
95 * do not own, use g_strdup() if you intend to work with them.
96 * Free the list with a call to g_list_free().
97 */
98GList*
99zeitgeist_symbol_get_parents (const gchar *symbol)
100{
101 GSList *iter;
102 GList *result = NULL;
103 g_return_val_if_fail (symbol != NULL, NULL);
104
105 _ensure_symbols_loaded ();
106
107 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
108 g_return_val_if_fail (info != NULL, NULL);
109
110 for (iter = info->parents; iter; iter = iter->next)
111 {
112 result = g_list_prepend (result,
113 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
114 }
115
116 return g_list_reverse (result);
117}
118
119/**
120 * zeitgeist_symbol_get_children:
121 * @symbol: A symbol.
122 *
123 * Gets list of direct children of the specified symbol.
124 *
125 * Returns: A newly allocated list of direct children of this symbol.
126 * The data elements of the list contain strings which you
127 * do not own, use g_strdup() if you intend to work with them.
128 * Free the list with a call to g_list_free().
129 */
130GList*
131zeitgeist_symbol_get_children (const gchar *symbol)
132{
133 GSList *iter;
134 GList *result = NULL;
135 g_return_val_if_fail (symbol != NULL, NULL);
136
137 _ensure_symbols_loaded ();
138
139 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
140 g_return_val_if_fail (info != NULL, NULL);
141
142 for (iter = info->children; iter; iter = iter->next)
143 {
144 result = g_list_prepend (result,
145 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
146 }
147
148 return g_list_reverse (result);
149}
150
151/**
152 * zeitgeist_symbol_get_all_children:
153 * @symbol: A symbol.
154 *
155 * Gets list of all children of the specified symbol.
156 *
157 * Returns: A newly allocated list of all children of this symbol (includes
158 * also children of children).
159 * The data elements of the list contain strings which you
160 * do not own, use g_strdup() if you intend to work with them.
161 * Free the list with a call to g_list_free().
162 */
163GList*
164zeitgeist_symbol_get_all_children (const gchar *symbol)
165{
166 GSList *iter;
167 GList *result = NULL;
168 g_return_val_if_fail (symbol != NULL, NULL);
169
170 _ensure_symbols_loaded ();
171
172 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
173 g_return_val_if_fail (info != NULL, NULL);
174
175 for (iter = info->all_children; iter; iter = iter->next)
176 {
177 result = g_list_prepend (result,
178 g_quark_to_string (GPOINTER_TO_INT (iter->data)));
179 }
180
181 return g_list_reverse (result);
182}
183
184/**
185 * zeitgeist_symbol_is_a:
186 * @symbol: A symbol.
187 * @parent: Parent symbol.
188 *
189 * Determines if @symbol is child of @parent.
190 *
191 * Returns: True if @symbol is child of @parent (or equal to @parent),
192 * FALSE otherwise.
193 */
194gboolean
195zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent)
196{
197 if (parent == NULL || symbol == NULL) return FALSE;
198
199 _ensure_symbols_loaded ();
200
201 SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, parent);
202 if (info == NULL) return FALSE;
203
204 GQuark symbol_quark = g_quark_try_string (symbol);
205 if (symbol_quark == 0) return FALSE;
206 // catch equal symbols
207 if (symbol_quark == g_quark_try_string (parent)) return TRUE;
208
209 return g_slist_find (info->all_children, GINT_TO_POINTER (symbol_quark)) != NULL;
210}

Subscribers

People subscribed via source and target branches