[tracker-miners/wip/carlosg/graphs: 7/7] tests: Perform SELECT DISTINCT to find out resource URN



commit 7a68f307bcb55e56bc89ef69f8a78315601347a7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 29 18:49:22 2020 +0200

    tests: Perform SELECT DISTINCT to find out resource URN
    
    The test checks that the resource URN is single, which is good, but
    doesn't account for the same URN being returned through multiple graphs.
    Use SELECT DISTINCT so the check remains valid if the resource is
    scattered in different graphs.

 tests/functional-tests/miner-basic.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/miner-basic.py b/tests/functional-tests/miner-basic.py
index a48f83ba1..5b443ee0c 100755
--- a/tests/functional-tests/miner-basic.py
+++ b/tests/functional-tests/miner-basic.py
@@ -48,7 +48,7 @@ class MinerCrawlTest(fixtures.TrackerMinerTest):
 
     def __get_text_documents(self):
         return self.tracker.query("""
-          SELECT ?url WHERE {
+          SELECT DISTINCT ?url WHERE {
               ?u a nfo:TextDocument ;
                  nie:isStoredAs/nie:url ?url.
           }
@@ -56,9 +56,10 @@ class MinerCrawlTest(fixtures.TrackerMinerTest):
 
     def __get_parent_urn(self, filepath):
         result = self.tracker.query("""
-          SELECT nfo:belongsToContainer(?u) WHERE {
+          SELECT DISTINCT ?p WHERE {
               ?u a nfo:FileDataObject ;
-                 nie:url \"%s\" .
+                 nie:url \"%s\" ;
+                 nfo:belongsToContainer ?p
           }
           """ % (self.uri(filepath)))
         self.assertEqual(len(result), 1)


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