You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by kumar rohit <ku...@gmail.com> on 2015/08/20 09:10:40 UTC

JENA code or SPARQL

What is the best way to query a model in Jena? Through  classes and methods
of Jena like below
ResIterator itr = model.listSubjectsWithProperty(studies);

Or through SPARQL inside jena code.?

and how one is best than the other?

Re: JENA code or SPARQL

Posted by Rob Walpole <ro...@gmail.com>.
You probably want to do both. Write your SPARQL queries - either in Jena
ARQ or in text files which you post to Jena Fuseki (depending on your set
up) - and then load the results into a Model to extract the bits of
information you need.

Rob

Rob Walpole
Email robkwalpole@gmail.com
Tel. +44 (0)7969 869881http://www.linkedin.com/in/robwalpole


On Thu, Aug 20, 2015 at 8:10 AM, kumar rohit <ku...@gmail.com> wrote:

> What is the best way to query a model in Jena? Through  classes and methods
> of Jena like below
> ResIterator itr = model.listSubjectsWithProperty(studies);
>
> Or through SPARQL inside jena code.?
>
> and how one is best than the other?
>

Re: JENA code or SPARQL

Posted by kumar rohit <ku...@gmail.com>.
Thank you Martynas, it means SPARQL may be used as most of the queries
multi-pattern and complex.

On Thu, Aug 20, 2015 at 12:10 PM, Martynas Jusevičius <martynas@graphity.org
> wrote:

> Kumar,
>
> From my experience, if you only have a single triple patter like ?s
> <studies> ?o or ?s <studies> <some>, then the Model API might be more
> convenient. But when you start combining them, and especially having
> optional patterns, it's a good sign that it's time to move on to
> SPARQL.
>
> Martynas
> graphityhq.com
>
> On Thu, Aug 20, 2015 at 9:10 AM, kumar rohit <ku...@gmail.com>
> wrote:
> > What is the best way to query a model in Jena? Through  classes and
> methods
> > of Jena like below
> > ResIterator itr = model.listSubjectsWithProperty(studies);
> >
> > Or through SPARQL inside jena code.?
> >
> > and how one is best than the other?
>

Re: JENA code or SPARQL

Posted by Martynas Jusevičius <ma...@graphity.org>.
Kumar,

>From my experience, if you only have a single triple patter like ?s
<studies> ?o or ?s <studies> <some>, then the Model API might be more
convenient. But when you start combining them, and especially having
optional patterns, it's a good sign that it's time to move on to
SPARQL.

Martynas
graphityhq.com

On Thu, Aug 20, 2015 at 9:10 AM, kumar rohit <ku...@gmail.com> wrote:
> What is the best way to query a model in Jena? Through  classes and methods
> of Jena like below
> ResIterator itr = model.listSubjectsWithProperty(studies);
>
> Or through SPARQL inside jena code.?
>
> and how one is best than the other?