Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A79ED1796C for ; Mon, 20 Apr 2015 20:42:56 +0000 (UTC) Received: (qmail 36685 invoked by uid 500); 20 Apr 2015 20:42:56 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 36552 invoked by uid 500); 20 Apr 2015 20:42:56 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 36483 invoked by uid 99); 20 Apr 2015 20:42:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 20:42:56 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: message received from 54.191.145.13 which is an MX secondary for dev@commons.apache.org) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 20:42:50 +0000 Received: from r2-d2.netlabs.org (r2-d2.netlabs.org [213.238.45.90]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id E1C4F25083 for ; Mon, 20 Apr 2015 20:42:03 +0000 (UTC) Received: (qmail 65443 invoked by uid 89); 20 Apr 2015 20:40:01 -0000 Received: from unknown (HELO mail-la0-f53.google.com) (farewellutopia@netlabs.org@209.85.215.53) by 0 with ESMTPA; 20 Apr 2015 20:40:01 -0000 Received: by labbd9 with SMTP id bd9so136271153lab.2 for ; Mon, 20 Apr 2015 13:40:00 -0700 (PDT) X-Gm-Message-State: ALoCoQlMV9KnDEgx0v3uS9HdoyCypvVidzkoHkrJSIipRinUxNsyBJ/YJuEw/t/LAvwOsd5jdopm MIME-Version: 1.0 X-Received: by 10.152.25.227 with SMTP id f3mr16935820lag.67.1429562400840; Mon, 20 Apr 2015 13:40:00 -0700 (PDT) Received: by 10.152.144.71 with HTTP; Mon, 20 Apr 2015 13:40:00 -0700 (PDT) X-Originating-IP: [31.24.10.227] In-Reply-To: References: <5516CAA0.7060002@apache.org> <5518277D.30700@apache.org> Date: Mon, 20 Apr 2015 20:40:00 +0000 Message-ID: Subject: Re: [COMMONSRDF] GroupID for incubation releases From: =?UTF-8?Q?Reto_Gm=C3=BCr?= To: dev Cc: Commons Developers List Content-Type: multipart/alternative; boundary=089e0160bc44163b0d05142defca X-Virus-Checked: Checked by ClamAV on apache.org --089e0160bc44163b0d05142defca Content-Type: text/plain; charset=UTF-8 Hi Peter, I wrote some code to better answer the second part of your email. > > Besides the SPARQL usecase, here's a simple usecase for wrapping data as > > RDF: > > > > interface Person { > > String getFirstName(); > > String getLastName(); > > String getDiary() > > } > > > > interface DataBase() { > > Interator list(); > > Interator filterByLastName(String); > > Interator filterByFirstName(String); > > } > > > > No the task is to expose this dynamically as RDF (i.e. without > duplicating > > the data). > > > > Wrapping this with clerezza one would wrap the Person instance in a > > blanknode, the identity of the BlankNode would depend on the identity of > > the Person instance. Doing the same with the incubating commons rdf > > proposal would require keeping a Bidirectional Weak Hashmap of from > > Blanknode identifiers to Person objects. I don't think many programmers > > would like to do the latter, so I don't think it is currently a suitable > > API for exposing arbitrary data using the RDF datamodel. > > If there is no single or aggregate primary key for a person, then it > will not work reliably with any database, > RDF/Graph/Document/NoSQL/Relational/etc. It works internally in > Clerezza, in-memory, with the added BlankNode object wrapper, and > could be mapped using BlankNode.internalIdentifier. It isn't helpful > to use arguments about not liking a method to imply it is impossible. > I did not say that it is impossible, I just say that it takes additional code and uses additional memory (memory usage can be minimized by using a bidirectional weak hashmap). Here I've implemented the simple usecase using Clerezza: https://github.com/retog/rdfwrapper-example. The actual wrapper class is here: https://github.com/retog/rdfwrapper-example/blob/master/clerezza-based-wrapper/src/main/java/org/example/clerezza/based/wrapper/PersonDataBaseGraph.java . I think an API should be evaluated by the elegance and efficiency it allows to implement different usecases. Even if you think that the example is badly chosen and in reality persons would always come with identifiers I invite you to implement the same functionality with your API proposal, after all we should be able to wrap even a crappy API that does not expose the primary key of the underlying database. Note that the Clerezza Commons RDF based implementation works with constant memory even if the backend exposes billions of persons. I think comparing code and it's properties it's the best way to compare APIs, so I hope you - or someone else - will accept the invitation. Cheers, Reto --089e0160bc44163b0d05142defca--