beagle r4462 - trunk/beagle-xesam/src
- From: arunsr svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4462 - trunk/beagle-xesam/src
- Date: Tue, 5 Feb 2008 18:46:43 +0000 (GMT)
Author: arunsr
Date: Tue Feb 5 18:46:42 2008
New Revision: 4462
URL: http://svn.gnome.org/viewvc/beagle?rev=4462&view=rev
Log:
"xesam:title" and some other fields now map to "dc:title", etc.
Modified:
trunk/beagle-xesam/src/Ontologies.cs
trunk/beagle-xesam/src/Parser.cs
Modified: trunk/beagle-xesam/src/Ontologies.cs
==============================================================================
--- trunk/beagle-xesam/src/Ontologies.cs (original)
+++ trunk/beagle-xesam/src/Ontologies.cs Tue Feb 5 18:46:42 2008
@@ -48,14 +48,14 @@
{
fields_mapping = new Dictionary<string, string> ();
- fields_mapping.Add ("dc:title", "title");
- fields_mapping.Add ("xesam:title", "title");
+ fields_mapping.Add ("dc:title", "property:dc:title");
+ fields_mapping.Add ("xesam:title", "property:dc:title");
- fields_mapping.Add ("dc:author", "author");
- fields_mapping.Add ("xesam:author", "author");
+ fields_mapping.Add ("dc:author", "property:dc:author");
+ fields_mapping.Add ("xesam:author", "property:dc:author");
- fields_mapping.Add ("dc:creator", "creator");
- fields_mapping.Add ("xesam:creator", "creator");
+ fields_mapping.Add ("dc:creator", "property:dc:creator");
+ fields_mapping.Add ("xesam:creator", "property:dc:creator");
fields_mapping.Add ("dc:date", "date");
Modified: trunk/beagle-xesam/src/Parser.cs
==============================================================================
--- trunk/beagle-xesam/src/Parser.cs (original)
+++ trunk/beagle-xesam/src/Parser.cs Tue Feb 5 18:46:42 2008
@@ -37,6 +37,14 @@
enum CollectibleType { None, And, Or };
enum ComparisonType { None, Equals, Lesser, Greater };
+ private static string GetFieldDelimiter (string field)
+ {
+ if (field.Substring(0, 9) == "property:")
+ return "=";
+
+ return ":";
+ }
+
// This should be usable for both <query> and <category>
private static string ParseXesamSourcesAndContents (XPathNavigator nav)
{
@@ -117,7 +125,7 @@
//
// FIXME: Assuming only 1 field and 1 data element
- string q = String.Empty;
+ string q = String.Empty, field;
while (true) {
if (nav.GetAttribute ("negate", String.Empty) == "true")
@@ -147,7 +155,7 @@
break;
case "inSet":
nav.MoveToFirstChild ();
- string name = ParseXesamField (nav);
+ field = ParseXesamField (nav);
bool first = false;
q += "( ";
@@ -156,7 +164,8 @@
first = true;
else
q += " or ";
- q += name + ":" + ParseXesamData (nav, ComparisonType.Equals);
+
+ q += field + GetFieldDelimiter(field) + ParseXesamData (nav, ComparisonType.Equals);
}
q += " )";
@@ -168,9 +177,10 @@
goto case "equals";
case "equals":
nav.MoveToFirstChild ();
- q += ParseXesamField (nav);
+ field = ParseXesamField (nav);
+ q += field;
+ q += GetFieldDelimiter (field);
nav.MoveToNext ();
- q += ':';
q += ParseXesamData (nav, ComparisonType.Equals);
nav.MoveToParent ();
break;
@@ -178,9 +188,10 @@
goto case "greaterThan";
case "greaterThan":
nav.MoveToFirstChild ();
- q += ParseXesamField (nav);
+ field = ParseXesamField (nav);
+ q += field;
+ q += GetFieldDelimiter (field);
nav.MoveToNext ();
- q += ':';
q += ParseXesamData (nav, ComparisonType.Greater);
nav.MoveToParent ();
break;
@@ -188,9 +199,10 @@
goto case "greaterThan";
case "lessThan":
nav.MoveToFirstChild ();
- q += ParseXesamField (nav);
+ field = ParseXesamField (nav);
+ q += field;
+ q += GetFieldDelimiter (field);
nav.MoveToNext ();
- q += ':';
q += ParseXesamData (nav, ComparisonType.Greater);
nav.MoveToParent ();
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]