[tracker: 2/3] add tests for feature of supporting comments in ontology files




commit df826db8c202edcf57b99660e43077c22fb4f9cb
Author: Abanoub Ghadban <abanoub gdb gmail com>
Date:   Mon Jun 21 20:53:23 2021 +0200

    add tests for feature of supporting comments in ontology files
    
    There are no special tests that should be carried out to test the feature of skipping comments in 
ontology file.
    Just we need to use any ontology file that contains different types of comments and make sure that the 
ontology is parsed well.
    That is done by applying different queries on the database created and make sure that the queries return 
the right data which means that the schema is parsed successfully.

 tests/libtracker-data/tracker-sparql-test.c        |  1 +
 .../libtracker-data/turtle-comments/test.ontology  | 36 ++++++++++++++++++++++
 .../turtle-comments/turtle-data-001.ttl            | 10 ++++++
 .../turtle-comments/turtle-query-001.out           |  1 +
 .../turtle-comments/turtle-query-001.rq            |  7 +++++
 5 files changed, 55 insertions(+)
---
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index aa53bbf41..4d6312c0f 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -248,6 +248,7 @@ const TestInfo tests[] = {
 
        { "turtle/turtle-query-001", "turtle/turtle-data-001", FALSE },
        { "turtle/turtle-query-002", "turtle/turtle-data-002", FALSE },
+       { "turtle-comments/turtle-query-001", "turtle-comments/turtle-data-001", FALSE },
        /* Mixed cardinality tests */
        { "mixed-cardinality/insert-mixed-cardinality-query-1", 
"mixed-cardinality/insert-mixed-cardinality-1", FALSE, FALSE },
        { "mixed-cardinality/update-mixed-cardinality-query-1", 
"mixed-cardinality/update-mixed-cardinality-1", FALSE, FALSE },
diff --git a/tests/libtracker-data/turtle-comments/test.ontology 
b/tests/libtracker-data/turtle-comments/test.ontology
new file mode 100644
index 000000000..def641e13
--- /dev/null
+++ b/tests/libtracker-data/turtle-comments/test.ontology
@@ -0,0 +1,36 @@
+@prefix nrl: <http://tracker.api.gnome.org/ontology/v3/nrl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+# Simple Comment before the triple pattern
+@prefix rdfs:#Simple comment after the predicate
+ <http://www.w3.org/2000/01/rdf-schema#> .
+
+@prefix foo: <http://example.org/ns#> .
+@prefix : <http://other.example.org/ns#> .
+
+foo:
+
+#Multi-lined comment after the subject
+
+# Comment can contain spaces between its lines
+
+ a nrl:Namespace ; # Another comment between two objects
+       nrl:prefix "foo" .
+
+: a nrl:Namespace # Another multi-line comment
+# before the semi-colon
+
+ ;
+       nrl:prefix "" .
+
+foo: # comment after PN_NAME_NS
+       a rdf:Property ;#
+       rdfs:domain rdfs:Resource ;
+       rdfs:range rdfs:Resource .
+
+<http://other.example.org/ns#>  a rdf:Property ;
+       rdfs:domain # Another comment
+       rdfs:Resource # Multi-lines comment
+       # Comment
+       # Comment
+;
+       rdfs:range rdfs:Resource .
diff --git a/tests/libtracker-data/turtle-comments/turtle-data-001.ttl 
b/tests/libtracker-data/turtle-comments/turtle-data-001.ttl
new file mode 100755
index 000000000..bf53d21f5
--- /dev/null
+++ b/tests/libtracker-data/turtle-comments/turtle-data-001.ttl
@@ -0,0 +1,10 @@
+# this is a complete turtle document
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix foo: <http://example.org/ns#> .
+@prefix : <http://other.example.org/ns#> .
+
+foo:bar a rdfs:Resource .
+:bar a rdfs:Resource .
+
+foo:bar foo: : .
+:bar : foo:bar .
diff --git a/tests/libtracker-data/turtle-comments/turtle-query-001.out 
b/tests/libtracker-data/turtle-comments/turtle-query-001.out
new file mode 100755
index 000000000..17a15e29d
--- /dev/null
+++ b/tests/libtracker-data/turtle-comments/turtle-query-001.out
@@ -0,0 +1 @@
+"http://other.example.org/ns#"; "http://example.org/ns#bar";
diff --git a/tests/libtracker-data/turtle-comments/turtle-query-001.rq 
b/tests/libtracker-data/turtle-comments/turtle-query-001.rq
new file mode 100755
index 000000000..96693ca5b
--- /dev/null
+++ b/tests/libtracker-data/turtle-comments/turtle-query-001.rq
@@ -0,0 +1,7 @@
+PREFIX foo: <http://example.org/ns#>
+PREFIX : <http://other.example.org/ns#>
+
+SELECT ?foo ?bar WHERE {
+  foo:bar foo: ?foo .
+  :bar : ?bar .
+}


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