[tracker] tests: Add tests for ontology changes involving FTS
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tests: Add tests for ontology changes involving FTS
- Date: Tue, 18 Dec 2018 11:28:18 +0000 (UTC)
commit c2f856279d7635d9fedecbfe112180622129aae9
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Dec 15 11:59:24 2018 +0100
tests: Add tests for ontology changes involving FTS
So we can catch things going wrong in FTS table updates. The added steps
check:
- Addition of new FTS properties
- Unrelated modification of tables affected by the FTS view
- Cardinality changes in existing FTS properties
- Deleting FTS properties
tests/libtracker-data/change/change-test-4.out | 2 +
tests/libtracker-data/change/change-test-4.rq | 1 +
tests/libtracker-data/change/change-test-5.out | 3 +
tests/libtracker-data/change/change-test-5.rq | 1 +
.../change/source/99-example.ontology.v10 | 71 +++++++++++++++++++++
.../change/source/99-example.ontology.v11 | 70 +++++++++++++++++++++
.../change/source/99-example.ontology.v8 | 67 ++++++++++++++++++++
.../change/source/99-example.ontology.v9 | 72 ++++++++++++++++++++++
.../change/updates/99-example.queries.v10 | 1 +
.../change/updates/99-example.queries.v11 | 1 +
.../change/updates/99-example.queries.v8 | 2 +
.../change/updates/99-example.queries.v9 | 1 +
.../libtracker-data/tracker-ontology-change-test.c | 4 ++
13 files changed, 296 insertions(+)
---
diff --git a/tests/libtracker-data/change/change-test-4.out b/tests/libtracker-data/change/change-test-4.out
new file mode 100644
index 000000000..2cb6288f4
--- /dev/null
+++ b/tests/libtracker-data/change/change-test-4.out
@@ -0,0 +1,2 @@
+"fts1"
+"fts2"
diff --git a/tests/libtracker-data/change/change-test-4.rq b/tests/libtracker-data/change/change-test-4.rq
new file mode 100644
index 000000000..9067876fc
--- /dev/null
+++ b/tests/libtracker-data/change/change-test-4.rq
@@ -0,0 +1 @@
+select ?u { ?u <http://www.tracker-project.org/ontologies/fts#match> 'resource' } order by ?u
diff --git a/tests/libtracker-data/change/change-test-5.out b/tests/libtracker-data/change/change-test-5.out
new file mode 100644
index 000000000..830687307
--- /dev/null
+++ b/tests/libtracker-data/change/change-test-5.out
@@ -0,0 +1,3 @@
+"fts1"
+"fts3"
+"fts4"
diff --git a/tests/libtracker-data/change/change-test-5.rq b/tests/libtracker-data/change/change-test-5.rq
new file mode 100644
index 000000000..9067876fc
--- /dev/null
+++ b/tests/libtracker-data/change/change-test-5.rq
@@ -0,0 +1 @@
+select ?u { ?u <http://www.tracker-project.org/ontologies/fts#match> 'resource' } order by ?u
diff --git a/tests/libtracker-data/change/source/99-example.ontology.v10
b/tests/libtracker-data/change/source/99-example.ontology.v10
new file mode 100644
index 000000000..d2dc3dc31
--- /dev/null
+++ b/tests/libtracker-data/change/source/99-example.ontology.v10
@@ -0,0 +1,71 @@
+@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#> .
+@prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+@prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace, tracker:Ontology ;
+ nao:lastModified "2010-03-23T11:00:09Z" ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+# We remove a domainIndex
+example:DomA a rdfs:Class ;
+ tracker:domainIndex example:single2 ;
+ rdfs:subClassOf example:A .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:b a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range example:B .
+
+example:i1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:i2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:single1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:single2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:ib a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:integer .
+
+example:sb a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string .
+
+# Change cardinality of a FTS property
+example:fts1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:string ;
+ tracker:fulltextIndexed true .
+
+example:fts2 a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 ;
+ tracker:fulltextIndexed true .
+
+example:nonFts a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 .
diff --git a/tests/libtracker-data/change/source/99-example.ontology.v11
b/tests/libtracker-data/change/source/99-example.ontology.v11
new file mode 100644
index 000000000..004884c0a
--- /dev/null
+++ b/tests/libtracker-data/change/source/99-example.ontology.v11
@@ -0,0 +1,70 @@
+@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#> .
+@prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+@prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace, tracker:Ontology ;
+ nao:lastModified "2010-03-23T11:00:10Z" ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+# We remove a domainIndex
+example:DomA a rdfs:Class ;
+ tracker:domainIndex example:single2 ;
+ rdfs:subClassOf example:A .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:b a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range example:B .
+
+example:i1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:i2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:single1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:single2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:ib a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:integer .
+
+example:sb a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string .
+
+example:fts1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:string ;
+ tracker:fulltextIndexed true .
+
+# Make a property no longer FTS indexed
+example:fts2 a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 .
+
+example:nonFts a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 .
diff --git a/tests/libtracker-data/change/source/99-example.ontology.v8
b/tests/libtracker-data/change/source/99-example.ontology.v8
new file mode 100644
index 000000000..2892b77bf
--- /dev/null
+++ b/tests/libtracker-data/change/source/99-example.ontology.v8
@@ -0,0 +1,67 @@
+@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#> .
+@prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+@prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace, tracker:Ontology ;
+ nao:lastModified "2010-03-23T11:00:07Z" ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+# We remove a domainIndex
+example:DomA a rdfs:Class ;
+ tracker:domainIndex example:single2 ;
+ rdfs:subClassOf example:A .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:b a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range example:B .
+
+example:i1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:i2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:single1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:single2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:ib a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:integer .
+
+example:sb a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string .
+
+# Add 2 FTS properties and a non-FTS property
+example:fts1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 ;
+ tracker:fulltextIndexed true .
+
+example:fts2 a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 ;
+ tracker:fulltextIndexed true .
diff --git a/tests/libtracker-data/change/source/99-example.ontology.v9
b/tests/libtracker-data/change/source/99-example.ontology.v9
new file mode 100644
index 000000000..eaf6ee9e2
--- /dev/null
+++ b/tests/libtracker-data/change/source/99-example.ontology.v9
@@ -0,0 +1,72 @@
+@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#> .
+@prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+@prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace, tracker:Ontology ;
+ nao:lastModified "2010-03-23T11:00:08Z" ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+# We remove a domainIndex
+example:DomA a rdfs:Class ;
+ tracker:domainIndex example:single2 ;
+ rdfs:subClassOf example:A .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:b a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range example:B .
+
+example:i1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:i2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
+
+example:single1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:single2 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 ;
+ tracker:indexed false .
+
+example:ib a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:integer .
+
+example:sb a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string .
+
+example:fts1 a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 ;
+ tracker:fulltextIndexed true .
+
+example:fts2 a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:range xsd:string ;
+ nrl:maxCardinality 1 ;
+ tracker:fulltextIndexed true .
+
+# Add a non-FTS property on a class with FTS properties
+example:nonFts a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 .
diff --git a/tests/libtracker-data/change/updates/99-example.queries.v10
b/tests/libtracker-data/change/updates/99-example.queries.v10
new file mode 100644
index 000000000..f53e8eac8
--- /dev/null
+++ b/tests/libtracker-data/change/updates/99-example.queries.v10
@@ -0,0 +1 @@
+insert data { <fts3> a example:A ; example:fts1 'resource fts3' }
diff --git a/tests/libtracker-data/change/updates/99-example.queries.v11
b/tests/libtracker-data/change/updates/99-example.queries.v11
new file mode 100644
index 000000000..bab58b3a5
--- /dev/null
+++ b/tests/libtracker-data/change/updates/99-example.queries.v11
@@ -0,0 +1 @@
+insert data { <fts4> a example:A ; example:fts1 'resource fts4' }
diff --git a/tests/libtracker-data/change/updates/99-example.queries.v8
b/tests/libtracker-data/change/updates/99-example.queries.v8
new file mode 100644
index 000000000..5950952a3
--- /dev/null
+++ b/tests/libtracker-data/change/updates/99-example.queries.v8
@@ -0,0 +1,2 @@
+insert data { <fts1> a example:A ; example:fts1 'resource fts1' }
+insert data { <fts2> a example:B ; example:fts2 'resource fts2' }
diff --git a/tests/libtracker-data/change/updates/99-example.queries.v9
b/tests/libtracker-data/change/updates/99-example.queries.v9
new file mode 100644
index 000000000..6c667836f
--- /dev/null
+++ b/tests/libtracker-data/change/updates/99-example.queries.v9
@@ -0,0 +1 @@
+insert data { <nonFts> a example:A ; example:nonFts 42 }
diff --git a/tests/libtracker-data/tracker-ontology-change-test.c
b/tests/libtracker-data/tracker-ontology-change-test.c
index 17bd7f5f6..b0e6aac22 100644
--- a/tests/libtracker-data/tracker-ontology-change-test.c
+++ b/tests/libtracker-data/tracker-ontology-change-test.c
@@ -63,6 +63,10 @@ const ChangeInfo changes[] = {
{ "99-example.ontology.v5", "99-example.queries.v5", "change/change-test-1", NULL },
{ "99-example.ontology.v6", "99-example.queries.v6", "change/change-test-2", NULL },
{ "99-example.ontology.v7", "99-example.queries.v7", "change/change-test-3", NULL },
+ { "99-example.ontology.v8", "99-example.queries.v8", "change/change-test-4", NULL },
+ { "99-example.ontology.v9", "99-example.queries.v9", NULL, NULL },
+ { "99-example.ontology.v10", "99-example.queries.v10", NULL, NULL },
+ { "99-example.ontology.v11", "99-example.queries.v11", "change/change-test-5", NULL },
{ NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]