[tracker/wip/carlosg/sparql-parser-ng: 1/6] tests: Add more anonymous/blank nodes tests



commit 5780328238a5fe4e0e49433ab916a93176b25cc8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Nov 3 13:03:04 2018 +0100

    tests: Add more anonymous/blank nodes tests
    
    Some of those combinations were broken in the previous parser, now
    that they are handled properly, add tests for them.

 tests/libtracker-data/anon/query-3.out      |  3 +++
 tests/libtracker-data/anon/query-3.rq       |  1 +
 tests/libtracker-data/anon/query-4.out      |  3 +++
 tests/libtracker-data/anon/query-4.rq       |  1 +
 tests/libtracker-data/anon/query-5.out      |  4 ++++
 tests/libtracker-data/anon/query-5.rq       |  1 +
 tests/libtracker-data/bnode/data.ontology   | 24 +++++++++++++++++++++++
 tests/libtracker-data/bnode/data.ttl        | 30 +++++++++++++++++++++++++++++
 tests/libtracker-data/bnode/query-1.out     |  3 +++
 tests/libtracker-data/bnode/query-1.rq      |  1 +
 tests/libtracker-data/bnode/query-2.out     |  3 +++
 tests/libtracker-data/bnode/query-2.rq      |  1 +
 tests/libtracker-data/bnode/query-3.out     |  4 ++++
 tests/libtracker-data/bnode/query-3.rq      |  1 +
 tests/libtracker-data/bnode/query-4.out     |  3 +++
 tests/libtracker-data/bnode/query-4.rq      |  1 +
 tests/libtracker-data/bnode/query-5.out     |  3 +++
 tests/libtracker-data/bnode/query-5.rq      |  1 +
 tests/libtracker-data/tracker-sparql-test.c |  8 ++++++++
 19 files changed, 96 insertions(+)
