[tracker/wip/carlosg/sparql1.1: 185/201] tests: Add tests for rdf:langString, LANGMATCHES, and STRLANG



commit 985734a893de8cbea9b120eb032bdcfcd1f05b5d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jul 20 23:42:49 2019 +0200

    tests: Add tests for rdf:langString, LANGMATCHES, and STRLANG

 tests/libtracker-data/langstring/data.rq              | 16 ++++++++++++++++
 tests/libtracker-data/langstring/langmatches.out      |  2 ++
 tests/libtracker-data/langstring/langmatches.rq       |  1 +
 .../langstring/match-non-langstring.out               |  1 +
 .../langstring/match-non-langstring.rq                |  1 +
 .../langstring/match-with-langstring.out              |  1 +
 .../langstring/match-with-langstring.rq               |  1 +
 .../langstring/match-with-non-langstring.out          |  1 +
 .../langstring/match-with-non-langstring.rq           |  1 +
 tests/libtracker-data/langstring/strlang.out          |  1 +
 tests/libtracker-data/langstring/strlang.rq           |  1 +
 tests/libtracker-data/langstring/test.ontology        | 19 +++++++++++++++++++
 tests/libtracker-data/tracker-sparql-test.c           |  5 +++++
 13 files changed, 51 insertions(+)
---
diff --git a/tests/libtracker-data/langstring/data.rq b/tests/libtracker-data/langstring/data.rq
new file mode 100644
index 000000000..ae71299ea
--- /dev/null
+++ b/tests/libtracker-data/langstring/data.rq
@@ -0,0 +1,16 @@
+INSERT {
+       <a> a example:A ;
+           example:langString "foo"@en ;
+           example:string "bar" .
+
+       <b> a example:A ;
+           example:langString "foo"@fr ;
+           example:string "baz" .
+
+       <c> a example:A ;
+           example:langString "foo" ;
+           example:string "bla"@es .
+
+       <d> a example:A ;
+           example:langString "bleh"@en .
+}
diff --git a/tests/libtracker-data/langstring/langmatches.out 
b/tests/libtracker-data/langstring/langmatches.out
new file mode 100644
index 000000000..22d3c21b7
--- /dev/null
+++ b/tests/libtracker-data/langstring/langmatches.out
@@ -0,0 +1,2 @@
+"a"
+"d"
diff --git a/tests/libtracker-data/langstring/langmatches.rq b/tests/libtracker-data/langstring/langmatches.rq
new file mode 100644
index 000000000..d8c693b37
--- /dev/null
+++ b/tests/libtracker-data/langstring/langmatches.rq
@@ -0,0 +1 @@
+SELECT ?u { ?u example:langString ?s . FILTER (LANGMATCHES (?s, "en")) } order by ?u
\ No newline at end of file
diff --git a/tests/libtracker-data/langstring/match-non-langstring.out 
b/tests/libtracker-data/langstring/match-non-langstring.out
new file mode 100644
index 000000000..cdf158597
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-non-langstring.out
@@ -0,0 +1 @@
+"c"
diff --git a/tests/libtracker-data/langstring/match-non-langstring.rq 
b/tests/libtracker-data/langstring/match-non-langstring.rq
new file mode 100644
index 000000000..8d4283d89
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-non-langstring.rq
@@ -0,0 +1 @@
+SELECT ?u { ?u example:string "bla"@es }
diff --git a/tests/libtracker-data/langstring/match-with-langstring.out 
b/tests/libtracker-data/langstring/match-with-langstring.out
new file mode 100644
index 000000000..231f150c5
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-with-langstring.out
@@ -0,0 +1 @@
+"a"
diff --git a/tests/libtracker-data/langstring/match-with-langstring.rq 
b/tests/libtracker-data/langstring/match-with-langstring.rq
new file mode 100644
index 000000000..ff2951875
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-with-langstring.rq
@@ -0,0 +1 @@
+SELECT ?u { ?u example:langString "foo"@en }
diff --git a/tests/libtracker-data/langstring/match-with-non-langstring.out 
b/tests/libtracker-data/langstring/match-with-non-langstring.out
new file mode 100644
index 000000000..cdf158597
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-with-non-langstring.out
@@ -0,0 +1 @@
+"c"
diff --git a/tests/libtracker-data/langstring/match-with-non-langstring.rq 
b/tests/libtracker-data/langstring/match-with-non-langstring.rq
new file mode 100644
index 000000000..3ceef7b28
--- /dev/null
+++ b/tests/libtracker-data/langstring/match-with-non-langstring.rq
@@ -0,0 +1 @@
+SELECT ?u { ?u example:langString "foo" }
diff --git a/tests/libtracker-data/langstring/strlang.out b/tests/libtracker-data/langstring/strlang.out
new file mode 100644
index 000000000..231f150c5
--- /dev/null
+++ b/tests/libtracker-data/langstring/strlang.out
@@ -0,0 +1 @@
+"a"
diff --git a/tests/libtracker-data/langstring/strlang.rq b/tests/libtracker-data/langstring/strlang.rq
new file mode 100644
index 000000000..712ae6461
--- /dev/null
+++ b/tests/libtracker-data/langstring/strlang.rq
@@ -0,0 +1 @@
+SELECT ?u { ?u example:langString ?s . FILTER (?s = STRLANG ("foo", "en")) }
diff --git a/tests/libtracker-data/langstring/test.ontology b/tests/libtracker-data/langstring/test.ontology
new file mode 100644
index 000000000..fa600f7fe
--- /dev/null
+++ b/tests/libtracker-data/langstring/test.ontology
@@ -0,0 +1,19 @@
+@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:langString a rdf:Property ;
+       rdfs:domain example:A ;
+       rdfs:range rdf:langString .
+
+example:string a rdf:Property ;
+       rdfs:domain example:A ;
+       rdfs:range xsd:string .
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 5c60e75ad..b865f19c0 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -153,6 +153,11 @@ const TestInfo tests[] = {
        { "graph/add-into-self", "graph/data-add-into-self", FALSE },
        { "graph/add-from-default", "graph/data-add-from-default", FALSE },
        { "graph/add-to-default", "graph/data-add-to-default", FALSE },
+       { "langstring/match-with-non-langstring", "langstring/data", FALSE },
+       { "langstring/match-with-langstring", "langstring/data", FALSE },
+       { "langstring/match-non-langstring", "langstring/data", FALSE },
+       { "langstring/langmatches", "langstring/data", FALSE },
+       { "langstring/strlang", "langstring/data", FALSE },
        { "optional/q-opt-complex-1", "optional/complex-data-1", FALSE },
        { "optional/simple-optional-triple", "optional/simple-optional-triple", FALSE },
        { "regex/regex-query-001", "regex/regex-data-01", FALSE },


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