You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Rob Vesse <rv...@dotnetrdf.org> on 2021/03/25 09:05:21 UTC

Re: About Parameterized SPARQL String

ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters

It does not have any relationship to joins.

I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data

Rob

On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:

    Hello everyone,

    I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?

    Is Parameterized SPARQL string type of join or its entirely different?

    Please someone help me out.


    Regards,
    Samita Bai


    P : Please consider the environment before printing this e-mail

    ________________________________

    CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

    ________________________________





Re: About Parameterized SPARQL String

Posted by Rob Vesse <rv...@dotnetrdf.org>.
SelectBuilder gives you more control because you are building the query directly.  The downside is that this requires you to understand how SPARQL queries get translated into ARQs internal AST in order to be able to build queries.

Also with SelectBuilder you don't have to parse the query so building a query with SelectBuilder may be more performant depending on the complexity of your queries.

So I would say ParameterizedSparqlString is better for simple queries but provides less control and performance than SelectBuilder.

Rob

On 25/03/2021, 23:13, "graham" <gr...@orangedogsoftware.com> wrote:

    I have a question on ParameterizedSparqlString. I have been using 
    SelectBuilder to build select queries. Is ParameterizedSparqlString any 
    better or worse than SelectBuilder since they seem to do roughly the 
    same thing.

    thanks

    graham

    On 25/03/21 10:05 pm, Rob Vesse wrote:
    > ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
    >
    > It does not have any relationship to joins.
    >
    > I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
    >
    > Rob
    >
    > On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
    >
    >      Hello everyone,
    >
    >      I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
    >
    >      Is Parameterized SPARQL string type of join or its entirely different?
    >
    >      Please someone help me out.
    >
    >
    >      Regards,
    >      Samita Bai
    >
    >
    >      P : Please consider the environment before printing this e-mail
    >
    >      ________________________________
    >
    >      CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
    >
    >      ________________________________
    >
    >
    >
    >
    -- 
            The Electric Monk was a labour-saving device, like a dish
          washer or a video recorder. Dishwashers washed tedious dishes
           for you, ... video recorders watched tedious television for
                you, ... Electric Monks believed things for you.






Re: About Parameterized SPARQL String

Posted by graham <gr...@orangedogsoftware.com>.
I have a question on ParameterizedSparqlString. I have been using 
SelectBuilder to build select queries. Is ParameterizedSparqlString any 
better or worse than SelectBuilder since they seem to do roughly the 
same thing.

thanks

graham

On 25/03/21 10:05 pm, Rob Vesse wrote:
> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
>
> It does not have any relationship to joins.
>
> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
>
> Rob
>
> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
>
>      Hello everyone,
>
>      I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
>
>      Is Parameterized SPARQL string type of join or its entirely different?
>
>      Please someone help me out.
>
>
>      Regards,
>      Samita Bai
>
>
>      P : Please consider the environment before printing this e-mail
>
>      ________________________________
>
>      CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>
>      ________________________________
>
>
>
>
-- 
        The Electric Monk was a labour-saving device, like a dish
      washer or a video recorder. Dishwashers washed tedious dishes
       for you, ... video recorders watched tedious television for
            you, ... Electric Monks believed things for you.


Re: About Parameterized SPARQL String

Posted by "Samita Bai / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk>.
Thank you, Andy, for a detailed description. I am interested in learning more about SPARQL from you, can you link me to some of your video lectures which I can watch to learn basics? It would be helpful.



Regards,
Samita Bai



________________________________
From: Andy Seaborne <an...@apache.org>
Sent: 26 March 2021 15:32
To: users@jena.apache.org <us...@jena.apache.org>
Subject: Re: About Parameterized SPARQL String

Hi Samita,

The values are inserted in to the overall query at the point where they
are bound. There are 3 places allowed - Basic Graph Pattern Matching
Property Path Patterns and GRAPH ?g - which are the places where SPARQL
touches the data.

Let;'s say we have { ?s ?p ?o } and we want ?s to be ex:s.

this becomes (written in SPARQL syntax)

{ ?s ?p ?o VALUES ?s { ex:s } }

which is join( {?s ?p ?o }, T) where T is the table from VALUES.

{ ?s :p ?o } UNION { ?s :q ?z }

becomes

{ ?s ?p ?o VALUES ?s { ex:s } } UNION { ?s :q ?z VALUES ?s { ex:s } }

multiple joins -- the algebra forms are given in the write-up.

Doing it this way leaves the variable in-place, so it can be used in
expressions but the value it has is forced to a specific RDF term.

     Andy

