diff options
author | Manish Sinha <manishsinha.tech@gmail.com> | 2010-09-18 15:48:13 +0530 |
---|---|---|
committer | Manish Sinha <manishsinha.tech@gmail.com> | 2010-09-18 15:48:13 +0530 |
commit | 3c7e7dd201e53704a2466e19ae75ec103dab641f (patch) | |
tree | f40fc02e2d5e181684208ad0800173373e86c95c | |
parent | fcad338bb5b21ddfbca837b842e324d80bff504d (diff) |
Implemented search in Manifestation
-rw-r--r-- | Zeitgeist.Cli/Main.cs | 1 | ||||
-rw-r--r-- | Zeitgeist/Datamodel/Manifestation.cs | 105 | ||||
-rw-r--r-- | configure.ac | 8 |
3 files changed, 107 insertions, 7 deletions
diff --git a/Zeitgeist.Cli/Main.cs b/Zeitgeist.Cli/Main.cs index c99a8d4..42059b1 100644 --- a/Zeitgeist.Cli/Main.cs +++ b/Zeitgeist.Cli/Main.cs @@ -16,6 +16,7 @@ namespace Zeitgeist.ZeitgeistSharp.Cli IDataSource zeitgeist = Bus.Session.GetObject<IDataSource>("org.gnome.zeitgeist.Engine", objPath); KeyValuePair<string,string> res= Interpretation.Instance.Search("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Software"); + KeyValuePair<string, string> res2 = Manifestation.Instance.Search("http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity"); RawDataSource[] src= zeitgeist.GetDataSources(); diff --git a/Zeitgeist/Datamodel/Manifestation.cs b/Zeitgeist/Datamodel/Manifestation.cs index bf9f9d3..fc908d4 100644 --- a/Zeitgeist/Datamodel/Manifestation.cs +++ b/Zeitgeist/Datamodel/Manifestation.cs @@ -14,6 +14,17 @@ namespace Zeitgeist.Datamodel /// </remarks> public class Manifestation { + public static Manifestation Instance + { + get + { + if(_singleton_obj == null) + _singleton_obj = new Manifestation(); + + return _singleton_obj; + } + } + /// <summary> /// A DataObject found in a calendar. It is usually interpreted as one of the calendar entity types (e.g. Event, Journal, Todo etc.). (Display name: 'CalendarDataObject') /// </summary> @@ -24,7 +35,7 @@ namespace Zeitgeist.Datamodel { get { - return _timezone; + return _cal_data_obj; } } @@ -56,7 +67,6 @@ namespace Zeitgeist.Datamodel } } - /// <summary> /// A partition on a hard disk. (Display name: 'HardDiskPartition') /// </summary> @@ -141,6 +151,40 @@ namespace Zeitgeist.Datamodel } } + public KeyValuePair<string, string> Search(string manifestation) + { + if(string.Equals(_cal_data_obj.Value, manifestation)) + return _cal_data_obj; + + KeyValuePair<string, string> event_manifestation = _event_manifestation.Search(manifestation); + if(event_manifestation.Key != null) + return event_manifestation; + + KeyValuePair<string, string> file_data_obj = _file_data_obj.Search(manifestation); + if(file_data_obj.Key != null) + return file_data_obj; + + if(string.Equals(_hd_partition.Value, manifestation)) + return _hd_partition; + + if(string.Equals(_mailbox_data_obj.Value, manifestation)) + return _mailbox_data_obj; + + if(string.Equals(_media_stream.Value, manifestation)) + return _media_stream; + + if(string.Equals(_remote_port_addr.Value, manifestation)) + return _remote_port_addr; + + if(string.Equals(_sw_item.Value, manifestation)) + return _sw_item; + + if(string.Equals(_sw_service.Value, manifestation)) + return _sw_service; + + return new KeyValuePair<string, string>(); + } + #region Private Fields private static Manifestation _singleton_obj = new Manifestation(); @@ -252,6 +296,29 @@ namespace Zeitgeist.Datamodel } } + public KeyValuePair<string, string> Search(string manifestation) + { + if(string.Equals(_evnt_manifest.Value, manifestation)) + return _evnt_manifest; + + if(string.Equals(_heur_activity.Value, manifestation)) + return _heur_activity; + + if(string.Equals(_schld_activity.Value, manifestation)) + return _schld_activity; + + if(string.Equals(_sys_notification.Value, manifestation)) + return _sys_notification; + + if(string.Equals(_user_activity.Value, manifestation)) + return _user_activity; + + if(string.Equals(_world_activity.Value, manifestation)) + return _world_activity; + + return new KeyValuePair<string, string>(); + } + #region Private Fields private KeyValuePair<string, string> _evnt_manifest = new KeyValuePair<string, string>("EventManifestation", "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#EventManifestation"); @@ -319,7 +386,7 @@ namespace Zeitgeist.Datamodel /// <remarks> /// http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RemoteDataObject /// </remarks> - public KeyValuePair<string, string> FileDataObject + public KeyValuePair<string, string> RemoteDataObject { get { @@ -327,6 +394,24 @@ namespace Zeitgeist.Datamodel } } + public KeyValuePair<string, string> Search(string manifestation) + { + if(string.Equals(_file_data_obj.Value, manifestation)) + return _file_data_obj; + + if(string.Equals(_deleted_resc.Value, manifestation)) + return _deleted_resc; + + KeyValuePair<string, string> embedded_file_data_obj = _embedded_file_data_obj.Search(manifestation); + if(embedded_file_data_obj.Key != null) + return embedded_file_data_obj; + + if(string.Equals(_remote_data_obj.Value, manifestation)) + return _remote_data_obj; + + return new KeyValuePair<string, string>(); + } + #region Private Fields private KeyValuePair<string, string> _file_data_obj = new KeyValuePair<string, string>("FileDataObject", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject"); @@ -384,6 +469,20 @@ namespace Zeitgeist.Datamodel } } + public KeyValuePair<string, string> Search(string manifestation) + { + if(string.Equals(_embedded_file_data_obj.Value, manifestation)) + return _embedded_file_data_obj; + + if(string.Equals(_archive_item.Value, manifestation)) + return _archive_item; + + if(string.Equals(_attachment.Value, manifestation)) + return _attachment; + + return new KeyValuePair<string, string>(); + } + #region Private Fields private KeyValuePair<string, string> _embedded_file_data_obj = new KeyValuePair<string, string>("EmbeddedFileDataObject", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#EmbeddedFileDataObject"); diff --git a/configure.ac b/configure.ac index 1189b21..e967e0e 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ fi AC_ARG_ENABLE(debug_x86, AC_HELP_STRING([--enable-debug_x86], - [Use 'DEBUG_X86' Configuration [default=YES]]), + [Use 'DEBUG_X86' Configuration [default=NO]]), enable_debug_x86=yes, enable_debug_x86=no) AM_CONDITIONAL(ENABLE_DEBUG_X86, test x$enable_debug_x86 = xyes) if test "x$enable_debug_x86" = "xyes" ; then @@ -33,15 +33,15 @@ if test "x$enable_debug_x86" = "xyes" ; then fi AC_ARG_ENABLE(release_x86, AC_HELP_STRING([--enable-release_x86], - [Use 'RELEASE_X86' Configuration [default=NO]]), + [Use 'RELEASE_X86' Configuration [default=YES]]), enable_release_x86=yes, enable_release_x86=no) AM_CONDITIONAL(ENABLE_RELEASE_X86, test x$enable_release_x86 = xyes) if test "x$enable_release_x86" = "xyes" ; then CONFIG_REQUESTED="yes" fi if test -z "$CONFIG_REQUESTED" ; then - AM_CONDITIONAL(ENABLE_DEBUG_X86, true) - enable_debug_x86=yes + AM_CONDITIONAL(ENABLE_RELEASE_X86, true) + enable_release_x86=yes fi |