[tracker/rss-enclosures] functional-tests: Tests for tracker:indexed property
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] functional-tests: Tests for tracker:indexed property
- Date: Wed, 24 Nov 2010 02:01:15 +0000 (UTC)
commit b05cbb7711c31b836a49bcc858ef329addea3151
Author: Ivan Frade <ivan frade nokia com>
Date: Thu Oct 14 18:41:59 2010 +0300
functional-tests: Tests for tracker:indexed property
Set and remove tracker:indexed to single and multivalued properties in the ontology
configure.ac | 1 +
tests/functional-tests/17-ontology-changes.py | 87 ++++++++++++-
tests/functional-tests/test-ontologies/Makefile.am | 3 +-
.../test-ontologies/indexed/10-xsd.ontology | 16 +++
.../test-ontologies/indexed/11-rdf.ontology | 136 ++++++++++++++++++++
.../test-ontologies/indexed/12-nrl.ontology | 18 +++
.../test-ontologies/indexed/20-dc.ontology | 19 +++
.../test-ontologies/indexed/31-nao.ontology | 23 ++++
.../test-ontologies/indexed/90-tracker.ontology | 27 ++++
.../test-ontologies/indexed/91-test.ontology | 66 ++++++++++
.../test-ontologies/indexed/Makefile.am | 14 ++
11 files changed, 408 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1221540..ad48ba4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1975,6 +1975,7 @@ AC_CONFIG_FILES([
tests/functional-tests/test-ontologies/property-range-string-to-date/Makefile
tests/functional-tests/test-ontologies/cardinality/Makefile
tests/functional-tests/test-ontologies/notify/Makefile
+ tests/functional-tests/test-ontologies/indexed/Makefile
tests/functional-tests/ttl/Makefile
tests/Makefile
tests/tracker-miner-fs/Makefile
diff --git a/tests/functional-tests/17-ontology-changes.py b/tests/functional-tests/17-ontology-changes.py
index fc1bd78..41895b9 100755
--- a/tests/functional-tests/17-ontology-changes.py
+++ b/tests/functional-tests/17-ontology-changes.py
@@ -315,7 +315,92 @@ class ClassNotifyUnset (OntologyChangeTestTemplate):
result = self.tracker.query ("SELECT ?u WHERE { ?u a test:A. }")
self.assertEquals (str(result[0][0]), self.instance)
-
+
+
+class PropertyIndexedSet (OntologyChangeTestTemplate):
+ """
+ Set tracker:indexed true to single and multiple valued properties.
+ Check that instances and content of the property are still in the DB
+ """
+ def test_indexed_set (self):
+ self.template_test_ontology_change ()
+
+ def set_ontology_dirs (self):
+ self.FIRST_ONTOLOGY_DIR = "basic"
+ self.SECOND_ONTOLOGY_DIR = "indexed"
+
+ def insert_data (self):
+ # Instance with value in the single valued property
+ self.instance_single_valued = "test://ontology-change/indexed/single/true"
+ self.tracker.update ("INSERT { <%s> a test:A ; test:a_string 'anything 1'. }"
+ % (self.instance_single_valued))
+
+ # Instance with value in the n valued property
+ self.instance_n_valued = "test://ontology-change/indexed/multiple/true"
+ self.tracker.update ("INSERT { <%s> a test:A ; test:a_n_cardinality 'anything n'. }"
+ % (self.instance_n_valued))
+
+ def validate_status (self):
+ # Check ontology and instance for the single valued property
+ result = self.tracker.query ("SELECT ?indexed WHERE { test:a_string tracker:indexed ?indexed}")
+ self.assertEquals (str(result[0][0]), "true")
+
+ result = self.tracker.query ("SELECT ?content WHERE { <%s> a test:A; test:a_string ?content. }"
+ % (self.instance_single_valued))
+ self.assertEquals (str(result[0][0]), "anything 1")
+
+ # Check ontology and instance for the multiple valued property
+ result = self.tracker.query ("SELECT ?indexed WHERE { test:a_n_cardinality tracker:indexed ?indexed}")
+ self.assertEquals (str(result[0][0]), "true")
+
+ result = self.tracker.query ("SELECT ?content WHERE { <%s> a test:A; test:a_n_cardinality ?content. }"
+ % (self.instance_n_valued))
+ self.assertEquals (str(result[0][0]), "anything n")
+
+class PropertyIndexedUnset (OntologyChangeTestTemplate):
+ """
+ tracker:indexed property from true to false in single and multiple valued properties.
+ Check that instances and content of the property are still in the DB.
+ """
+ def test_ (self):
+ self.template_test_ontology_change ()
+
+ def set_ontology_dirs (self):
+ self.FIRST_ONTOLOGY_DIR = "indexed"
+ self.SECOND_ONTOLOGY_DIR = "basic"
+
+ def insert_data (self):
+ # Instance with value in the single valued property
+ self.instance_single_valued = "test://ontology-change/indexed/single/true"
+ self.tracker.update ("INSERT { <%s> a test:A ; test:a_string 'anything 1'. }"
+ % (self.instance_single_valued))
+
+ # Instance with value in the n valued property
+ self.instance_n_valued = "test://ontology-change/indexed/multiple/true"
+ self.tracker.update ("INSERT { <%s> a test:A ; test:a_n_cardinality 'anything n'. }"
+ % (self.instance_n_valued))
+
+ def validate_status (self):
+ #
+ # NOTE: tracker:indexed can be 'false' or None. In both cases is fine.
+ #
+
+ # Check ontology and instance for the single valued property
+ result = self.tracker.query ("SELECT ?indexed WHERE { test:a_string tracker:indexed ?indexed}")
+ self.assertEquals (str(result[0][0]), "false")
+
+ result = self.tracker.query ("SELECT ?content WHERE { <%s> a test:A; test:a_string ?content. }"
+ % (self.instance_single_valued))
+ self.assertEquals (str(result[0][0]), "anything 1")
+
+ # Check ontology and instance for the multiple valued property
+ result = self.tracker.query ("SELECT ?indexed WHERE { test:a_n_cardinality tracker:indexed ?indexed}")
+ self.assertEquals (str(result[0][0]), "false")
+
+ result = self.tracker.query ("SELECT ?content WHERE { <%s> a test:A; test:a_n_cardinality ?content. }"
+ % (self.instance_n_valued))
+ self.assertEquals (str(result[0][0]), "anything n")
+
if __name__ == "__main__":
diff --git a/tests/functional-tests/test-ontologies/Makefile.am b/tests/functional-tests/test-ontologies/Makefile.am
index 6574844..a9484e0 100644
--- a/tests/functional-tests/test-ontologies/Makefile.am
+++ b/tests/functional-tests/test-ontologies/Makefile.am
@@ -4,4 +4,5 @@ SUBDIRS = basic \
property-range-int-to-string \
property-range-string-to-date \
cardinality \
- notify
+ notify \
+ indexed
diff --git a/tests/functional-tests/test-ontologies/indexed/10-xsd.ontology b/tests/functional-tests/test-ontologies/indexed/10-xsd.ontology
new file mode 100644
index 0000000..c22c5fd
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/10-xsd.ontology
@@ -0,0 +1,16 @@
+ 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#> .
+
+xsd: a tracker:Namespace, tracker:Ontology ;
+ tracker:prefix "xsd" ;
+ nao:lastModified "2010-02-16T11:00:00Z" .
+
+xsd:string a rdfs:Class .
+xsd:boolean a rdfs:Class .
+xsd:integer a rdfs:Class .
+xsd:double a rdfs:Class .
+xsd:date a rdfs:Class .
+xsd:dateTime a rdfs:Class .
+
diff --git a/tests/functional-tests/test-ontologies/indexed/11-rdf.ontology b/tests/functional-tests/test-ontologies/indexed/11-rdf.ontology
new file mode 100644
index 0000000..7a485a9
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/11-rdf.ontology
@@ -0,0 +1,136 @@
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ 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#> .
+
+rdf: a tracker:Namespace, tracker:Ontology ;
+ tracker:prefix "rdf" ;
+ nao:lastModified "2010-06-29T13:00:00Z" .
+
+rdfs: a tracker:Namespace ;
+ tracker:prefix "rdfs" .
+
+rdfs:Resource a rdfs:Class ;
+ rdfs:label "All Resources" ;
+ rdfs:comment "All resources" .
+
+rdfs:Class a rdfs:Class ;
+ rdfs:label "Class" ;
+ rdfs:subClassOf rdfs:Resource .
+
+rdf:Property a rdfs:Class ;
+ rdfs:label "Property" ;
+ rdfs:subClassOf rdfs:Resource .
+
+rdfs:Literal a rdfs:Class ;
+ rdfs:label "Literal" ;
+ rdfs:subClassOf rdfs:Resource .
+
+rdf:type a rdf:Property ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range rdfs:Class .
+
+rdfs:subClassOf a rdf:Property ;
+ rdfs:domain rdfs:Class ;
+ rdfs:range rdfs:Class .
+
+rdfs:subPropertyOf a rdf:Property ;
+ rdfs:domain rdf:Property ;
+ rdfs:range rdf:Property .
+
+rdfs:comment a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:string .
+
+rdfs:label a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:string .
+
+rdfs:domain a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range rdfs:Resource .
+
+rdfs:range a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range rdfs:Class .
+
+tracker: a tracker:Namespace ;
+ tracker:prefix "tracker" .
+
+tracker:Namespace a rdfs:Class ;
+ rdfs:label "Namespace" ;
+ rdfs:subClassOf rdfs:Resource .
+
+tracker:Ontology a rdfs:Class ;
+ rdfs:label "Ontology" ;
+ rdfs:subClassOf rdfs:Resource .
+
+tracker:prefix a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain tracker:Namespace ;
+ rdfs:range xsd:string .
+
+tracker:domainIndex a rdf:Property ;
+ rdfs:domain rdfs:Class ;
+ rdfs:range rdf:Property .
+
+tracker:indexed a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
+tracker:secondaryIndex a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range rdf:Property .
+
+tracker:fulltextIndexed a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
+tracker:fulltextNoLimit a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
+tracker:transient a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
+tracker:isAnnotation a rdf:Property ;
+ rdfs:comment "The property is never embedded on physical files" ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
+tracker:weight a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:integer .
+
+tracker:defaultValue a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:string .
+
+tracker:added a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:dateTime ;
+ tracker:isAnnotation true .
+
+# implicitly updated modification time
+tracker:modified a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:integer ;
+ tracker:isAnnotation true .
+
diff --git a/tests/functional-tests/test-ontologies/indexed/12-nrl.ontology b/tests/functional-tests/test-ontologies/indexed/12-nrl.ontology
new file mode 100644
index 0000000..381e0c3
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/12-nrl.ontology
@@ -0,0 +1,18 @@
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ 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#> .
+
+nrl: a tracker:Namespace, tracker:Ontology ;
+ tracker:prefix "nrl" ;
+ nao:lastModified "2010-02-16T11:00:00Z" .
+
+nrl:InverseFunctionalProperty a rdfs:Class .
+
+nrl:maxCardinality a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:integer .
+
diff --git a/tests/functional-tests/test-ontologies/indexed/20-dc.ontology b/tests/functional-tests/test-ontologies/indexed/20-dc.ontology
new file mode 100644
index 0000000..3567110
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/20-dc.ontology
@@ -0,0 +1,19 @@
+ prefix dc: <http://purl.org/dc/elements/1.1/> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ 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#> .
+
+dc: a tracker:Namespace, tracker:Ontology ;
+ tracker:prefix "dc" ;
+ nao:lastModified "2010-03-23T16:00:00Z" .
+
+dc:date a rdf:Property ;
+ rdfs:label "Date" ;
+ rdfs:comment "A point or period of time associated with an event in the lifecycle of the resource." ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:dateTime .
+
+
diff --git a/tests/functional-tests/test-ontologies/indexed/31-nao.ontology b/tests/functional-tests/test-ontologies/indexed/31-nao.ontology
new file mode 100644
index 0000000..8303bc1
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/31-nao.ontology
@@ -0,0 +1,23 @@
+ prefix dc: <http://purl.org/dc/elements/1.1/> .
+ prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+ prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ 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#> .
+
+nao: a tracker:Namespace, tracker:Ontology ;
+ tracker:prefix "nao" ;
+ nao:lastModified "2010-03-23T16:00:00Z" .
+
+nao:lastModified a rdf:Property ;
+ rdfs:label "lastModified" ;
+ rdfs:comment "last modification date" ;
+ rdfs:subPropertyOf dc:date ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Resource ;
+ rdfs:range xsd:dateTime .
+
+
diff --git a/tests/functional-tests/test-ontologies/indexed/90-tracker.ontology b/tests/functional-tests/test-ontologies/indexed/90-tracker.ontology
new file mode 100644
index 0000000..eef0cd4
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/90-tracker.ontology
@@ -0,0 +1,27 @@
+ prefix fts: <http://www.tracker-project.org/ontologies/fts#> .
+ prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+ prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+ 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#> .
+
+tracker: a tracker:Ontology ;
+ nao:lastModified "2010-04-05T11:00:00Z" .
+
+#tracker:indexed a rdf:Property ;
+# nrl:maxCardinality 1 ;
+# rdfs:domain rdf:Property ;
+# rdfs:range xsd:boolean .
+
+tracker:notify a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdfs:Class ;
+ rdfs:range xsd:boolean .
+
+tracker:writeback a rdf:Property ;
+ nrl:maxCardinality 1 ;
+ rdfs:domain rdf:Property ;
+ rdfs:range xsd:boolean .
+
diff --git a/tests/functional-tests/test-ontologies/indexed/91-test.ontology b/tests/functional-tests/test-ontologies/indexed/91-test.ontology
new file mode 100644
index 0000000..1dcf8c6
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/91-test.ontology
@@ -0,0 +1,66 @@
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix test: <http://example.org/ns#> .
+ prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+#
+# Note: If you modify this ontology remember to replicate the changes in the other
+# 91 ontologies
+#
+#
+# A (with props for string and int, string n-cardinality, )
+# / \
+# B C
+#
+test: a tracker:Namespace, tracker:Ontology ;
+ nao:lastModified "2010-03-24T11:00:04Z" ;
+ tracker:prefix "test" .
+
+test:A a rdfs:Class .
+
+test:a_string a rdf:Property ;
+ rdfs:comment "Property to test the conversions from string" ;
+ rdfs:domain test:A ;
+ rdfs:range xsd:string ;
+ tracker:indexed true ;
+ nrl:maxCardinality 1 .
+
+test:a_datetime a rdf:Property ;
+ rdfs:comment "Property to test the changes string/date" ;
+ rdfs:domain test:A ;
+ rdfs:range xsd:dateTime ;
+ nrl:maxCardinality 1 .
+
+test:a_int a rdf:Property ;
+ rdfs:comment "Property to test the changes string/int" ;
+ rdfs:domain test:A ;
+ rdfs:range xsd:integer ;
+ nrl:maxCardinality 1 .
+
+test:a_n_cardinality a rdf:Property ;
+ rdfs:comment "Property to test the cardinality changes" ;
+ rdfs:domain test:A ;
+ tracker:indexed true ;
+ rdfs:range xsd:string .
+# Max cardinality N because is not specified
+
+test:a_superprop a rdf:Property ;
+ rdfs:comment "To use as superproperty and test the superproperty changes in the subprop." ;
+ rdfs:domain test:A ;
+ rdfs:range xsd:string .
+
+
+test:B a rdfs:Class ;
+ rdfs:subClassOf test:A .
+
+test:C a rdfs:Class ;
+ rdfs:subClassOf test:A .
+
+test:c_subprop a rdf:Property ;
+ rdfs:comment "To test changes in the superproperty" ;
+ rdfs:subPropertyOf test:a_superprop ;
+ rdfs:domain test:C ;
+ rdfs:range xsd:string .
diff --git a/tests/functional-tests/test-ontologies/indexed/Makefile.am b/tests/functional-tests/test-ontologies/indexed/Makefile.am
new file mode 100644
index 0000000..ece5b3c
--- /dev/null
+++ b/tests/functional-tests/test-ontologies/indexed/Makefile.am
@@ -0,0 +1,14 @@
+include $(top_srcdir)/Makefile.decl
+
+indexeddir = $(datadir)/tracker-tests/test-ontologies/indexed
+
+indexed_DATA = \
+ 10-xsd.ontology \
+ 11-rdf.ontology \
+ 12-nrl.ontology \
+ 20-dc.ontology \
+ 31-nao.ontology \
+ 90-tracker.ontology \
+ 91-test.ontology
+
+EXTRA_DIST = $(indexed_DATA)
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]