On 25/03/2021 16:52, Samita Bai / PhD CS Scholar @ City Campus wrote:
> Dear Andy,
>
> I read about the EXISTS from the link you sent. I can now understand your answer partially, can you please elaborate the following statement more.
>
> The pattern is rewritten to inject a "join" into each place the
> variables can become bound. It is not a single join.
>
> It would be helpful.
>
> Thanks in advance for your consideration.
>
> Regards,
> Samita Bai
> ________________________________
> From: Andy Seaborne <an...@apache.org>
> Sent: 25 March 2021 17:57
> To: users@jena.apache.org <us...@jena.apache.org>
> Subject: Re: About Parameterized SPARQL String
>
> https://afs.github.io/substitute
>
> This covers use in EXISTS but the mechanism is general and gives a
> foundation for value-substitution.
>
> Is it "join" - yes and no.
>
> The pattern is rewritten to inject a "join" into each place the
> variables can become bound. It is not a single join.
>
>       Andy
>
> On 25/03/2021 09:05, Rob Vesse wrote:
>> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
>>
>> It does not have any relationship to joins.
>>
>> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
>>
>> Rob
>>
>> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
>>
>>       Hello everyone,
>>
>>       I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
>>
>>       Is Parameterized SPARQL string type of join or its entirely different?
>>
>>       Please someone help me out.
>>
>>
>>       Regards,
>>       Samita Bai
>>
>>
>>       P : Please consider the environment before printing this e-mail
>>
>>       ________________________________
>>
>>       CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>>
>>       ________________________________
>>
>>
>>
>>
>
> P : Please consider the environment before printing this e-mail
>
> ________________________________
>
> CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>
> ________________________________
>

P : Please consider the environment before printing this e-mail

________________________________

CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

________________________________

Re: About Parameterized SPARQL String

Posted by Andy Seaborne <an...@apache.org>.
Hi Samita,

The values are inserted in to the overall query at the point where they 
are bound. There are 3 places allowed - Basic Graph Pattern Matching
Property Path Patterns and GRAPH ?g - which are the places where SPARQL 
touches the data.

Let;'s say we have { ?s ?p ?o } and we want ?s to be ex:s.

this becomes (written in SPARQL syntax)

{ ?s ?p ?o VALUES ?s { ex:s } }

which is join( {?s ?p ?o }, T) where T is the table from VALUES.

{ ?s :p ?o } UNION { ?s :q ?z }

becomes

{ ?s ?p ?o VALUES ?s { ex:s } } UNION { ?s :q ?z VALUES ?s { ex:s } }

multiple joins -- the algebra forms are given in the write-up.

Doing it this way leaves the variable in-place, so it can be used in 
expressions but the value it has is forced to a specific RDF term.

     Andy

On 25/03/2021 16:52, Samita Bai / PhD CS Scholar @ City Campus wrote:
> Dear Andy,
> 
> I read about the EXISTS from the link you sent. I can now understand your answer partially, can you please elaborate the following statement more.
> 
> The pattern is rewritten to inject a "join" into each place the
> variables can become bound. It is not a single join.
> 
> It would be helpful.
> 
> Thanks in advance for your consideration.
> 
> Regards,
> Samita Bai
> ________________________________
> From: Andy Seaborne <an...@apache.org>
> Sent: 25 March 2021 17:57
> To: users@jena.apache.org <us...@jena.apache.org>
> Subject: Re: About Parameterized SPARQL String
> 
> https://afs.github.io/substitute
> 
> This covers use in EXISTS but the mechanism is general and gives a
> foundation for value-substitution.
> 
> Is it "join" - yes and no.
> 
> The pattern is rewritten to inject a "join" into each place the
> variables can become bound. It is not a single join.
> 
>       Andy
> 
> On 25/03/2021 09:05, Rob Vesse wrote:
>> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
>>
>> It does not have any relationship to joins.
>>
>> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
>>
>> Rob
>>
>> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
>>
>>       Hello everyone,
>>
>>       I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
>>
>>       Is Parameterized SPARQL string type of join or its entirely different?
>>
>>       Please someone help me out.
>>
>>
>>       Regards,
>>       Samita Bai
>>
>>
>>       P : Please consider the environment before printing this e-mail
>>
>>       ________________________________
>>
>>       CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>>
>>       ________________________________
>>
>>
>>
>>
> 
> P : Please consider the environment before printing this e-mail
> 
> ________________________________
> 
> CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
> 
> ________________________________
> 

Re: About Parameterized SPARQL String

Posted by "Samita Bai / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk>.
Dear Andy,

I read about the EXISTS from the link you sent. I can now understand your answer partially, can you please elaborate the following statement more.

The pattern is rewritten to inject a "join" into each place the
variables can become bound. It is not a single join.

It would be helpful.

Thanks in advance for your consideration.

