[rygel] tracker: More reliable duplicate subjects detection
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker: More reliable duplicate subjects detection
- Date: Tue, 6 Jul 2010 22:01:24 +0000 (UTC)
commit 5c2d94e5f9b8839b4f0f463d3cf9e7cabb23d3cb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jul 6 20:15:51 2010 +0300
tracker: More reliable duplicate subjects detection
Instead of depending on the query/triplet builder to set the subjects to
'null', simply compare the subjects of triplets.
.../tracker/rygel-tracker-metadata-values.vala | 2 +-
.../tracker/rygel-tracker-query-triplet.vala | 12 ++++++------
src/plugins/tracker/rygel-tracker-query.vala | 10 ++++++----
3 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index 7b30875..e5457b8 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -97,7 +97,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
string subject;
if (i == 0) {
- subject = null;
+ subject = ITEM_VARIABLE;
} else {
subject = variables[i - 1];
}
diff --git a/src/plugins/tracker/rygel-tracker-query-triplet.vala b/src/plugins/tracker/rygel-tracker-query-triplet.vala
index 5186478..e644892 100644
--- a/src/plugins/tracker/rygel-tracker-query-triplet.vala
+++ b/src/plugins/tracker/rygel-tracker-query-triplet.vala
@@ -32,15 +32,15 @@ public class Rygel.TrackerQueryTriplet {
public TrackerQueryTriplet next;
- public TrackerQueryTriplet (string? subject,
- string predicate,
- string obj) {
+ public TrackerQueryTriplet (string subject,
+ string predicate,
+ string obj) {
this.subject = subject;
this.predicate = predicate;
this.obj = obj;
}
- public TrackerQueryTriplet.chain (string? subject,
+ public TrackerQueryTriplet.chain (string subject,
string predicate,
TrackerQueryTriplet next) {
this.subject = subject;
@@ -75,10 +75,10 @@ public class Rygel.TrackerQueryTriplet {
chain_equal;
}
- public string to_string () {
+ public string to_string (bool include_subject = true) {
string str = "";
- if (this.subject != null) {
+ if (include_subject) {
str += " " + subject;
}
diff --git a/src/plugins/tracker/rygel-tracker-query.vala b/src/plugins/tracker/rygel-tracker-query.vala
index 1b3edfd..7d0a155 100644
--- a/src/plugins/tracker/rygel-tracker-query.vala
+++ b/src/plugins/tracker/rygel-tracker-query.vala
@@ -43,16 +43,18 @@ public abstract class Rygel.TrackerQuery {
private string serialize_triplets (TrackerQueryTriplets triplets) {
string str = "";
+ var include_subject = true;
for (int i = 0; i < triplets.size; i++) {
- str += triplets[i].to_string ();
+ str += triplets[i].to_string (include_subject);
if (i < triplets.size - 1) {
- if (triplets[i + 1].subject != null) {
+ include_subject = triplets[i].subject !=
+ triplets[i + 1].subject;
+
+ if (include_subject) {
str += " . ";
} else {
- // This implies that next triplet shares the subject with
- // this one so we need to end this one with a semi-colon.
str += " ; ";
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]