Return-Path: X-Original-To: apmail-jena-users-archive@www.apache.org Delivered-To: apmail-jena-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E2B810C04 for ; Sat, 10 Aug 2013 14:01:28 +0000 (UTC) Received: (qmail 15855 invoked by uid 500); 10 Aug 2013 14:01:27 -0000 Delivered-To: apmail-jena-users-archive@jena.apache.org Received: (qmail 15592 invoked by uid 500); 10 Aug 2013 14:01:22 -0000 Mailing-List: contact users-help@jena.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jena.apache.org Delivered-To: mailing list users@jena.apache.org Received: (qmail 15584 invoked by uid 99); 10 Aug 2013 14:01:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 14:01:21 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andy.seaborne.apache@gmail.com designates 209.85.215.180 as permitted sender) Received: from [209.85.215.180] (HELO mail-ea0-f180.google.com) (209.85.215.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 14:01:16 +0000 Received: by mail-ea0-f180.google.com with SMTP id h10so2576630eaj.25 for ; Sat, 10 Aug 2013 07:00:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=ZXOcVXuO7xZdFBmQd2GAC47vtW3gFG6wgF1d+iQtv50=; b=A0hK8LsWDU+xu30BailBNIakqP0whRS74Xep55vnwiS+VOV4pXXzW5RmFvwm3esHBB Pmyjb3NVIiPz7giVb0uvUusmsPir6gytZsmsFpEoDL3Bh6WQorNoaXhPRMR/B9zgT8q4 52Uj0Ni3gTBdcZBzD4v/ckzFZDZn7LoYCBD9cOZr9tBkoxZEIrzqIZgNr/Jp30iPMs89 Cz6CXuYiuhEivu3T/8GyoM6kccxvHqKyl6UAVOG3nSxqctdjwwTlfiB43tg1to/bDg4Q BP5yq63b3K2yWQmFXkgMyhYuZSBpH6Iawtyo79Fh0quuFe2yHY9X8WhliZ0lJ8ynoDxG oM9w== X-Received: by 10.15.98.3 with SMTP id bi3mr17367915eeb.124.1376143255143; Sat, 10 Aug 2013 07:00:55 -0700 (PDT) Received: from [192.168.0.114] (cpc37-aztw23-2-0-cust35.18-1.cable.virginmedia.com. [94.174.128.36]) by mx.google.com with ESMTPSA id k3sm38401289een.16.2013.08.10.07.00.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 10 Aug 2013 07:00:54 -0700 (PDT) Message-ID: <52064795.5020904@apache.org> Date: Sat, 10 Aug 2013 15:00:53 +0100 From: Andy Seaborne User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: users@jena.apache.org Subject: Re: Case study for Jena Text: Thesaurus-augmented search References: <4E3518D35BC4E14B802A8CAE0E8819CF1655A1@lhun.zbw-nett.zbw-kiel.de> In-Reply-To: <4E3518D35BC4E14B802A8CAE0E8819CF1655A1@lhun.zbw-nett.zbw-kiel.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 09/08/13 09:12, Neubert Joachim wrote: > I just published a blog post: > > http://zbw.eu/labs/en/blog/thesaurus-augmented-search-with-jena-text > Nice. I think you can rewrite to avoid multiple text:query using a temporary variable ?x, say, and BIND: ... ?x text:query ('telework' 2) { BIND ( ?x AS ?concept ) } UNION { ?x skos:exactMatch ?concept } UNION { BIND ( ?x AS ?concept ) ?concept skos:narrower ?narrower } UNION { ?x skos:narrower ?concept } UNION { BIND ( ?x AS ?concept ) skos:related ?related } UNION { ?x skos:related ?concept } ... but if you observe it making no difference, it could be that internal Lucene caching means repeat use of the same query is fast. Is ?altLabel intended, it's in the SELECT but not in the query. If it's ?label every where you could use more property paths: # To specifically get ?prefLabel { ?concept skos:prefLabel ?prefLabel } UNION { ?concept (skos:prefLabel | skos:altLabel | skos:hiddenLabel ) ?label . } UNION { ?concept skos:exactMatch / (skos:prefLabel | skos:altLabel | skos:hiddenLabel ) ?label . because | in property paths is the same as a UNION. In the extreme: ? is "zero or one of" so .... ?concept skos:exactMatch? / (skos:prefLabel | skos:altLabel | skos:hiddenLabel ) ?label . but there comes a point where just because you can, does not mean that you should :-) Andy