Regards,
Samita Bai
________________________________
From: Andy Seaborne <an...@apache.org>
Sent: 25 March 2021 17:57
To: users@jena.apache.org <us...@jena.apache.org>
Subject: Re: About Parameterized SPARQL String

https://afs.github.io/substitute

This covers use in EXISTS but the mechanism is general and gives a
foundation for value-substitution.

Is it "join" - yes and no.

The pattern is rewritten to inject a "join" into each place the
variables can become bound. It is not a single join.

     Andy

On 25/03/2021 09:05, Rob Vesse wrote:
> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
>
> It does not have any relationship to joins.
>
> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
>
> Rob
>
> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
>
>      Hello everyone,
>
>      I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
>
>      Is Parameterized SPARQL string type of join or its entirely different?
>
>      Please someone help me out.
>
>
>      Regards,
>      Samita Bai
>
>
>      P : Please consider the environment before printing this e-mail
>
>      ________________________________
>
>      CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>
>      ________________________________
>
>
>
>

P : Please consider the environment before printing this e-mail

________________________________

CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

________________________________

Re: About Parameterized SPARQL String

Posted by "Samita Bai / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk>.
Thank you Andy, I have to go through the link about SPARQL substitute because otherwise I am not understanding it properly.


Regards,
Samita Bai

Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Andy Seaborne <an...@apache.org>
Sent: Thursday, March 25, 2021 5:57:28 PM
To: users@jena.apache.org <us...@jena.apache.org>
Subject: Re: About Parameterized SPARQL String

https://afs.github.io/substitute

This covers use in EXISTS but the mechanism is general and gives a
foundation for value-substitution.

Is it "join" - yes and no.

The pattern is rewritten to inject a "join" into each place the
variables can become bound. It is not a single join.

     Andy

On 25/03/2021 09:05, Rob Vesse wrote:
> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
>
> It does not have any relationship to joins.
>
> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
>
> Rob
>
> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
>
>      Hello everyone,
>
>      I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
>
>      Is Parameterized SPARQL string type of join or its entirely different?
>
>      Please someone help me out.
>
>
>      Regards,
>      Samita Bai
>
>
>      P : Please consider the environment before printing this e-mail
>
>      ________________________________
>
>      CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
>
>      ________________________________
>
>
>
>

P : Please consider the environment before printing this e-mail

________________________________

CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

________________________________

Re: About Parameterized SPARQL String

Posted by Andy Seaborne <an...@apache.org>.
https://afs.github.io/substitute

This covers use in EXISTS but the mechanism is general and gives a 
foundation for value-substitution.

Is it "join" - yes and no.

The pattern is rewritten to inject a "join" into each place the 
variables can become bound. It is not a single join.

     Andy

On 25/03/2021 09:05, Rob Vesse wrote:
> ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters
> 
> It does not have any relationship to joins.
> 
> I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data
> 
> Rob
> 
> On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:
> 
>      Hello everyone,
> 
>      I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?
> 
>      Is Parameterized SPARQL string type of join or its entirely different?
> 
>      Please someone help me out.
> 
> 
>      Regards,
>      Samita Bai
> 
> 
>      P : Please consider the environment before printing this e-mail
> 
>      ________________________________
> 
>      CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
> 
>      ________________________________
> 
> 
> 
> 

Re: About Parameterized SPARQL String

Posted by "Samita Bai / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk>.
Thank you Rob, I was confused that if it could be related with joins.


Regards,
Samita Bai

Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Rob Vesse <rv...@dotnetrdf.org>
Sent: Thursday, March 25, 2021 2:05:21 PM
To: users@jena.apache.org <us...@jena.apache.org>
Subject: Re: About Parameterized SPARQL String

ParameterizedSparqlString works by simple textual substitution into the provided query string so you get a more specific query with your parameters

It does not have any relationship to joins.

I guess what you may be asking is how it compares to other methods for providing initial bindings e.g. adding VALUES to a query which would be evaluated as a Join?  The answer there is that it isn't really a fair comparison, a parameterized query vs one using VALUES might yield very different query execution plans so perform very differently.  As with all queries it's going to depend on both your queries and your data

Rob

On 25/03/2021, 08:31, "Samita Bai  / PhD CS Scholar @ City Campus" <sb...@iba.edu.pk> wrote:

    Hello everyone,

    I have used Parameterized SPARQL String for providing initial solution bindings for query execution. I need to document my technique; can anyone help me how can we compare Parameterized SPARQL String with joins?

    Is Parameterized SPARQL string type of join or its entirely different?

    Please someone help me out.


    Regards,
    Samita Bai


    P : Please consider the environment before printing this e-mail

    ________________________________

    CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

    ________________________________





P : Please consider the environment before printing this e-mail

________________________________

CONFIDENTIALITY / DISCLAIMER NOTICE: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

________________________________