[tracker/wip/carlosg/sparql1.1: 188/201] tests: Add tests for CONSTRUCT
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sparql1.1: 188/201] tests: Add tests for CONSTRUCT
- Date: Mon, 9 Sep 2019 22:34:37 +0000 (UTC)
commit 7620ec1de0cf24cba34eddb265e3b27e6b5de307
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jul 21 12:45:43 2019 +0200
tests: Add tests for CONSTRUCT
.../construct/construct-pattern.out | 12 ++++++++
.../libtracker-data/construct/construct-pattern.rq | 3 ++
.../libtracker-data/construct/construct-where.out | 8 +++++
tests/libtracker-data/construct/construct-where.rq | 1 +
.../construct/construct-with-modifiers.out | 4 +++
.../construct/construct-with-modifiers.rq | 3 ++
tests/libtracker-data/construct/data.ttl | 31 ++++++++++++++++++++
tests/libtracker-data/construct/test.ontology | 34 ++++++++++++++++++++++
tests/libtracker-data/tracker-sparql-test.c | 3 ++
9 files changed, 99 insertions(+)
---
diff --git a/tests/libtracker-data/construct/construct-pattern.out
b/tests/libtracker-data/construct/construct-pattern.out
new file mode 100644
index 000000000..bda80d4c6
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-pattern.out
@@ -0,0 +1,12 @@
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"a" "http://xmlns.com/foaf/0.1/name" "nameA"
+"b" "http://xmlns.com/foaf/0.1/name" "nameB"
+"c" "http://xmlns.com/foaf/0.1/name" "nameC"
+"d" "http://xmlns.com/foaf/0.1/name" "nameD"
+"a" "http://xmlns.com/foaf/0.1/mbox" "mailto:bob@work"
+"b" "http://xmlns.com/foaf/0.1/mbox" "mailto:bob@work"
+"c" "http://xmlns.com/foaf/0.1/mbox" "mailto:bob@work"
+"d" "http://xmlns.com/foaf/0.1/mbox" "mailto:bob@work"
diff --git a/tests/libtracker-data/construct/construct-pattern.rq
b/tests/libtracker-data/construct/construct-pattern.rq
new file mode 100644
index 000000000..d686a48fd
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-pattern.rq
@@ -0,0 +1,3 @@
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+
+CONSTRUCT { ?u a foaf:Person ; foaf:name ?name ; foaf:mbox <mailto:bob@work> } WHERE { ?u a example:A ;
example:name ?name }
diff --git a/tests/libtracker-data/construct/construct-where.out
b/tests/libtracker-data/construct/construct-where.out
new file mode 100644
index 000000000..6fb4dde44
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-where.out
@@ -0,0 +1,8 @@
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"a" "http://example/name" "nameA"
+"b" "http://example/name" "nameB"
+"c" "http://example/name" "nameC"
+"d" "http://example/name" "nameD"
diff --git a/tests/libtracker-data/construct/construct-where.rq
b/tests/libtracker-data/construct/construct-where.rq
new file mode 100644
index 000000000..cce9b98e7
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-where.rq
@@ -0,0 +1 @@
+CONSTRUCT WHERE { ?u a example:A ; example:name ?l }
diff --git a/tests/libtracker-data/construct/construct-with-modifiers.out
b/tests/libtracker-data/construct/construct-with-modifiers.out
new file mode 100644
index 000000000..737959de6
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-with-modifiers.out
@@ -0,0 +1,4 @@
+"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://xmlns.com/foaf/0.1/Person"
+"c" "http://xmlns.com/foaf/0.1/name" "nameC"
+"b" "http://xmlns.com/foaf/0.1/name" "nameB"
diff --git a/tests/libtracker-data/construct/construct-with-modifiers.rq
b/tests/libtracker-data/construct/construct-with-modifiers.rq
new file mode 100644
index 000000000..2f2badefa
--- /dev/null
+++ b/tests/libtracker-data/construct/construct-with-modifiers.rq
@@ -0,0 +1,3 @@
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+
+CONSTRUCT { ?u a foaf:Person ; foaf:name ?name } WHERE { ?u a example:A ; example:name ?name ;
example:number ?number } ORDER BY DESC ?number LIMIT 2
diff --git a/tests/libtracker-data/construct/data.ttl b/tests/libtracker-data/construct/data.ttl
new file mode 100644
index 000000000..7449849fd
--- /dev/null
+++ b/tests/libtracker-data/construct/data.ttl
@@ -0,0 +1,31 @@
+@prefix example: <http://example/> .
+
+<a> a example:A ;
+ example:name 'nameA' ;
+ example:date '2000-01-01T00:00:01Z' ;
+ example:number 42 .
+
+<b> a example:A ;
+ example:name 'nameB' ;
+ example:date '2001-01-01T00:00:01Z' ;
+ example:number 73 ;
+ example:relation <z> .
+
+<c> a example:A ;
+ example:name 'nameC' ;
+ example:number 113 ;
+ example:relation <x> .
+
+<d> a example:A ;
+ example:name 'nameD' ;
+ example:date '2002-01-01T00:00:01Z' ;
+ example:relation <z> .
+
+<x> a example:B ;
+ example:title 'titleX' .
+
+<y> a example:B ;
+ example:title 'titleY' .
+
+<z> a example:B ;
+ example:title 'titleZ' .
diff --git a/tests/libtracker-data/construct/test.ontology b/tests/libtracker-data/construct/test.ontology
new file mode 100644
index 000000000..0a803ae95
--- /dev/null
+++ b/tests/libtracker-data/construct/test.ontology
@@ -0,0 +1,34 @@
+@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:name a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:string .
+
+example:date a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:dateTime .
+
+example:number a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:title a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string .
+
+example:relation a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range example:B .
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 62952b7f5..257fead15 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -83,6 +83,9 @@ const TestInfo tests[] = {
{ "bnode/query-5", "bnode/data", FALSE },
{ "bnode-coreference/query", "bnode-coreference/data", FALSE },
{ "bound/bound1", "bound/data", FALSE },
+ { "construct/construct-where", "construct/data", FALSE },
+ { "construct/construct-pattern", "construct/data", FALSE },
+ { "construct/construct-with-modifiers", "construct/data", FALSE },
{ "datetime/delete-1", "datetime/data-3", FALSE },
{ "datetime/functions-localtime-1", "datetime/data-1", FALSE },
{ "datetime/functions-timezone-1", "datetime/data-2", FALSE },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]