Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B3F6B4AAF for ; Sat, 21 May 2011 14:58:33 +0000 (UTC) Received: (qmail 98739 invoked by uid 500); 21 May 2011 14:58:33 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 98698 invoked by uid 500); 21 May 2011 14:58:33 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 98690 invoked by uid 99); 21 May 2011 14:58:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 May 2011 14:58:32 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of justinedelson@gmail.com designates 209.85.161.170 as permitted sender) Received: from [209.85.161.170] (HELO mail-gx0-f170.google.com) (209.85.161.170) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 May 2011 14:58:25 +0000 Received: by gxk27 with SMTP id 27so2969622gxk.1 for ; Sat, 21 May 2011 07:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=vTdkVhDX82t6GhQBde5UXNbyyvEFnZjqcpUgFIgHgxk=; b=sYSkH3ELMr7P2jf1AyEIdmfu6wN57XCRLkawK0Qaw4nX1POIMfQhTfWK75BaEJY3nB RRmkOZbPF5Z/6t9LdYlQyGV8CCMC9vwt/lkrX4epKHVS5ecT3v85DbjmldqBP4b4FBWS +FRPM1Lm15CHNYfqUOQbN6LstmXndCPYhgY4A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=gdfwqdoYw/pP7QRKrj7ZBQsz1JpN+jVD5HwVBW3UcwbRc93IywyDlEuPPLFMo1H1sl 5dsKZJhjSQXQdMnQnNwKUk7pm5Z2Xgtj2okzT+0cHFRKwyEJVkobuObjJJYy0S+4e3iL IiOLjE2pnz2dYoXj8Dc2FZN42DfewZauPsBL4= MIME-Version: 1.0 Received: by 10.236.73.227 with SMTP id v63mr741826yhd.233.1305989884151; Sat, 21 May 2011 07:58:04 -0700 (PDT) Sender: justinedelson@gmail.com Received: by 10.236.111.36 with HTTP; Sat, 21 May 2011 07:58:04 -0700 (PDT) In-Reply-To: References: Date: Sat, 21 May 2011 10:58:04 -0400 X-Google-Sender-Auth: O-RoW5vt62j0ZjA81JIM07zUIfM Message-ID: Subject: Re: data integrity (mix:referenceable) From: Justin Edelson To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Keep in mind that mix:referenceable nodes are meant to be the *target* of a REFERENCE or WEAKREFERENCE property. You seem to be thinking of using them as the *source* which is not the case. In the case you're describing, I would have a node at /content/top_10_articles/2011/05 with a multi-valued STRING property where each value is the path to an article node. My rendering code would loop through the values of this property, getting the corresponding node from the repository and doing something with it (in the case of Sling, this would probably be done with a sling:include tag and a selector script). The rendering code would be able to deal with the situation where a path refers to a node which no longer exists on the chance that a referenced article was deleted. Instead of a multi-valued STRING property, you could alternatively use PATH, REFERENCE or WEAKREFERENCE as the property type, but those carry additional overhead. In the case of REFERENCE, the repository would enforce referential integrity thereby preventing the deletion of a "top 10 article". I doubt you want this. In general, I would avoid using a query for this. Justin On Fri, May 20, 2011 at 7:48 AM, sam lee wrote: > Hey, > > I store articles in JCR as nt:unstructured. > > I need to have a list of "top 10 articles". The list is curated. The list= is > archived monthly. > > What's a proper way of storing "top 10 articles" ? > > In relational database, I would create top_10_articles(article_id foreign > key, archive_date) =A0table. > > I could create a node, =A0/content/2011/05/top_10_articles, that has chil= d > nodes that are mix:referenceables referencing actual article > =A0(/content/article/foo/bar). Would mix:referenceable keep my data > consistent? For example, removing /content/article/foo/bar should delete = the > child node under top_10_articles. Also, modification of > /content/article/foo/bar should be reflected on the child node of > top_10_articles. > > Or, should I just put =A0isTopArticle boolean in every article and query = for > articles that has isTopArticle =A0(and filter out matching date range for > monthly archive)? >