W3C home > Mailing lists > Public > semantic-web@w3.org > February 2010

Re: SPARQL & memory use

From: Reto Bachmann-Gmuer <reto.bachmann@trialox.org>
Date: Tue, 9 Feb 2010 12:35:10 +0100
Message-ID: <bfcea8c71002090335r3bc46302o2c8334267a5a0d8f@mail.gmail.com>
To: Danny Ayers <danny.ayers@gmail.com>
Cc: Taylor Cowan <taylor_cowan@yahoo.com>, Semantic Web <semantic-web@w3.org>
Especially when traversing a Graph I found using a DSL makes things much
easier, in apache clerezza ScalaServerPages are typically used to render RDF
resources to HTML. The following would sort a list of concepts and generate
some XHTML from them

def skos(s: Any) = new UriRef("http://www.w3.org/2008/05/skos#"+s)
def cm(s: Any) = new UriRef("http://clerezza.org/2009/04/conceptmanager#"+s)
def rdfs(s: Any) = new UriRef("http://www.w3.org/2000/01/rdf-schema#"+s)

for (concept <- ((res/cm("conceptList"))!!)
                              .sort((a,b) => ((a/skos("prefLabel")*) <
(b/skos("prefLabel")*)))) yield {

What's happening?

   - The slash ("/") operator returns the property values, (slash minus "/-"
   would follow the property the other way round)
   - the * operation returns the value of literals and the URI of resources
   - the !! operation returns a scala list for an rdf:List as object
   - There's an implicit conversion converting node-iterators to the first

The full scaladoc is here:

note that you can mix between the DSL shortcuts in RichGraphNode and the
standard GraphNode methods (see
the plain GraphNode)


On Tue, Feb 9, 2010 at 12:40 AM, Danny Ayers <danny.ayers@gmail.com> wrote:
> On 8 February 2010 16:26, Taylor Cowan <taylor_cowan@yahoo.com> wrote:
>> Also see http://code.google.com/p/scardf/
>> Looks like a DSL approach.
> Thanks, nice to see. Must admit I'm not altogether convinced such a
> wrapper is necessary - scripting with Scala over Jena is pretty
> straightforward (and fun) anyway.
> Cheers,
> Danny.
> --
> http://danny.ayers.name
Received on Tuesday, 9 February 2010 11:35:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 07:42:17 UTC