Exemplo n.º 1
0
    def query_tag(self, tagNames):
        soprano_term_uri = Soprano.Vocabulary.NAO.hasTag()
        nepomuk_property = Nepomuk.Types.Property(soprano_term_uri)

        tag = Nepomuk.Tag(tagNames[0])

        if tag.uri() == "":
            print "Tag \"%s\" does not exist" % tagNames[0]
            return False

        comparison_term = Nepomuk.Query.ComparisonTerm(nepomuk_property, Nepomuk.Query.ResourceTerm(tag))
        if self.options.filesOnly:
            query = Nepomuk.Query.FileQuery(comparison_term)
        else:
            query = Nepomuk.Query.Query(comparison_term)

        search_url = query.toSearchUrl()

        search_job = KIO.listDir(kdecore.KUrl(search_url), KIO.HideProgressInfo)
        search_job.entries.connect(self.search_slot)
        search_job.result.connect(self.result)
        search_job.start()
        return search_job
Exemplo n.º 2
0
 def query_string(self, url):
     search_job = KIO.listDir(kdecore.KUrl('nepomuksearch:/?query=' + url), KIO.HideProgressInfo)
     search_job.entries.connect(self.search_slot)
     search_job.result.connect(self.result)
     search_job.start()
     return search_job