[tracker] libtracker-data: Add SPARQL and ontology tests



commit 8b6922ebaa1f83b4b1e58799d272baf7a5fc29f4
Author: Jürg Billeter <j bitron ch>
Date:   Wed Apr 8 18:00:40 2009 +0200

    libtracker-data: Add SPARQL and ontology tests
---
 configure.ac                                       |    9 +
 tests/Makefile.am                                  |    1 +
 tests/libtracker-data/Makefile.am                  |   41 +++
 tests/libtracker-data/algebra/data-1.ontology      |   16 ++
 tests/libtracker-data/algebra/data-1.ttl           |    6 +
 tests/libtracker-data/algebra/filter-nested-1.out  |    1 +
 tests/libtracker-data/algebra/filter-nested-1.rq   |    4 +
 .../bnode-coreference/data.ontology                |   24 ++
 tests/libtracker-data/bnode-coreference/data.ttl   |   30 +++
 tests/libtracker-data/bnode-coreference/query.out  |    3 +
 tests/libtracker-data/bnode-coreference/query.rq   |    7 +
 tests/libtracker-data/bound/bound1.out             |    2 +
 tests/libtracker-data/bound/bound1.rq              |    9 +
 tests/libtracker-data/bound/data.ontology          |   19 ++
 tests/libtracker-data/bound/data.ttl               |   11 +
 tests/libtracker-data/dawg-testcases               |   52 ++++
 tests/libtracker-data/expr-ops/data.ontology       |   16 ++
 tests/libtracker-data/expr-ops/data.ttl            |   12 +
 tests/libtracker-data/expr-ops/query-ge-1.out      |    2 +
 tests/libtracker-data/expr-ops/query-ge-1.rq       |    5 +
 tests/libtracker-data/expr-ops/query-le-1.out      |    2 +
 tests/libtracker-data/expr-ops/query-le-1.rq       |    5 +
 tests/libtracker-data/expr-ops/query-minus-1.out   |    1 +
 tests/libtracker-data/expr-ops/query-minus-1.rq    |    6 +
 tests/libtracker-data/expr-ops/query-mul-1.out     |    3 +
 tests/libtracker-data/expr-ops/query-mul-1.rq      |    6 +
 tests/libtracker-data/expr-ops/query-plus-1.out    |    2 +
 tests/libtracker-data/expr-ops/query-plus-1.rq     |    6 +
 tests/libtracker-data/expr-ops/query-unminus-1.out |    1 +
 tests/libtracker-data/expr-ops/query-unminus-1.rq  |    5 +
 tests/libtracker-data/expr-ops/query-unplus-1.out  |    1 +
 tests/libtracker-data/expr-ops/query-unplus-1.rq   |    5 +
 tests/libtracker-data/nie/data-1.ttl               |   44 ++++
 .../libtracker-data/nie/filter-characterset-1.out  |    1 +
 tests/libtracker-data/nie/filter-characterset-1.rq |    3 +
 tests/libtracker-data/nie/filter-comment-1.out     |    1 +
 tests/libtracker-data/nie/filter-comment-1.rq      |    3 +
 tests/libtracker-data/nie/filter-description-1.out |    1 +
 tests/libtracker-data/nie/filter-description-1.rq  |    3 +
 tests/libtracker-data/nie/filter-generator-1.out   |    1 +
 tests/libtracker-data/nie/filter-generator-1.rq    |    3 +
 tests/libtracker-data/nie/filter-identifier-1.out  |    1 +
 tests/libtracker-data/nie/filter-identifier-1.rq   |    3 +
 tests/libtracker-data/nie/filter-keyword-1.out     |    1 +
 tests/libtracker-data/nie/filter-keyword-1.rq      |    3 +
 tests/libtracker-data/nie/filter-language-1.out    |    1 +
 tests/libtracker-data/nie/filter-language-1.rq     |    3 +
 tests/libtracker-data/nie/filter-legal-1.out       |    1 +
 tests/libtracker-data/nie/filter-legal-1.rq        |    3 +
 tests/libtracker-data/nie/filter-mimetype-1.out    |    1 +
 tests/libtracker-data/nie/filter-mimetype-1.rq     |    3 +
 .../nie/filter-plaintextcontent-1.out              |    1 +
 .../nie/filter-plaintextcontent-1.rq               |    3 +
 tests/libtracker-data/nie/filter-subject-1.out     |    1 +
 tests/libtracker-data/nie/filter-subject-1.rq      |    3 +
 tests/libtracker-data/nie/filter-title-1.out       |    1 +
 tests/libtracker-data/nie/filter-title-1.rq        |    3 +
 tests/libtracker-data/nie/filter-version-1.out     |    1 +
 tests/libtracker-data/nie/filter-version-1.rq      |    3 +
 tests/libtracker-data/nmo/data-1.ttl               |   62 +++++
 tests/libtracker-data/nmo/filter-boundary-1.out    |    1 +
 tests/libtracker-data/nmo/filter-boundary-1.rq     |    3 +
 tests/libtracker-data/nmo/filter-charset-1.out     |    1 +
 tests/libtracker-data/nmo/filter-charset-1.rq      |    3 +
 .../nmo/filter-contentdescription-1.out            |    1 +
 .../nmo/filter-contentdescription-1.rq             |    3 +
 tests/libtracker-data/nmo/filter-contentid-1.out   |    1 +
 tests/libtracker-data/nmo/filter-contentid-1.rq    |    3 +
 .../nmo/filter-contenttransferencoding-1.out       |    1 +
 .../nmo/filter-contenttransferencoding-1.rq        |    3 +
 tests/libtracker-data/nmo/filter-headername-1.out  |    1 +
 tests/libtracker-data/nmo/filter-headername-1.rq   |    3 +
 tests/libtracker-data/nmo/filter-headervalue-1.out |    1 +
 tests/libtracker-data/nmo/filter-headervalue-1.rq  |    3 +
 tests/libtracker-data/nmo/filter-isanswered-1.out  |    1 +
 tests/libtracker-data/nmo/filter-isanswered-1.rq   |    3 +
 tests/libtracker-data/nmo/filter-isdeleted-1.out   |    1 +
 tests/libtracker-data/nmo/filter-isdeleted-1.rq    |    3 +
 tests/libtracker-data/nmo/filter-isdraft-1.out     |    1 +
 tests/libtracker-data/nmo/filter-isdraft-1.rq      |    3 +
 tests/libtracker-data/nmo/filter-isflagged-1.out   |    1 +
 tests/libtracker-data/nmo/filter-isflagged-1.rq    |    3 +
 tests/libtracker-data/nmo/filter-isread-1.out      |    1 +
 tests/libtracker-data/nmo/filter-isread-1.rq       |    3 +
 tests/libtracker-data/nmo/filter-isrecent-1.out    |    1 +
 tests/libtracker-data/nmo/filter-isrecent-1.rq     |    3 +
 tests/libtracker-data/nmo/filter-messageid-1.out   |    1 +
 tests/libtracker-data/nmo/filter-messageid-1.rq    |    3 +
 .../nmo/filter-messagesubject-1.out                |    1 +
 .../libtracker-data/nmo/filter-messagesubject-1.rq |    3 +
 .../nmo/filter-plaintextmessagecontent-1.out       |    1 +
 .../nmo/filter-plaintextmessagecontent-1.rq        |    3 +
 tests/libtracker-data/regex/regex-data-01.ontology |   16 ++
 tests/libtracker-data/regex/regex-data-01.ttl      |    5 +
 tests/libtracker-data/regex/regex-query-001.out    |    1 +
 tests/libtracker-data/regex/regex-query-001.rq     |    8 +
 tests/libtracker-data/regex/regex-query-002.out    |    2 +
 tests/libtracker-data/regex/regex-query-002.rq     |    8 +
 tests/libtracker-data/sort/data-sort-1.ontology    |   20 ++
 tests/libtracker-data/sort/data-sort-1.ttl         |   13 +
 tests/libtracker-data/sort/data-sort-3.ontology    |   20 ++
 tests/libtracker-data/sort/data-sort-3.ttl         |   18 ++
 tests/libtracker-data/sort/data-sort-4.ontology    |   24 ++
 tests/libtracker-data/sort/data-sort-4.ttl         |   24 ++
 tests/libtracker-data/sort/query-sort-1.out        |    4 +
 tests/libtracker-data/sort/query-sort-1.rq         |    4 +
 tests/libtracker-data/sort/query-sort-2.out        |    4 +
 tests/libtracker-data/sort/query-sort-2.rq         |    4 +
 tests/libtracker-data/sort/query-sort-3.out        |    4 +
 tests/libtracker-data/sort/query-sort-3.rq         |    6 +
 tests/libtracker-data/sort/query-sort-4.out        |    5 +
 tests/libtracker-data/sort/query-sort-4.rq         |    8 +
 tests/libtracker-data/sort/query-sort-5.out        |    5 +
 tests/libtracker-data/sort/query-sort-5.rq         |    8 +
 tests/libtracker-data/tracker-ontology-test.c      |  255 ++++++++++++++++++++
 tests/libtracker-data/tracker-sparql-test.c        |  230 ++++++++++++++++++
 116 files changed, 1231 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 36dd472..f75f37c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,6 +203,14 @@ AC_SUBST(GCONF_LIBS)
 
 AM_CONDITIONAL(HAVE_GCONF, test "$have_gconf" = "yes")
 
