[tracker] libtracker-data: Added support for fn:lower-case



commit 67be56484f33c2feaec9031734d8e2a76f2a5857
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Apr 26 11:06:28 2010 +0200

    libtracker-data: Added support for fn:lower-case

 src/libtracker-data/tracker-sparql-expression.vala |    6 ++++++
 tests/libtracker-data/functions/Makefile.am        |    4 +++-
 .../functions/functions-xpath-6.out                |    5 +++++
 .../libtracker-data/functions/functions-xpath-6.rq |    9 +++++++++
 tests/libtracker-data/tracker-sparql-test.c        |    1 +
 5 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 853babc..c1682b3 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -402,6 +402,12 @@ class Tracker.Sparql.Expression : Object {
 			sql.append (" AS REAL)");
 
 			return PropertyType.DOUBLE;
+		} else if (uri == FN_NS + "lower-case") {
+			// conversion to string
+			sql.append ("lower (");
+			translate_expression_as_string (sql);
+			sql.append (")");
+			return PropertyType.STRING;
 		} else if (uri == FN_NS + "contains") {
 			// fn:contains('A','B') => 'A' GLOB '*B*'
 			sql.append ("(");
diff --git a/tests/libtracker-data/functions/Makefile.am b/tests/libtracker-data/functions/Makefile.am
index 20121ad..d26a7f3 100644
--- a/tests/libtracker-data/functions/Makefile.am
+++ b/tests/libtracker-data/functions/Makefile.am
@@ -24,4 +24,6 @@ EXTRA_DIST = 				\
 	functions-xpath-4.out		\
 	functions-xpath-4.rq		\
 	functions-xpath-5.out		\
-	functions-xpath-5.rq
+	functions-xpath-5.rq		\
+	functions-xpath-6.rq		\
+	functions-xpath-6.out
diff --git a/tests/libtracker-data/functions/functions-xpath-6.out b/tests/libtracker-data/functions/functions-xpath-6.out
new file mode 100644
index 0000000..593c2b3
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-xpath-6.out
@@ -0,0 +1,5 @@
+"testing"
+"purposes"
+"test"
+"text"
+"for"
diff --git a/tests/libtracker-data/functions/functions-xpath-6.rq b/tests/libtracker-data/functions/functions-xpath-6.rq
new file mode 100644
index 0000000..67fd91c
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-xpath-6.rq
@@ -0,0 +1,9 @@
+PREFIX ex: <http://example/>
+PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
+
+SELECT
+  fn:lower-case(?t)
+
+WHERE {
+  ?_x ex:t ?t .
+}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 866f114..2ce7805 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -84,6 +84,7 @@ const TestInfo tests[] = {
 	{ "functions/functions-xpath-3", "functions/data-1", FALSE },
 	{ "functions/functions-xpath-4", "functions/data-1", FALSE },
 	{ "functions/functions-xpath-5", "functions/data-1", FALSE },
+	{ "functions/functions-xpath-6", "functions/data-1", FALSE },
 	{ "graph/graph-1", "graph/data-1", FALSE },
 	{ "graph/graph-2", "graph/data-2", FALSE },
 	{ "graph/graph-3", "graph/data-3", FALSE },



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