---
diff --git a/tests/libtracker-data/anon/query-3.out b/tests/libtracker-data/anon/query-3.out
new file mode 100644
index 000000000..fe1e48f34
--- /dev/null
+++ b/tests/libtracker-data/anon/query-3.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Fred"
diff --git a/tests/libtracker-data/anon/query-3.rq b/tests/libtracker-data/anon/query-3.rq
new file mode 100644
index 000000000..ba9252f0b
--- /dev/null
+++ b/tests/libtracker-data/anon/query-3.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { [] foaf:knows ?u } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/anon/query-4.out b/tests/libtracker-data/anon/query-4.out
new file mode 100644
index 000000000..3970b1c89
--- /dev/null
+++ b/tests/libtracker-data/anon/query-4.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Eve"
diff --git a/tests/libtracker-data/anon/query-4.rq b/tests/libtracker-data/anon/query-4.rq
new file mode 100644
index 000000000..772c1bf8c
--- /dev/null
+++ b/tests/libtracker-data/anon/query-4.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { ?u foaf:knows [] } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/anon/query-5.out b/tests/libtracker-data/anon/query-5.out
new file mode 100644
index 000000000..a0dc77220
--- /dev/null
+++ b/tests/libtracker-data/anon/query-5.out
@@ -0,0 +1,4 @@
+"Alice"
+"Bob"
+"Eve"
+"Fred"
diff --git a/tests/libtracker-data/anon/query-5.rq b/tests/libtracker-data/anon/query-5.rq
new file mode 100644
index 000000000..2f3df0ad5
--- /dev/null
+++ b/tests/libtracker-data/anon/query-5.rq
@@ -0,0 +1 @@
+select ?u { [ a foaf:Person ; foaf:name ?u ] } order by ?u
\ No newline at end of file
diff --git a/tests/libtracker-data/bnode/data.ontology b/tests/libtracker-data/bnode/data.ontology
new file mode 100644
index 000000000..ca4c99676
--- /dev/null
+++ b/tests/libtracker-data/bnode/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/data.ttl b/tests/libtracker-data/bnode/data.ttl
new file mode 100644
index 000000000..5f0613f28
--- /dev/null
+++ b/tests/libtracker-data/bnode/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/query-1.out b/tests/libtracker-data/bnode/query-1.out
new file mode 100644
index 000000000..3970b1c89
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-1.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Eve"
diff --git a/tests/libtracker-data/bnode/query-1.rq b/tests/libtracker-data/bnode/query-1.rq
new file mode 100644
index 000000000..7f3f3705c
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-1.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { ?u foaf:knows _:foo . _:foo a foaf:Person } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/bnode/query-2.out b/tests/libtracker-data/bnode/query-2.out
new file mode 100644
index 000000000..3970b1c89
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-2.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Eve"
diff --git a/tests/libtracker-data/bnode/query-2.rq b/tests/libtracker-data/bnode/query-2.rq
new file mode 100644
index 000000000..33b99de9b
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-2.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { _:foo a foaf:Person . ?u foaf:knows _:foo } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/bnode/query-3.out b/tests/libtracker-data/bnode/query-3.out
new file mode 100644
index 000000000..a0dc77220
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-3.out
@@ -0,0 +1,4 @@
+"Alice"
+"Bob"
+"Eve"
+"Fred"
diff --git a/tests/libtracker-data/bnode/query-3.rq b/tests/libtracker-data/bnode/query-3.rq
new file mode 100644
index 000000000..277a204a2
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-3.rq
@@ -0,0 +1 @@
+select ?u { _:foo a foaf:Person ; foaf:name ?u } order by ?u
diff --git a/tests/libtracker-data/bnode/query-4.out b/tests/libtracker-data/bnode/query-4.out
new file mode 100644
index 000000000..3970b1c89
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-4.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Eve"
diff --git a/tests/libtracker-data/bnode/query-4.rq b/tests/libtracker-data/bnode/query-4.rq
new file mode 100644
index 000000000..7f3f3705c
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-4.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { ?u foaf:knows _:foo . _:foo a foaf:Person } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/bnode/query-5.out b/tests/libtracker-data/bnode/query-5.out
new file mode 100644
index 000000000..fe1e48f34
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-5.out
@@ -0,0 +1,3 @@
+"Alice"
+"Bob"
+"Fred"
diff --git a/tests/libtracker-data/bnode/query-5.rq b/tests/libtracker-data/bnode/query-5.rq
new file mode 100644
index 000000000..38fd47855
--- /dev/null
+++ b/tests/libtracker-data/bnode/query-5.rq
@@ -0,0 +1 @@
+select foaf:name(?u) { _:foo a foaf:Person ; foaf:knows ?u } order by foaf:name(?u)
\ No newline at end of file
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 960388f18..f52b9106a 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -63,6 +63,9 @@ const TestInfo tests[] = {
        { "algebra/var-scope-join-1", "algebra/var-scope-join-1", FALSE },
        { "anon/query", "anon/data", FALSE },
        { "anon/query-2", "anon/data", FALSE },
+       { "anon/query-3", "anon/data", FALSE },
+       { "anon/query-4", "anon/data", FALSE },
+       { "anon/query-5", "anon/data", FALSE },
        { "ask/ask-1", "ask/data", FALSE },
        { "basic/base-prefix-3", "basic/data-1", FALSE },
        { "basic/compare-cast", "basic/data-1", FALSE },
@@ -70,6 +73,11 @@ const TestInfo tests[] = {
        { "basic/predicate-variable-2", "basic/data-1", FALSE },
        { "basic/predicate-variable-3", "basic/data-1", FALSE },
        { "basic/predicate-variable-4", "basic/data-1", FALSE },
+       { "bnode/query-1", "bnode/data", FALSE },
+       { "bnode/query-2", "bnode/data", FALSE },
+       { "bnode/query-3", "bnode/data", FALSE },
+       { "bnode/query-4", "bnode/data", FALSE },
+       { "bnode/query-5", "bnode/data", FALSE },
        { "bnode-coreference/query", "bnode-coreference/data", FALSE },
        { "bound/bound1", "bound/data", FALSE },
        { "datetime/delete-1", "datetime/data-3", FALSE },


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