+# Check for Streamanalyzer
+PKG_CHECK_MODULES(STREAMANALYZER, [libstreamanalyzer >= $STREAMANALYZER_REQUIRED],
+		  [have_streamanalyzer=yes], [have_streamanalyzer=no])
+AC_SUBST(STREAMANALYZER_CFLAGS)
+AC_SUBST(STREAMANALYZER_LIBS)
+
+AM_CONDITIONAL(HAVE_STREAMANALYZER, test "$have_streamanalyzer" = "yes")
+
 # Check for libuuid
 PKG_CHECK_MODULES(UUID, [uuid])
 AC_SUBST(UUID_CFLAGS)
@@ -1425,6 +1433,7 @@ AC_CONFIG_FILES([
 	src/plugins/rss/Makefile
 	tests/common/Makefile
 	tests/libtracker-common/Makefile
+	tests/libtracker-data/Makefile
 	tests/libtracker-db/Makefile
 	tests/Makefile
 	tests/tracker-indexer/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 72de412..03e5603 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,6 +3,7 @@ include $(top_srcdir)/Makefile.decl
 SUBDIRS = 			\
 	common 			\
 	libtracker-common	\
+	libtracker-data		\
 	libtracker-db 		\
 	tracker-indexer		\
 	tracker-extract
diff --git a/tests/libtracker-data/Makefile.am b/tests/libtracker-data/Makefile.am
new file mode 100644
index 0000000..69b2c11
--- /dev/null
+++ b/tests/libtracker-data/Makefile.am
@@ -0,0 +1,41 @@
+include $(top_srcdir)/Makefile.decl
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+TEST_PROGS += 								\
+	tracker-sparql							\
+	tracker-ontology
+
+INCLUDES = 								\
+	-DG_LOG_DOMAIN=\"Tracker\"					\
+	-DTRACKER_COMPILATION						\
+	-I$(top_srcdir)/src						\
+	-I$(top_srcdir)/tests/common					\
+	$(DBUS_CFLAGS)							\
+	$(SQLITE3_CFLAGS)						\
+	$(QDBM_CFLAGS)							\
+	$(GMODULE_CFLAGS)						\
+	$(GTHREAD_CFLAGS)						\
+	$(GLIB2_CFLAGS)							\
+	$(RAPTOR_CFLAGS)
+
+tracker_sparql_SOURCES = 						\
+	tracker-sparql-test.c
+
+common_ldadd =								\
+	$(top_builddir)/src/libtracker-common/libtracker-common.la 	\
+	$(top_builddir)/src/libtracker-db/libtracker-db.la	 	\
+	$(top_builddir)/src/libtracker-data/libtracker-data.la	 	\
+	$(GMODULE_LIBS)							\
+	$(GTHREAD_LIBS)							\
+	$(GLIB2_LIBS)							\
+	$(RAPTOR_LIBS)
+
+tracker_sparql_LDADD = $(common_ldadd)
+
+tracker_ontology_SOURCES =						\
+	tracker-ontology-test.c
+
+tracker_ontology_LDADD = $(common_ldadd)
+
+EXTRA_DIST = dawg-testcases
diff --git a/tests/libtracker-data/algebra/data-1.ontology b/tests/libtracker-data/algebra/data-1.ontology
new file mode 100644
index 0000000..e831f2a
--- /dev/null
+++ b/tests/libtracker-data/algebra/data-1.ontology
@@ -0,0 +1,16 @@
+ prefix example: <http://example/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:p a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range xsd:integer .
+
diff --git a/tests/libtracker-data/algebra/data-1.ttl b/tests/libtracker-data/algebra/data-1.ttl
new file mode 100644
index 0000000..4ce15fc
--- /dev/null
+++ b/tests/libtracker-data/algebra/data-1.ttl
@@ -0,0 +1,6 @@
+ prefix : <http://example/> .
+ prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
+
+:x a :A .
+:x :p "1"^^xsd:integer .
+
diff --git a/tests/libtracker-data/algebra/filter-nested-1.out b/tests/libtracker-data/algebra/filter-nested-1.out
new file mode 100644
index 0000000..f27b76c
--- /dev/null
+++ b/tests/libtracker-data/algebra/filter-nested-1.out
@@ -0,0 +1 @@
+"1"
diff --git a/tests/libtracker-data/algebra/filter-nested-1.rq b/tests/libtracker-data/algebra/filter-nested-1.rq
new file mode 100644
index 0000000..78f2853
--- /dev/null
+++ b/tests/libtracker-data/algebra/filter-nested-1.rq
@@ -0,0 +1,4 @@
+PREFIX : <http://example/> 
+
+SELECT ?v
+{ :x :p ?v . FILTER(?v = 1) }
diff --git a/tests/libtracker-data/bnode-coreference/data.ontology b/tests/libtracker-data/bnode-coreference/data.ontology
new file mode 100644
index 0000000..ca4c996
--- /dev/null
+++ b/tests/libtracker-data/bnode-coreference/data.ontology
@@ -0,0 +1,24 @@
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+foaf: a tracker:Namespace ;
+	tracker:prefix "foaf" .
+
+foaf:Person a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+foaf:knows a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range foaf:Person .
+
+foaf:mbox a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range rdfs:Resource .
+
+foaf:name a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range xsd:string .
+
diff --git a/tests/libtracker-data/bnode-coreference/data.ttl b/tests/libtracker-data/bnode-coreference/data.ttl
new file mode 100755
index 0000000..5f0613f
--- /dev/null
+++ b/tests/libtracker-data/bnode-coreference/data.ttl
@@ -0,0 +1,30 @@
+ prefix foaf:       <http://xmlns.com/foaf/0.1/> .
+ prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs:	    <http://www.w3.org/2000/01/rdf-schema#> .
+
+_:alice
+    rdf:type        foaf:Person ;
+    foaf:name       "Alice" ;
+    foaf:mbox       <mailto:alice work> ;
+    foaf:knows      _:bob ;
+    .
+
+_:bob
+    rdf:type        foaf:Person ;
+    foaf:name       "Bob" ; 
+    foaf:knows      _:alice ;
+    foaf:mbox       <mailto:bob work> ;
+    foaf:mbox       <mailto:bob home> ;
+    .
+
+
+_:eve
+    rdf:type      foaf:Person ;
+    foaf:name     "Eve" ; 
+    foaf:knows    _:fred ;
+    .
+
+_:fred
+    rdf:type      foaf:Person ;
+    foaf:name     "Fred" ;
+    foaf:mbox     <mailto:fred edu> .
diff --git a/tests/libtracker-data/bnode-coreference/query.out b/tests/libtracker-data/bnode-coreference/query.out
new file mode 100755
index 0000000..418f404
--- /dev/null
+++ b/tests/libtracker-data/bnode-coreference/query.out
@@ -0,0 +1,3 @@
+"Alice"	"Bob"
+"Bob"	"Alice"
+"Eve"	"Fred"
diff --git a/tests/libtracker-data/bnode-coreference/query.rq b/tests/libtracker-data/bnode-coreference/query.rq
new file mode 100755
index 0000000..c220785
--- /dev/null
+++ b/tests/libtracker-data/bnode-coreference/query.rq
@@ -0,0 +1,7 @@
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
+PREFIX  foaf:       <http://xmlns.com/foaf/0.1/>
+
+SELECT ?x ?y
+WHERE {
+  [ foaf:name ?x ] foaf:knows [ foaf:name ?y ] .
+}
diff --git a/tests/libtracker-data/bound/bound1.out b/tests/libtracker-data/bound/bound1.out
new file mode 100644
index 0000000..134797f
--- /dev/null
+++ b/tests/libtracker-data/bound/bound1.out
@@ -0,0 +1,2 @@
+"http://example.org/ns#a2";	"http://example.org/ns#c2";
+"http://example.org/ns#c2";	"http://example.org/ns#f";
diff --git a/tests/libtracker-data/bound/bound1.rq b/tests/libtracker-data/bound/bound1.rq
new file mode 100755
index 0000000..bb21d4f
--- /dev/null
+++ b/tests/libtracker-data/bound/bound1.rq
@@ -0,0 +1,9 @@
+PREFIX  : <http://example.org/ns#>
+SELECT  ?a ?c
+WHERE
+    { ?a :b ?c . 
+      OPTIONAL
+        { ?c :d ?e } . 
+      FILTER (! bound(?e)) 
+    }
+ORDER BY ?a
diff --git a/tests/libtracker-data/bound/data.ontology b/tests/libtracker-data/bound/data.ontology
new file mode 100644
index 0000000..3154265
--- /dev/null
+++ b/tests/libtracker-data/bound/data.ontology
@@ -0,0 +1,19 @@
+ prefix example: <http://example.org/ns#> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:b a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range rdfs:Resource .
+
+example:d a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range rdfs:Resource .
+
diff --git a/tests/libtracker-data/bound/data.ttl b/tests/libtracker-data/bound/data.ttl
new file mode 100644
index 0000000..7ee5d37
--- /dev/null
+++ b/tests/libtracker-data/bound/data.ttl
@@ -0,0 +1,11 @@
+ prefix : <http://example.org/ns#> .
+
+:a1 a :A .
+:a2 a :A .
+:c1 a :A .
+:c2 a :A .
+
+:a1 :b :c1 . 
+:c1 :d :e . 
+:a2 :b :c2 .
+:c2 :b :f .
diff --git a/tests/libtracker-data/dawg-testcases b/tests/libtracker-data/dawg-testcases
new file mode 100644
index 0000000..4172fa3
--- /dev/null
+++ b/tests/libtracker-data/dawg-testcases
@@ -0,0 +1,52 @@
+The test material in the subdirectories of tests/libtracker-data is based on
+the DAWG Testcases, which are licensed under the W3C Software License,
+reproduced below.
+
+The test data has been extended by type information to be usable with
+libtracker-data in January 2009. The original DAWG Testcases can be found at
+http://www.w3.org/2001/sw/DataAccess/tests/r2
+
+
+
+W3C(R) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the
+following license. By obtaining, using and/or copying this work, you (the
+licensee) agree that you have read, understood, and will comply with the
+following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without
+fee or royalty is hereby granted, provided that you include the following
+on ALL copies of the software and documentation or portions thereof,
+including modifications:
+
+   1. The full text of this NOTICE in a location viewable to users of the
+   redistributed or derivative work.
+
+   2. Any pre-existing intellectual property disclaimers, notices, or terms
+   and conditions. If none exist, the W3C Software Short Notice should be
+   included (hypertext is preferred, text is permitted) within the body of
+   any redistributed or derivative code.
+
+   3. Notice of any changes or modifications to the files, including the
+   date changes were made. (We recommend you provide URIs to the location
+   from which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
+ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising
+or publicity pertaining to the software without specific, written prior
+permission. Title to copyright in this software and any associated
+documentation will at all times remain with copyright holders.  
+
diff --git a/tests/libtracker-data/expr-ops/data.ontology b/tests/libtracker-data/expr-ops/data.ontology
new file mode 100644
index 0000000..5f0401f
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/data.ontology
@@ -0,0 +1,16 @@
+ prefix example: <http://example.org/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:p a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range xsd:integer .
+
diff --git a/tests/libtracker-data/expr-ops/data.ttl b/tests/libtracker-data/expr-ops/data.ttl
new file mode 100644
index 0000000..5429c77
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/data.ttl
@@ -0,0 +1,12 @@
+ prefix : <http://example.org/> .
+ prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
+
+:x1 a :A .
+:x2 a :A .
+:x3 a :A .
+:x4 a :A .
+
+:x1 :p "1"^^xsd:integer .
+:x2 :p "2"^^xsd:integer .
+:x3 :p "3"^^xsd:integer .
+:x4 :p "4"^^xsd:integer .
diff --git a/tests/libtracker-data/expr-ops/query-ge-1.out b/tests/libtracker-data/expr-ops/query-ge-1.out
new file mode 100755
index 0000000..eea7547
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-ge-1.out
@@ -0,0 +1,2 @@
+"http://example.org/x3";
+"http://example.org/x4";
diff --git a/tests/libtracker-data/expr-ops/query-ge-1.rq b/tests/libtracker-data/expr-ops/query-ge-1.rq
new file mode 100755
index 0000000..9e5c52d
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-ge-1.rq
@@ -0,0 +1,5 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    FILTER(?o >= 3) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-le-1.out b/tests/libtracker-data/expr-ops/query-le-1.out
new file mode 100755
index 0000000..7ac38aa
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-le-1.out
@@ -0,0 +1,2 @@
+"http://example.org/x1";
+"http://example.org/x2";
diff --git a/tests/libtracker-data/expr-ops/query-le-1.rq b/tests/libtracker-data/expr-ops/query-le-1.rq
new file mode 100755
index 0000000..a99b7d3
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-le-1.rq
@@ -0,0 +1,5 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    FILTER(?o <= 2) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-minus-1.out b/tests/libtracker-data/expr-ops/query-minus-1.out
new file mode 100755
index 0000000..220102f
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-minus-1.out
@@ -0,0 +1 @@
+"http://example.org/x4";
diff --git a/tests/libtracker-data/expr-ops/query-minus-1.rq b/tests/libtracker-data/expr-ops/query-minus-1.rq
new file mode 100755
index 0000000..802b438
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-minus-1.rq
@@ -0,0 +1,6 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    ?s2 :p ?o2 .
+    FILTER(?o - ?o2 = 3) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-mul-1.out b/tests/libtracker-data/expr-ops/query-mul-1.out
new file mode 100755
index 0000000..adf43de
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-mul-1.out
@@ -0,0 +1,3 @@
+"http://example.org/x1";
+"http://example.org/x2";
+"http://example.org/x4";
diff --git a/tests/libtracker-data/expr-ops/query-mul-1.rq b/tests/libtracker-data/expr-ops/query-mul-1.rq
new file mode 100755
index 0000000..41773f5
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-mul-1.rq
@@ -0,0 +1,6 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    ?s2 :p ?o2 .
+    FILTER(?o * ?o2 = 4) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-plus-1.out b/tests/libtracker-data/expr-ops/query-plus-1.out
new file mode 100755
index 0000000..7ac38aa
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-plus-1.out
@@ -0,0 +1,2 @@
+"http://example.org/x1";
+"http://example.org/x2";
diff --git a/tests/libtracker-data/expr-ops/query-plus-1.rq b/tests/libtracker-data/expr-ops/query-plus-1.rq
new file mode 100755
index 0000000..150793a
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-plus-1.rq
@@ -0,0 +1,6 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    ?s2 :p ?o2 .
+    FILTER(?o + ?o2 = 3) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-unminus-1.out b/tests/libtracker-data/expr-ops/query-unminus-1.out
new file mode 100755
index 0000000..c3acf84
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-unminus-1.out
@@ -0,0 +1 @@
+"http://example.org/x2";
diff --git a/tests/libtracker-data/expr-ops/query-unminus-1.rq b/tests/libtracker-data/expr-ops/query-unminus-1.rq
new file mode 100755
index 0000000..f308628
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-unminus-1.rq
@@ -0,0 +1,5 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    FILTER(-?o = -2) .
+}
diff --git a/tests/libtracker-data/expr-ops/query-unplus-1.out b/tests/libtracker-data/expr-ops/query-unplus-1.out
new file mode 100755
index 0000000..c3b11c9
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-unplus-1.out
@@ -0,0 +1 @@
+"http://example.org/x3";
diff --git a/tests/libtracker-data/expr-ops/query-unplus-1.rq b/tests/libtracker-data/expr-ops/query-unplus-1.rq
new file mode 100755
index 0000000..b9ca53c
--- /dev/null
+++ b/tests/libtracker-data/expr-ops/query-unplus-1.rq
@@ -0,0 +1,5 @@
+PREFIX : <http://example.org/>
+SELECT ?s WHERE {
+    ?s :p ?o .
+    FILTER(?o = +3) .
+}
diff --git a/tests/libtracker-data/nie/data-1.ttl b/tests/libtracker-data/nie/data-1.ttl
new file mode 100644
index 0000000..636b77b
--- /dev/null
+++ b/tests/libtracker-data/nie/data-1.ttl
@@ -0,0 +1,44 @@
+
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix owl: <http://www.w3.org/2002/07/owl#> .
+ prefix xsl: <http://www.w3.org/1999/XSL/Transform#> .
+ prefix nid3: <http://www.semanticdesktop.org/ontologies/2007/05/10/nid3#> .
+ prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
+ prefix nmo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#> .
+ prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> .
+ prefix exif: <http://www.kanzaki.com/ns/exif#> .
+ prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix protege: <http://protege.stanford.edu/system#> .
+ prefix dcterms: <http://purl.org/dc/terms/> .
+ prefix ncal: <http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ prefix pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#> .
+ prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ prefix tmo: <http://www.semanticdesktop.org/ontologies/2008/05/20/tmo#> .
+ prefix dc: <http://purl.org/dc/elements/1.1/> .
+ prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> .
+ prefix nexif: <http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#> .
+
+_:a1 a nie:DataObject .
+
+_:a2 a nie:DataSource .
+
+_:a3 a nie:InformationElement .
+
+_:a3 nie:generator "stringly data for nie:generator" .
+_:a3 nie:description "stringly data for nie:description" .
+_:a3 nie:comment "stringly data for nie:comment" .
+_:a3 nie:mimeType "stringly data for nie:mimeType" .
+_:a3 nie:plainTextContent "stringly data for nie:plainTextContent" .
+_:a3 nie:version "stringly data for nie:version" .
+_:a3 nie:subject "stringly data for nie:subject" .
+_:a3 nie:identifier "stringly data for nie:identifier" .
+_:a3 nie:keyword "stringly data for nie:keyword" .
+_:a3 nie:title "stringly data for nie:title" .
+_:a3 nie:legal "stringly data for nie:legal" .
+_:a3 nie:characterSet "stringly data for nie:characterSet" .
+_:a3 nie:language "stringly data for nie:language" .
+
diff --git a/tests/libtracker-data/nie/filter-characterset-1.out b/tests/libtracker-data/nie/filter-characterset-1.out
new file mode 100644
index 0000000..8a557b8
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-characterset-1.out
@@ -0,0 +1 @@
+"stringly data for nie:characterSet"
diff --git a/tests/libtracker-data/nie/filter-characterset-1.rq b/tests/libtracker-data/nie/filter-characterset-1.rq
new file mode 100644
index 0000000..3bd16be
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-characterset-1.rq
@@ -0,0 +1,3 @@
+SELECT ?characterSet
+WHERE { ?x nie:characterSet ?characterSet }
+ORDER BY ?characterSet
diff --git a/tests/libtracker-data/nie/filter-comment-1.out b/tests/libtracker-data/nie/filter-comment-1.out
new file mode 100644
index 0000000..56f40df
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-comment-1.out
@@ -0,0 +1 @@
+"stringly data for nie:comment"
diff --git a/tests/libtracker-data/nie/filter-comment-1.rq b/tests/libtracker-data/nie/filter-comment-1.rq
new file mode 100644
index 0000000..aa6a1a0
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-comment-1.rq
@@ -0,0 +1,3 @@
+SELECT ?comment
+WHERE { ?x nie:comment ?comment }
+ORDER BY ?comment
diff --git a/tests/libtracker-data/nie/filter-description-1.out b/tests/libtracker-data/nie/filter-description-1.out
new file mode 100644
index 0000000..2211470
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-description-1.out
@@ -0,0 +1 @@
+"stringly data for nie:description"
diff --git a/tests/libtracker-data/nie/filter-description-1.rq b/tests/libtracker-data/nie/filter-description-1.rq
new file mode 100644
index 0000000..77deb9a
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-description-1.rq
@@ -0,0 +1,3 @@
+SELECT ?description
+WHERE { ?x nie:description ?description }
+ORDER BY ?description
diff --git a/tests/libtracker-data/nie/filter-generator-1.out b/tests/libtracker-data/nie/filter-generator-1.out
new file mode 100644
index 0000000..296574b
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-generator-1.out
@@ -0,0 +1 @@
+"stringly data for nie:generator"
diff --git a/tests/libtracker-data/nie/filter-generator-1.rq b/tests/libtracker-data/nie/filter-generator-1.rq
new file mode 100644
index 0000000..6fbcdb7
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-generator-1.rq
@@ -0,0 +1,3 @@
+SELECT ?generator
+WHERE { ?x nie:generator ?generator }
+ORDER BY ?generator
diff --git a/tests/libtracker-data/nie/filter-identifier-1.out b/tests/libtracker-data/nie/filter-identifier-1.out
new file mode 100644
index 0000000..cf941f7
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-identifier-1.out
@@ -0,0 +1 @@
+"stringly data for nie:identifier"
diff --git a/tests/libtracker-data/nie/filter-identifier-1.rq b/tests/libtracker-data/nie/filter-identifier-1.rq
new file mode 100644
index 0000000..1d0a56f
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-identifier-1.rq
@@ -0,0 +1,3 @@
+SELECT ?identifier
+WHERE { ?x nie:identifier ?identifier }
+ORDER BY ?identifier
diff --git a/tests/libtracker-data/nie/filter-keyword-1.out b/tests/libtracker-data/nie/filter-keyword-1.out
new file mode 100644
index 0000000..7f1715a
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-keyword-1.out
@@ -0,0 +1 @@
+"stringly data for nie:keyword"
diff --git a/tests/libtracker-data/nie/filter-keyword-1.rq b/tests/libtracker-data/nie/filter-keyword-1.rq
new file mode 100644
index 0000000..618c36c
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-keyword-1.rq
@@ -0,0 +1,3 @@
+SELECT ?keyword
+WHERE { ?x nie:keyword ?keyword }
+ORDER BY ?keyword
diff --git a/tests/libtracker-data/nie/filter-language-1.out b/tests/libtracker-data/nie/filter-language-1.out
new file mode 100644
index 0000000..0b8fd1c
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-language-1.out
@@ -0,0 +1 @@
+"stringly data for nie:language"
diff --git a/tests/libtracker-data/nie/filter-language-1.rq b/tests/libtracker-data/nie/filter-language-1.rq
new file mode 100644
index 0000000..ae857b7
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-language-1.rq
@@ -0,0 +1,3 @@
+SELECT ?language
+WHERE { ?x nie:language ?language }
+ORDER BY ?language
diff --git a/tests/libtracker-data/nie/filter-legal-1.out b/tests/libtracker-data/nie/filter-legal-1.out
new file mode 100644
index 0000000..4651a9b
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-legal-1.out
@@ -0,0 +1 @@
+"stringly data for nie:legal"
diff --git a/tests/libtracker-data/nie/filter-legal-1.rq b/tests/libtracker-data/nie/filter-legal-1.rq
new file mode 100644
index 0000000..f103112
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-legal-1.rq
@@ -0,0 +1,3 @@
+SELECT ?legal
+WHERE { ?x nie:legal ?legal }
+ORDER BY ?legal
diff --git a/tests/libtracker-data/nie/filter-mimetype-1.out b/tests/libtracker-data/nie/filter-mimetype-1.out
new file mode 100644
index 0000000..f9a118e
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-mimetype-1.out
@@ -0,0 +1 @@
+"stringly data for nie:mimeType"
diff --git a/tests/libtracker-data/nie/filter-mimetype-1.rq b/tests/libtracker-data/nie/filter-mimetype-1.rq
new file mode 100644
index 0000000..d4405f2
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-mimetype-1.rq
@@ -0,0 +1,3 @@
+SELECT ?mimeType
+WHERE { ?x nie:mimeType ?mimeType }
+ORDER BY ?mimeType
diff --git a/tests/libtracker-data/nie/filter-plaintextcontent-1.out b/tests/libtracker-data/nie/filter-plaintextcontent-1.out
new file mode 100644
index 0000000..26b3c47
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-plaintextcontent-1.out
@@ -0,0 +1 @@
+"stringly data for nie:plainTextContent"
diff --git a/tests/libtracker-data/nie/filter-plaintextcontent-1.rq b/tests/libtracker-data/nie/filter-plaintextcontent-1.rq
new file mode 100644
index 0000000..815703e
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-plaintextcontent-1.rq
@@ -0,0 +1,3 @@
+SELECT ?plainTextContent
+WHERE { ?x nie:plainTextContent ?plainTextContent }
+ORDER BY ?plainTextContent
diff --git a/tests/libtracker-data/nie/filter-subject-1.out b/tests/libtracker-data/nie/filter-subject-1.out
new file mode 100644
index 0000000..ea24862
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-subject-1.out
@@ -0,0 +1 @@
+"stringly data for nie:subject"
diff --git a/tests/libtracker-data/nie/filter-subject-1.rq b/tests/libtracker-data/nie/filter-subject-1.rq
new file mode 100644
index 0000000..c1ec33e
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-subject-1.rq
@@ -0,0 +1,3 @@
+SELECT ?subject
+WHERE { ?x nie:subject ?subject }
+ORDER BY ?subject
diff --git a/tests/libtracker-data/nie/filter-title-1.out b/tests/libtracker-data/nie/filter-title-1.out
new file mode 100644
index 0000000..8137540
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-title-1.out
@@ -0,0 +1 @@
+"stringly data for nie:title"
diff --git a/tests/libtracker-data/nie/filter-title-1.rq b/tests/libtracker-data/nie/filter-title-1.rq
new file mode 100644
index 0000000..294e10b
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-title-1.rq
@@ -0,0 +1,3 @@
+SELECT ?title
+WHERE { ?x nie:title ?title }
+ORDER BY ?title
diff --git a/tests/libtracker-data/nie/filter-version-1.out b/tests/libtracker-data/nie/filter-version-1.out
new file mode 100644
index 0000000..695be71
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-version-1.out
@@ -0,0 +1 @@
+"stringly data for nie:version"
diff --git a/tests/libtracker-data/nie/filter-version-1.rq b/tests/libtracker-data/nie/filter-version-1.rq
new file mode 100644
index 0000000..def2eac
--- /dev/null
+++ b/tests/libtracker-data/nie/filter-version-1.rq
@@ -0,0 +1,3 @@
+SELECT ?version
+WHERE { ?x nie:version ?version }
+ORDER BY ?version
diff --git a/tests/libtracker-data/nmo/data-1.ttl b/tests/libtracker-data/nmo/data-1.ttl
new file mode 100644
index 0000000..46f1a49
--- /dev/null
+++ b/tests/libtracker-data/nmo/data-1.ttl
@@ -0,0 +1,62 @@
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix owl: <http://www.w3.org/2002/07/owl#> .
+ prefix xsl: <http://www.w3.org/1999/XSL/Transform#> .
+ prefix nid3: <http://www.semanticdesktop.org/ontologies/2007/05/10/nid3#> .
+ prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
+ prefix nmo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#> .
+ prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> .
+ prefix exif: <http://www.kanzaki.com/ns/exif#> .
+ prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix protege: <http://protege.stanford.edu/system#> .
+ prefix dcterms: <http://purl.org/dc/terms/> .
+ prefix ncal: <http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ prefix pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#> .
+ prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ prefix tmo: <http://www.semanticdesktop.org/ontologies/2008/05/20/tmo#> .
+ prefix dc: <http://purl.org/dc/elements/1.1/> .
+ prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> .
+ prefix nexif: <http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#> .
+
+_:a1 a nmo:Message .
+
+_:a1 nmo:messageSubject "stringly data for nmo:messageSubject" .
+_:a1 nmo:isRead "stringly data for nmo:isRead" .
+_:a1 nmo:plainTextMessageContent "stringly data for nmo:plainTextMessageContent" .
+_:a1 nmo:messageId "stringly data for nmo:messageId" .
+
+_:a2 a nmo:Mailbox .
+
+_:a3 a nmo:IMMessage .
+
+_:a4 a nmo:MailboxDataObject .
+
+_:a5 a nmo:PermanentChannel .
+
+_:a6 a nmo:Email .
+
+_:a6 nmo:isFlagged true .
+_:a6 nmo:isDraft false .
+_:a6 nmo:isDeleted "false" .
+_:a6 nmo:isAnswered true .
+_:a6 nmo:isRecent "true" .
+_:a7 a nmo:MimePart .
+
+_:a7 nmo:contentId "stringly data for nmo:contentId" .
+_:a7 nmo:charSet "stringly data for nmo:charSet" .
+_:a7 nmo:contentTransferEncoding "stringly data for nmo:contentTransferEncoding" .
+_:a7 nmo:contentDescription "stringly data for nmo:contentDescription" .
+_:a8 a nmo:TransientChannel .
+
+_:a9 a nmo:Attachment .
+
+_:a10 a nmo:CommunicationChannel .
+
+_:a11 a nmo:MessageHeader .
+
+_:a11 nmo:headerName "stringly data for nmo:headerName" .
+_:a11 nmo:headerValue "stringly data for nmo:headerValue" .
+
diff --git a/tests/libtracker-data/nmo/filter-boundary-1.out b/tests/libtracker-data/nmo/filter-boundary-1.out
new file mode 100644
index 0000000..a3fd7ef
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-boundary-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:boundary"
diff --git a/tests/libtracker-data/nmo/filter-boundary-1.rq b/tests/libtracker-data/nmo/filter-boundary-1.rq
new file mode 100644
index 0000000..5feca46
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-boundary-1.rq
@@ -0,0 +1,3 @@
+SELECT ?boundary
+WHERE { ?x nmo:boundary ?boundary }
+ORDER BY ?boundary
diff --git a/tests/libtracker-data/nmo/filter-charset-1.out b/tests/libtracker-data/nmo/filter-charset-1.out
new file mode 100644
index 0000000..68cf1e0
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-charset-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:charSet"
diff --git a/tests/libtracker-data/nmo/filter-charset-1.rq b/tests/libtracker-data/nmo/filter-charset-1.rq
new file mode 100644
index 0000000..2cb088d
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-charset-1.rq
@@ -0,0 +1,3 @@
+SELECT ?charSet
+WHERE { ?x nmo:charSet ?charSet }
+ORDER BY ?charSet
diff --git a/tests/libtracker-data/nmo/filter-contentdescription-1.out b/tests/libtracker-data/nmo/filter-contentdescription-1.out
new file mode 100644
index 0000000..7c939f6
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contentdescription-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:contentDescription"
diff --git a/tests/libtracker-data/nmo/filter-contentdescription-1.rq b/tests/libtracker-data/nmo/filter-contentdescription-1.rq
new file mode 100644
index 0000000..ca6ee2f
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contentdescription-1.rq
@@ -0,0 +1,3 @@
+SELECT ?contentDescription
+WHERE { ?x nmo:contentDescription ?contentDescription }
+ORDER BY ?contentDescription
diff --git a/tests/libtracker-data/nmo/filter-contentid-1.out b/tests/libtracker-data/nmo/filter-contentid-1.out
new file mode 100644
index 0000000..2e619e2
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contentid-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:contentId"
diff --git a/tests/libtracker-data/nmo/filter-contentid-1.rq b/tests/libtracker-data/nmo/filter-contentid-1.rq
new file mode 100644
index 0000000..7cee1bf
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contentid-1.rq
@@ -0,0 +1,3 @@
+SELECT ?contentId
+WHERE { ?x nmo:contentId ?contentId }
+ORDER BY ?contentId
diff --git a/tests/libtracker-data/nmo/filter-contenttransferencoding-1.out b/tests/libtracker-data/nmo/filter-contenttransferencoding-1.out
new file mode 100644
index 0000000..deafa93
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contenttransferencoding-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:contentTransferEncoding"
diff --git a/tests/libtracker-data/nmo/filter-contenttransferencoding-1.rq b/tests/libtracker-data/nmo/filter-contenttransferencoding-1.rq
new file mode 100644
index 0000000..17ba448
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-contenttransferencoding-1.rq
@@ -0,0 +1,3 @@
+SELECT ?contentTransferEncoding
+WHERE { ?x nmo:contentTransferEncoding ?contentTransferEncoding }
+ORDER BY ?contentTransferEncoding
diff --git a/tests/libtracker-data/nmo/filter-headername-1.out b/tests/libtracker-data/nmo/filter-headername-1.out
new file mode 100644
index 0000000..d8ab2fa
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-headername-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:headerName"
diff --git a/tests/libtracker-data/nmo/filter-headername-1.rq b/tests/libtracker-data/nmo/filter-headername-1.rq
new file mode 100644
index 0000000..42b1a18
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-headername-1.rq
@@ -0,0 +1,3 @@
+SELECT ?headerName
+WHERE { ?x nmo:headerName ?headerName }
+ORDER BY ?headerName
diff --git a/tests/libtracker-data/nmo/filter-headervalue-1.out b/tests/libtracker-data/nmo/filter-headervalue-1.out
new file mode 100644
index 0000000..21d48d8
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-headervalue-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:headerValue"
diff --git a/tests/libtracker-data/nmo/filter-headervalue-1.rq b/tests/libtracker-data/nmo/filter-headervalue-1.rq
new file mode 100644
index 0000000..60cb3f3
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-headervalue-1.rq
@@ -0,0 +1,3 @@
+SELECT ?headerValue
+WHERE { ?x nmo:headerValue ?headerValue }
+ORDER BY ?headerValue
diff --git a/tests/libtracker-data/nmo/filter-isanswered-1.out b/tests/libtracker-data/nmo/filter-isanswered-1.out
new file mode 100644
index 0000000..8268615
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isanswered-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/nmo/filter-isanswered-1.rq b/tests/libtracker-data/nmo/filter-isanswered-1.rq
new file mode 100644
index 0000000..1558998
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isanswered-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isAnswered
+WHERE { ?x nmo:isAnswered ?isAnswered }
+ORDER BY ?isAnswered
diff --git a/tests/libtracker-data/nmo/filter-isdeleted-1.out b/tests/libtracker-data/nmo/filter-isdeleted-1.out
new file mode 100644
index 0000000..d24842c
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isdeleted-1.out
@@ -0,0 +1 @@
+"false"
diff --git a/tests/libtracker-data/nmo/filter-isdeleted-1.rq b/tests/libtracker-data/nmo/filter-isdeleted-1.rq
new file mode 100644
index 0000000..054d96f
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isdeleted-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isDeleted
+WHERE { ?x nmo:isDeleted ?isDeleted }
+ORDER BY ?isDeleted
diff --git a/tests/libtracker-data/nmo/filter-isdraft-1.out b/tests/libtracker-data/nmo/filter-isdraft-1.out
new file mode 100644
index 0000000..d24842c
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isdraft-1.out
@@ -0,0 +1 @@
+"false"
diff --git a/tests/libtracker-data/nmo/filter-isdraft-1.rq b/tests/libtracker-data/nmo/filter-isdraft-1.rq
new file mode 100644
index 0000000..f6f660c
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isdraft-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isDraft
+WHERE { ?x nmo:isDraft ?isDraft }
+ORDER BY ?isDraft
diff --git a/tests/libtracker-data/nmo/filter-isflagged-1.out b/tests/libtracker-data/nmo/filter-isflagged-1.out
new file mode 100644
index 0000000..8268615
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isflagged-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/nmo/filter-isflagged-1.rq b/tests/libtracker-data/nmo/filter-isflagged-1.rq
new file mode 100644
index 0000000..2fa36f4
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isflagged-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isFlagged
+WHERE { ?x nmo:isFlagged ?isFlagged }
+ORDER BY ?isFlagged
diff --git a/tests/libtracker-data/nmo/filter-isread-1.out b/tests/libtracker-data/nmo/filter-isread-1.out
new file mode 100644
index 0000000..d24842c
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isread-1.out
@@ -0,0 +1 @@
+"false"
diff --git a/tests/libtracker-data/nmo/filter-isread-1.rq b/tests/libtracker-data/nmo/filter-isread-1.rq
new file mode 100644
index 0000000..68fec40
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isread-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isRead
+WHERE { ?x nmo:isRead ?isRead }
+ORDER BY ?isRead
diff --git a/tests/libtracker-data/nmo/filter-isrecent-1.out b/tests/libtracker-data/nmo/filter-isrecent-1.out
new file mode 100644
index 0000000..8268615
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isrecent-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/nmo/filter-isrecent-1.rq b/tests/libtracker-data/nmo/filter-isrecent-1.rq
new file mode 100644
index 0000000..22f42e7
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-isrecent-1.rq
@@ -0,0 +1,3 @@
+SELECT ?isRecent
+WHERE { ?x nmo:isRecent ?isRecent }
+ORDER BY ?isRecent
diff --git a/tests/libtracker-data/nmo/filter-messageid-1.out b/tests/libtracker-data/nmo/filter-messageid-1.out
new file mode 100644
index 0000000..500f5ed
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-messageid-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:messageId"
diff --git a/tests/libtracker-data/nmo/filter-messageid-1.rq b/tests/libtracker-data/nmo/filter-messageid-1.rq
new file mode 100644
index 0000000..23d66cc
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-messageid-1.rq
@@ -0,0 +1,3 @@
+SELECT ?messageId
+WHERE { ?x nmo:messageId ?messageId }
+ORDER BY ?messageId
diff --git a/tests/libtracker-data/nmo/filter-messagesubject-1.out b/tests/libtracker-data/nmo/filter-messagesubject-1.out
new file mode 100644
index 0000000..ff1e087
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-messagesubject-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:messageSubject"
diff --git a/tests/libtracker-data/nmo/filter-messagesubject-1.rq b/tests/libtracker-data/nmo/filter-messagesubject-1.rq
new file mode 100644
index 0000000..641fca2
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-messagesubject-1.rq
@@ -0,0 +1,3 @@
+SELECT ?messageSubject
+WHERE { ?x nmo:messageSubject ?messageSubject }
+ORDER BY ?messageSubject
diff --git a/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.out b/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.out
new file mode 100644
index 0000000..69fef77
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.out
@@ -0,0 +1 @@
+"stringly data for nmo:plainTextMessageContent"
diff --git a/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.rq b/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.rq
new file mode 100644
index 0000000..325349e
--- /dev/null
+++ b/tests/libtracker-data/nmo/filter-plaintextmessagecontent-1.rq
@@ -0,0 +1,3 @@
+SELECT ?plainTextMessageContent
+WHERE { ?x nmo:plainTextMessageContent ?plainTextMessageContent }
+ORDER BY ?plainTextMessageContent
diff --git a/tests/libtracker-data/regex/regex-data-01.ontology b/tests/libtracker-data/regex/regex-data-01.ontology
new file mode 100644
index 0000000..c041ffd
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-data-01.ontology
@@ -0,0 +1,16 @@
+ prefix example: <http://example.com/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+rdf:value a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range xsd:string .
+
diff --git a/tests/libtracker-data/regex/regex-data-01.ttl b/tests/libtracker-data/regex/regex-data-01.ttl
new file mode 100755
index 0000000..930f1b7
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-data-01.ttl
@@ -0,0 +1,5 @@
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix ex: <http://example.com/#> .
+
+ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789",
+	<http://example.com/uri>, "http://example.com/literal"; .
diff --git a/tests/libtracker-data/regex/regex-query-001.out b/tests/libtracker-data/regex/regex-query-001.out
new file mode 100755
index 0000000..dae9fc8
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-query-001.out
@@ -0,0 +1 @@
+"ABCdefGHIjkl"
diff --git a/tests/libtracker-data/regex/regex-query-001.rq b/tests/libtracker-data/regex/regex-query-001.rq
new file mode 100755
index 0000000..3c8f661
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-query-001.rq
@@ -0,0 +1,8 @@
+PREFIX  rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX  ex: <http://example.com/#>
+
+SELECT ?val
+WHERE {
+	ex:foo rdf:value ?val .
+	FILTER regex(?val, "GHI")
+}
diff --git a/tests/libtracker-data/regex/regex-query-002.out b/tests/libtracker-data/regex/regex-query-002.out
new file mode 100755
index 0000000..aacdf96
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-query-002.out
@@ -0,0 +1,2 @@
+"ABCdefGHIjkl"
+"abcDEFghiJKL"
diff --git a/tests/libtracker-data/regex/regex-query-002.rq b/tests/libtracker-data/regex/regex-query-002.rq
new file mode 100755
index 0000000..b0bb7fd
--- /dev/null
+++ b/tests/libtracker-data/regex/regex-query-002.rq
@@ -0,0 +1,8 @@
+PREFIX  ex: <http://example.com/#>
+PREFIX  rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+
+SELECT ?val
+WHERE {
+	ex:foo rdf:value ?val .
+	FILTER regex(?val, "DeFghI", "i")
+}
diff --git a/tests/libtracker-data/sort/data-sort-1.ontology b/tests/libtracker-data/sort/data-sort-1.ontology
new file mode 100644
index 0000000..6e06880
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-1.ontology
@@ -0,0 +1,20 @@
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix owl: <http://www.w3.org/2002/07/owl#> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+foaf: a tracker:Namespace ;
+	tracker:prefix "foaf" .
+
+owl: a tracker:Namespace ;
+	tracker:prefix "owl" .
+
+owl:Thing a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+foaf:name a rdf:Property ;
+	rdfs:domain owl:Thing ;
+	rdfs:range xsd:string .
+
diff --git a/tests/libtracker-data/sort/data-sort-1.ttl b/tests/libtracker-data/sort/data-sort-1.ttl
new file mode 100755
index 0000000..b459187
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-1.ttl
@@ -0,0 +1,13 @@
+ prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix foaf:       <http://xmlns.com/foaf/0.1/> .
+ prefix owl: <http://www.w3.org/2002/07/owl#> .
+
+_:a a owl:Thing .
+_:b a owl:Thing .
+_:c a owl:Thing .
+_:e a owl:Thing .
+
+_:a foaf:name "Eve".
+_:b foaf:name "Alice" .
+_:c foaf:name "Fred" .
+_:e foaf:name "Bob" .
diff --git a/tests/libtracker-data/sort/data-sort-3.ontology b/tests/libtracker-data/sort/data-sort-3.ontology
new file mode 100644
index 0000000..3a323ff
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-3.ontology
@@ -0,0 +1,20 @@
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+foaf: a tracker:Namespace ;
+	tracker:prefix "foaf" .
+
+foaf:Person a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+foaf:mbox a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range rdfs:Resource .
+
+foaf:name a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range xsd:string .
+
diff --git a/tests/libtracker-data/sort/data-sort-3.ttl b/tests/libtracker-data/sort/data-sort-3.ttl
new file mode 100755
index 0000000..dc2cd34
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-3.ttl
@@ -0,0 +1,18 @@
+ prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix foaf:       <http://xmlns.com/foaf/0.1/> .
+
+_:a rdf:type foaf:Person ;
+    foaf:name "Eve" ;
+    foaf:mbox <mailto:eve work example> .
+    
+_:b rdf:type foaf:Person ;
+    foaf:name "Alice" ;
+    foaf:mbox <mailto:alice work example> .
+
+_:c rdf:type foaf:Person ;
+    foaf:mbox <mailto:fred work example> ;
+    foaf:name "Fred" .
+
+_:e rdf:type foaf:Person ;
+    foaf:name "Bob" .
+
diff --git a/tests/libtracker-data/sort/data-sort-4.ontology b/tests/libtracker-data/sort/data-sort-4.ontology
new file mode 100644
index 0000000..4a68329
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-4.ontology
@@ -0,0 +1,24 @@
+ prefix example: <http://example.org/things#> .
+ prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+foaf: a tracker:Namespace ;
+	tracker:prefix "foaf" .
+
+foaf:Person a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:empId a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range xsd:integer .
+
+foaf:name a rdf:Property ;
+	rdfs:domain foaf:Person ;
+	rdfs:range xsd:string .
+
diff --git a/tests/libtracker-data/sort/data-sort-4.ttl b/tests/libtracker-data/sort/data-sort-4.ttl
new file mode 100755
index 0000000..173f38d
--- /dev/null
+++ b/tests/libtracker-data/sort/data-sort-4.ttl
@@ -0,0 +1,24 @@
+ prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix foaf:       <http://xmlns.com/foaf/0.1/> .
+ prefix ex:        <http://example.org/things#> .
+ prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
+
+_:a rdf:type foaf:Person ;
+    foaf:name "Eve" ;
+    ex:empId "9"^^xsd:integer .
+		
+_:b rdf:type foaf:Person ;
+    foaf:name "Alice" ;
+    ex:empId "29"^^xsd:integer .
+		
+_:c rdf:type foaf:Person ;
+    foaf:name "Fred" ;
+    ex:empId "27"^^xsd:integer .
+
+_:e rdf:type foaf:Person ;
+    foaf:name "Bob" ;
+    ex:empId "23"^^xsd:integer .
+
+_:f rdf:type foaf:Person ;
+    foaf:name "Bob" ;
+    ex:empId "30"^^xsd:integer .
diff --git a/tests/libtracker-data/sort/query-sort-1.out b/tests/libtracker-data/sort/query-sort-1.out
new file mode 100755
index 0000000..a0dc772
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-1.out
@@ -0,0 +1,4 @@
+"Alice"
+"Bob"
+"Eve"
+"Fred"
diff --git a/tests/libtracker-data/sort/query-sort-1.rq b/tests/libtracker-data/sort/query-sort-1.rq
new file mode 100755
index 0000000..28a4654
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-1.rq
@@ -0,0 +1,4 @@
+PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
+SELECT ?name
+WHERE { ?x foaf:name ?name }
+ORDER BY ?name
diff --git a/tests/libtracker-data/sort/query-sort-2.out b/tests/libtracker-data/sort/query-sort-2.out
new file mode 100755
index 0000000..5676037
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-2.out
@@ -0,0 +1,4 @@
+"Fred"
+"Eve"
+"Bob"
+"Alice"
diff --git a/tests/libtracker-data/sort/query-sort-2.rq b/tests/libtracker-data/sort/query-sort-2.rq
new file mode 100755
index 0000000..096f939
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-2.rq
@@ -0,0 +1,4 @@
+PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
+SELECT ?name
+WHERE { ?x foaf:name ?name }
+ORDER BY DESC(?name)
diff --git a/tests/libtracker-data/sort/query-sort-3.out b/tests/libtracker-data/sort/query-sort-3.out
new file mode 100755
index 0000000..8d46ade
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-3.out
@@ -0,0 +1,4 @@
+"Bob"	
+"Alice"	"mailto:alice work example"
+"Eve"	"mailto:eve work example"
+"Fred"	"mailto:fred work example"
diff --git a/tests/libtracker-data/sort/query-sort-3.rq b/tests/libtracker-data/sort/query-sort-3.rq
new file mode 100755
index 0000000..6c6a45d
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-3.rq
@@ -0,0 +1,6 @@
+PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
+SELECT ?name ?mbox
+WHERE { ?x foaf:name ?name .
+           OPTIONAL { ?x foaf:mbox ?mbox }
+      }
+ORDER BY ASC(?mbox)
diff --git a/tests/libtracker-data/sort/query-sort-4.out b/tests/libtracker-data/sort/query-sort-4.out
new file mode 100755
index 0000000..0d1a2e8
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-4.out
@@ -0,0 +1,5 @@
+"Eve"	"9"
+"Bob"	"23"
+"Fred"	"27"
+"Alice"	"29"
+"Bob"	"30"
diff --git a/tests/libtracker-data/sort/query-sort-4.rq b/tests/libtracker-data/sort/query-sort-4.rq
new file mode 100755
index 0000000..3f8b3ee
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-4.rq
@@ -0,0 +1,8 @@
+PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
+PREFIX ex:        <http://example.org/things#> 
+
+SELECT ?name ?emp
+WHERE { ?x foaf:name ?name ;
+           ex:empId ?emp
+      }
+ORDER BY ASC(?emp)
diff --git a/tests/libtracker-data/sort/query-sort-5.out b/tests/libtracker-data/sort/query-sort-5.out
new file mode 100755
index 0000000..86b445d
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-5.out
@@ -0,0 +1,5 @@
+"Alice"	"29"
+"Bob"	"30"
+"Bob"	"23"
+"Eve"	"9"
+"Fred"	"27"
diff --git a/tests/libtracker-data/sort/query-sort-5.rq b/tests/libtracker-data/sort/query-sort-5.rq
new file mode 100755
index 0000000..71bfb00
--- /dev/null
+++ b/tests/libtracker-data/sort/query-sort-5.rq
@@ -0,0 +1,8 @@
+PREFIX foaf:    <http://xmlns.com/foaf/0.1/>
+PREFIX ex:      <http://example.org/things#> 
+
+SELECT ?name ?emp
+WHERE { ?x foaf:name ?name ; 
+           ex:empId ?emp 
+      }
+ORDER BY ?name DESC(?emp)
diff --git a/tests/libtracker-data/tracker-ontology-test.c b/tests/libtracker-data/tracker-ontology-test.c
new file mode 100644
index 0000000..d6809f1
--- /dev/null
+++ b/tests/libtracker-data/tracker-ontology-test.c
@@ -0,0 +1,255 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <raptor.h>
+
+#include <libtracker-db/tracker-db-index-manager.h>
+#include <libtracker-db/tracker-db-manager.h>
+
+#include <libtracker-data/tracker-data-manager.h>
+#include <libtracker-data/tracker-data-query.h>
+#include <libtracker-data/tracker-data-update.h>
+#include <libtracker-data/tracker-turtle.h>
+
+typedef struct _TestInfo TestInfo;
+
+struct _TestInfo {
+	const gchar *test_name;
+	const gchar *data;
+};
+
+const TestInfo nie_tests[] = {
+	{ "nie/filter-subject-1", "nie/data-1" },
+	{ "nie/filter-characterset-1", "nie/data-1" },
+	{ "nie/filter-comment-1", "nie/data-1" },
+	{ "nie/filter-description-1", "nie/data-1" },
+	{ "nie/filter-generator-1", "nie/data-1" },
+	{ "nie/filter-identifier-1", "nie/data-1" },
+	{ "nie/filter-keyword-1", "nie/data-1" },
+	{ "nie/filter-language-1", "nie/data-1" },
+	{ "nie/filter-legal-1", "nie/data-1" },
+	{ "nie/filter-title-1", "nie/data-1" },
+	{ "nie/filter-version-1", "nie/data-1" },
+	{ NULL }
+};
+
+const TestInfo nmo_tests[] = {
+	{ "nmo/filter-charset-1", "nmo/data-1" },
+	{ "nmo/filter-contentdescription-1", "nmo/data-1" },
+	{ "nmo/filter-contentid-1", "nmo/data-1" },
+	{ "nmo/filter-contenttransferencoding-1", "nmo/data-1" },
+	{ "nmo/filter-headername-1", "nmo/data-1" },
+	{ "nmo/filter-headervalue-1", "nmo/data-1" },
+	{ "nmo/filter-isanswered-1", "nmo/data-1" },
+	{ "nmo/filter-isdeleted-1", "nmo/data-1" },
+	{ "nmo/filter-isdraft-1", "nmo/data-1" },
+	{ "nmo/filter-isflagged-1", "nmo/data-1" },
+	{ "nmo/filter-isread-1", "nmo/data-1" },
+	{ "nmo/filter-isrecent-1", "nmo/data-1" },
+	{ "nmo/filter-messageid-1", "nmo/data-1" },
+	{ "nmo/filter-messagesubject-1", "nmo/data-1" }, 
+	{ "nmo/filter-plaintextmessagecontent-1", "nmo/data-1" },
+	{ NULL }
+};
+
+static void
+consume_triple_storer (const gchar *subject,
+                       const gchar *predicate,
+                       const gchar *object,
+                       void        *user_data)
+{
+	tracker_data_insert_statement (subject, predicate, object);
+}
+
+static void
+test_query (gconstpointer test_data)
+{
+	GError      *error;
+	gchar       *data_filename;
+	gchar       *query, *query_filename;
+	gchar       *results, *results_filename;
+	TrackerConfig   *config;
+	TrackerLanguage	*language;
+	TrackerDBResultSet *result_set;
+	const TestInfo *test_info;
+	GString *test_results;
+
+	error = NULL;
+	test_info = test_data;
+
+	/* initialization */
+
+	config = tracker_config_new ();
+	language = tracker_language_new (config);
+
+	tracker_data_manager_init (config, language,
+	                           TRACKER_DB_MANAGER_FORCE_REINDEX
+	                           | TRACKER_DB_MANAGER_TEST_MODE,
+	                           0, NULL, NULL);
+
+	/* load data set */
+
+	data_filename = g_strconcat (test_info->data, ".ttl", NULL);
+	tracker_data_begin_transaction ();
+	tracker_turtle_process (data_filename, NULL, consume_triple_storer, NULL);
+	tracker_data_commit_transaction ();
+
+	query_filename = g_strconcat (test_info->test_name, ".rq", NULL);
+	g_file_get_contents (query_filename, &query, NULL, &error);
+	g_assert (error == NULL);
+
+	results_filename = g_strconcat (test_info->test_name, ".out", NULL);
+	g_file_get_contents (results_filename, &results, NULL, &error);
+	g_assert (error == NULL);
+
+	/* perform actual query */
+
+	result_set = tracker_data_query_sparql (query, &error);
+	g_assert (error == NULL);
+
+	/* compare results with reference output */
+
+	test_results = g_string_new ("");
+
+	if (result_set) {
+		gboolean valid = TRUE;
+		guint col_count;
+		gint col;
+
+		col_count = tracker_db_result_set_get_n_columns (result_set);
+
+		while (valid) {
+			for (col = 0; col < col_count; col++) {
+				GValue value = { 0 };
+
+				_tracker_db_result_set_get_value (result_set, col, &value);
+
+				switch (G_VALUE_TYPE (&value)) {
+				case G_TYPE_INT:
+					g_string_append_printf (test_results, "\"%d\"", g_value_get_int (&value));
+					break;
+				case G_TYPE_DOUBLE:
+					g_string_append_printf (test_results, "\"%f\"", g_value_get_double (&value));
+					break;
+				case G_TYPE_STRING:
+					g_string_append_printf (test_results, "\"%s\"", g_value_get_string (&value));
+					break;
+				default:
+					/* unbound variable */
+					break;
+				}
+
+				if (col < col_count - 1) {
+					g_string_append (test_results, "\t");
+				}
+			}
+
+			g_string_append (test_results, "\n");
+
+			valid = tracker_db_result_set_iter_next (result_set);
+		}
+
+		g_object_unref (result_set);
+	}
+
+	if (strcmp (results, test_results->str)) {
+		/* print result difference */
+		gchar *quoted_results;
+		gchar *command_line;
+		gchar *quoted_command_line;
+		gchar *shell;
+		gchar *diff;
+
+		quoted_results = g_shell_quote (test_results->str);
+		command_line = g_strdup_printf ("echo -n %s | diff -u %s -", quoted_results, results_filename);
+		quoted_command_line = g_shell_quote (command_line);
+		shell = g_strdup_printf ("sh -c %s", quoted_command_line);
+		g_spawn_command_line_sync (shell, &diff, NULL, NULL, &error);
+		g_assert (error == NULL);
+
+		g_error ("%s", diff);
+
+		g_free (quoted_results);
+		g_free (command_line);
+		g_free (quoted_command_line);
+		g_free (shell);
+		g_free (diff);
+	}
+
+	/* cleanup */
+
+	g_free (data_filename);
+	g_free (query_filename);
+	g_free (query);
+	g_free (results_filename);
+	g_free (results);
+	g_string_free (test_results, TRUE);
+
+	tracker_data_manager_shutdown ();
+	tracker_db_index_manager_shutdown ();
+	tracker_db_manager_shutdown ();
+}
+
+int
+main (int argc, char **argv)
+{
+
+	int              result;
+	int              i;
+
+	g_type_init ();
+	g_thread_init (NULL);
+	g_test_init (&argc, &argv, NULL);
+
+	tracker_turtle_init ();
+
+	/* add test cases */
+
+	for (i = 0; nie_tests[i].test_name; i++) {
+		gchar *testpath;
+		g_message ("%d", i);
+		
+		testpath = g_strconcat ("/libtracker-data/nie/", nie_tests[i].test_name, NULL);
+		g_test_add_data_func (testpath, &nie_tests[i], test_query);
+		g_free (testpath);
+	}
+
+	for (i = 0; nmo_tests[i].test_name; i++) {
+		gchar *testpath;
+		g_message ("%d", i);
+		
+		testpath = g_strconcat ("/libtracker-data/nmo/", nmo_tests[i].test_name, NULL);
+		g_test_add_data_func (testpath, &nmo_tests[i], test_query);
+		g_free (testpath);
+	}
+
+	/* run tests */
+
+	result = g_test_run ();
+
+	tracker_turtle_shutdown ();
+
+	return result;
+}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
new file mode 100644
index 0000000..0b21db7
--- /dev/null
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -0,0 +1,230 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <raptor.h>
+
+#include <libtracker-db/tracker-db-index-manager.h>
+#include <libtracker-db/tracker-db-manager.h>
+
+#include <libtracker-data/tracker-data-manager.h>
+#include <libtracker-data/tracker-data-query.h>
+#include <libtracker-data/tracker-data-update.h>
+#include <libtracker-data/tracker-turtle.h>
+
+typedef struct _TestInfo TestInfo;
+
+struct _TestInfo {
+	const gchar *test_name;
+	const gchar *data;
+};
+
+const TestInfo tests[] = {
+	{ "algebra/filter-nested-1", "algebra/data-1" },
+	{ "bnode-coreference/query", "bnode-coreference/data" },
+	{ "bound/bound1", "bound/data" },
+	{ "expr-ops/query-ge-1", "expr-ops/data" },
+	{ "expr-ops/query-le-1", "expr-ops/data" },
+	{ "expr-ops/query-minus-1", "expr-ops/data" },
+	{ "expr-ops/query-mul-1", "expr-ops/data" },
+	{ "expr-ops/query-plus-1", "expr-ops/data" },
+	{ "expr-ops/query-unminus-1", "expr-ops/data" },
+	{ "expr-ops/query-unplus-1", "expr-ops/data" },
+	{ "regex/regex-query-001", "regex/regex-data-01" },
+	{ "regex/regex-query-002", "regex/regex-data-01" },
+	{ "sort/query-sort-1", "sort/data-sort-1" },
+	{ "sort/query-sort-2", "sort/data-sort-1" },
+	{ "sort/query-sort-3", "sort/data-sort-3" },
+	{ "sort/query-sort-4", "sort/data-sort-4" },
+	{ "sort/query-sort-5", "sort/data-sort-4" },
+	{ NULL }
+};
+
+static void
+consume_triple_storer (const gchar *subject,
+                       const gchar *predicate,
+                       const gchar *object,
+                       void        *user_data)
+{
+	tracker_data_insert_statement (subject, predicate, object);
+}
+
+static void
+test_sparql_query (gconstpointer test_data)
+{
+	GError      *error;
+	gchar       *data_filename;
+	gchar       *query, *query_filename;
+	gchar       *results, *results_filename;
+	TrackerConfig   *config;
+	TrackerLanguage	*language;
+	TrackerDBResultSet *result_set;
+	const TestInfo *test_info;
+	GString *test_results;
+
+	error = NULL;
+	test_info = test_data;
+
+	/* initialization */
+
+	config = tracker_config_new ();
+	language = tracker_language_new (config);
+
+	tracker_data_manager_init (config, language,
+	                           TRACKER_DB_MANAGER_FORCE_REINDEX
+	                           | TRACKER_DB_MANAGER_TEST_MODE,
+	                           0, test_info->data, NULL);
+
+	/* load data set */
+
+	data_filename = g_strconcat (test_info->data, ".ttl", NULL);
+	tracker_data_begin_transaction ();
+	tracker_turtle_process (data_filename, NULL, consume_triple_storer, NULL);
+	tracker_data_commit_transaction ();
+
+	query_filename = g_strconcat (test_info->test_name, ".rq", NULL);
+	g_file_get_contents (query_filename, &query, NULL, &error);
+	g_assert (error == NULL);
+
+	results_filename = g_strconcat (test_info->test_name, ".out", NULL);
+	g_file_get_contents (results_filename, &results, NULL, &error);
+	g_assert (error == NULL);
+
+	/* perform actual query */
+
+	result_set = tracker_data_query_sparql (query, &error);
+	g_assert (error == NULL);
+
+	/* compare results with reference output */
+
+	test_results = g_string_new ("");
+
+	if (result_set) {
+		gboolean valid = TRUE;
+		guint col_count;
+		gint col;
+
+		col_count = tracker_db_result_set_get_n_columns (result_set);
+
+		while (valid) {
+			for (col = 0; col < col_count; col++) {
+				GValue value = { 0 };
+
+				_tracker_db_result_set_get_value (result_set, col, &value);
+
+				switch (G_VALUE_TYPE (&value)) {
+				case G_TYPE_INT:
+					g_string_append_printf (test_results, "\"%d\"", g_value_get_int (&value));
+					break;
+				case G_TYPE_DOUBLE:
+					g_string_append_printf (test_results, "\"%f\"", g_value_get_double (&value));
+					break;
+				case G_TYPE_STRING:
+					g_string_append_printf (test_results, "\"%s\"", g_value_get_string (&value));
+					break;
+				default:
+					/* unbound variable */
+					break;
+				}
+
+				if (col < col_count - 1) {
+					g_string_append (test_results, "\t");
+				}
+			}
+
+			g_string_append (test_results, "\n");
+
+			valid = tracker_db_result_set_iter_next (result_set);
+		}
+
+		g_object_unref (result_set);
+	}
+
+	if (strcmp (results, test_results->str)) {
+		/* print result difference */
+		gchar *quoted_results;
+		gchar *command_line;
+		gchar *quoted_command_line;
+		gchar *shell;
+		gchar *diff;
+
+		quoted_results = g_shell_quote (test_results->str);
+		command_line = g_strdup_printf ("echo -n %s | diff -u %s -", quoted_results, results_filename);
+		quoted_command_line = g_shell_quote (command_line);
+		shell = g_strdup_printf ("sh -c %s", quoted_command_line);
+		g_spawn_command_line_sync (shell, &diff, NULL, NULL, &error);
+		g_assert (error == NULL);
+
+		g_error ("%s", diff);
+
+		g_free (quoted_results);
+		g_free (command_line);
+		g_free (quoted_command_line);
+		g_free (shell);
+		g_free (diff);
+	}
+
+	/* cleanup */
+
+	g_free (data_filename);
+	g_free (query_filename);
+	g_free (query);
+	g_free (results_filename);
+	g_free (results);
+	g_string_free (test_results, TRUE);
+
+	tracker_data_manager_shutdown ();
+}
+
+int
+main (int argc, char **argv)
+{
+
+	int              result;
+	int              i;
+
+	g_type_init ();
+	g_thread_init (NULL);
+	g_test_init (&argc, &argv, NULL);
+
+	tracker_turtle_init ();
+
+	/* add test cases */
+
+	for (i = 0; tests[i].test_name; i++) {
+		gchar *testpath;
+		
+		testpath = g_strconcat ("/libtracker-data/sparql/", tests[i].test_name, NULL);
+		g_test_add_data_func (testpath, &tests[i], test_sparql_query);
+		g_free (testpath);
+	}
+
+	/* run tests */
+
+	result = g_test_run ();
+
+	tracker_turtle_shutdown ();
+
+	return result;
+}



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