You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Nauman Ramzan <na...@gmail.com> on 2015/07/21 12:35:55 UTC
SPARQL query
Hi all !
I have this type of data
> <offer1> rdf:isOfferOf <product1>
> <offer2> rdf:isOfferOf <product1>
> <offer3> rdf:isOfferOf <product2>
> <offer4> rdf:isOfferOf <product2>
>
<offer5> rdf:isOfferOf <product2>
<offer7> rdf:isOfferOf <product7>
now I want to get all offers of product1, product2.
second counts of offers.
Thank you
Re: SPARQL query
Posted by Lorenz Bühmann <bu...@informatik.uni-leipzig.de>.
Wrong mailing list to ask such a question.
Please use StackOverflow or even better http://answers.semanticweb.com/
> Hi all !
> I have this type of data
>
>> <offer1> rdf:isOfferOf <product1>
>> <offer2> rdf:isOfferOf <product1>
>> <offer3> rdf:isOfferOf <product2>
>> <offer4> rdf:isOfferOf <product2>
>>
> <offer5> rdf:isOfferOf <product2>
>
> <offer7> rdf:isOfferOf <product7>
>
> now I want to get all offers of product1, product2.
> second counts of offers.
> Thank you
>
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: SPARQL query
Posted by Andy Seaborne <an...@apache.org>.
On 25/07/15 12:09, Nauman Ramzan wrote:
> Dear Andy,
>
> I am using Jena ARQ.
But is ARQ executing the query because:
SELECT ?ProductID (COUNT(?cond) AS ?total)
(MIN(?pr) AS ?priceMIN ) ?condition WHERE{
..
}
has non-group variables in the SELECT which ARQ will generate a parse
"""
Non-group key variable in SELECT: ?condition
"""
Same applies to ?ProductID - which one is in the error message is
subject to hash set randomness.
http://www.sparql.org/query-validator.html
Andy
>
> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <na...@gmail.com>
> wrote:
>
>> Hi James Anderson !
>> Thank you for your help.
>> Now construct this query
>>
>> CONSTRUCT{
>>> ?pid dprop:title ?title;
>>> dprop:description ?description;
>>> dprop:brand ?brand;
>>> dprop:isPublic ?isPublic;
>>> dprop:count ?total;
>>> dprop:priceMin ?priceMin;
>>> dprop:condition ?condition;
>>> dprop:createdAt ?createdAt.
>>> }
>>> WHERE {
>>> ?pid dprop:productTitle ?title;
>>> dprop:productDescription ?description;
>>> dprop:productBrand ?brand;
>>> dprop:isPublic ?isPublic;
>>> dprop:createdAt ?createdAt.
>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>> {
>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>> ?condition WHERE{
>>> ?pid ^mod:isOfferOf ?oid.
>>> ?oid dprop:price ?pr.
>>> ?oid dprop:condition ?cond.
>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>> }
>>> }
>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W prod:Rl5RVl5Y
>>> prod:Rl5RVl5U }
>>> }
>>
>>
>> Everything is working fine. except sub-query calculation error. result of
>> total is not correct.
>> My schema(relation between product and offer ) you can see in first
>> message.
>>
>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>
>>>> Hi Here is my question in details. Now i am getting counts and other
>>>> info.
>>>> but i want to define/use this result as data of outer block.
>>>>
>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>> same as
>>>>
>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>> Thank you.
>>>>
>>>
>>> The query isn't legal SPARQL (parse error - non-group'ed variables in the
>>> inner select - even after completing the prefixes). Previously, you
>>> indicated you were using Virtuoso. Their support lists are on SourceForge.
>>>
>>> It will help them to have a complete, minimal example.
>>>
>>> A small amount of data
>>> A complete working query
>>>
>>> Andy
>>>
>>>
>>>
>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>
>>>>> Hi all !
>>>>>> I have this type of data
>>>>>>
>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>
>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>
>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>
>>>>>>
>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>
>>>>>> now I want to get all offers of product1, product2.
>>>>>> second counts of offers.
>>>>>> Thank you
>>>>>>
>>>>>>
>>>>>> What have you tried?
>>>>>
>>>>> A complete, minimal example of what you have tried makes it easier to
>>>>> answer the question.
>>>>>
>>>>> Andy
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Dear James Anderson
My query is working now. But Because you are more experienced in this
technology. can you please just take a look on my query.
So that I can Know is there any improvement left in my query.
Best Regards
Nauman
On Mon, Jul 27, 2015 at 10:03 PM, Nauman Ramzan <na...@gmail.com>
wrote:
> Dear James Anderson
> I am trying to write query to get offer id with minimum price. Here is my
> query.
> Because I am new in this technology. So sorry i can write only this query.
> Here is my query.
> http://dydra.com/nauman/question-prod-offers/@query#get-oid-as-well
>
> I am getting all my required information but problem is I am getting all
> newOffers 0 and all usedOffers 1.
>
> Thank you
> With best wishes
>
> Regards
>
> Nauman
>
> On Sun, Jul 26, 2015 at 10:17 PM, james anderson <ja...@dydra.com> wrote:
>
>> good afternoon;
>>
>> > On 2015-07-26, at 18:46, Nauman Ramzan <na...@gmail.com>
>> wrote:
>> >
>> > Dear James Anderson !
>> > Its a great favour from you. Thank you very much.
>> >
>> > How can I get oid of that offer which have minimum price / at-least one
>> > offer id per product?
>> >
>> > Thank you again.
>>
>> in case one wonders, as i am mostly at a loss when it comes to divining
>> the consequences of a query with no insight into the dataset, i invited
>> nauman here:
>>
>>
>> http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums
>> <
>> http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums
>> >
>>
>> and worked through several queries to illustrate to him, how a subselect
>> and an aggregate work.
>>
>>
>> >
>> > Regards
>> > Nauman
>> >
>> > On Sun, Jul 26, 2015 at 3:35 PM, buehmann <
>> > buehmann@informatik.uni-leipzig.de> wrote:
>> >
>> >> You still don't get the usage of GROUP BY in SPARQL I guess.
>> >> You have to return the ?pid variable not only GROUP BY it. The reason
>> is
>> >> that the ?pid has to be projected to the outer query.
>> >>
>> >> And once you use GROUP BY, you can only return aggregates (min, max,
>> etc)
>> >> or variables that you're grouping by. That means, you have also to
>> group by
>> >> the ?condition variable.
>> >>
>> >> Lorenz
>> >>
>> >>
>> >> […]
>>
>> best regards, from berlin,
>>
>>
>>
>>
>> ---
>> james anderson | james@dydra.com | http://dydra.com
>>
>>
>>
>>
>>
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Dear James Anderson
I am trying to write query to get offer id with minimum price. Here is my
query.
Because I am new in this technology. So sorry i can write only this query.
Here is my query.
http://dydra.com/nauman/question-prod-offers/@query#get-oid-as-well
I am getting all my required information but problem is I am getting all
newOffers 0 and all usedOffers 1.
Thank you
With best wishes
Regards
Nauman
On Sun, Jul 26, 2015 at 10:17 PM, james anderson <ja...@dydra.com> wrote:
> good afternoon;
>
> > On 2015-07-26, at 18:46, Nauman Ramzan <na...@gmail.com>
> wrote:
> >
> > Dear James Anderson !
> > Its a great favour from you. Thank you very much.
> >
> > How can I get oid of that offer which have minimum price / at-least one
> > offer id per product?
> >
> > Thank you again.
>
> in case one wonders, as i am mostly at a loss when it comes to divining
> the consequences of a query with no insight into the dataset, i invited
> nauman here:
>
>
> http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums
> <
> http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums
> >
>
> and worked through several queries to illustrate to him, how a subselect
> and an aggregate work.
>
>
> >
> > Regards
> > Nauman
> >
> > On Sun, Jul 26, 2015 at 3:35 PM, buehmann <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> You still don't get the usage of GROUP BY in SPARQL I guess.
> >> You have to return the ?pid variable not only GROUP BY it. The reason is
> >> that the ?pid has to be projected to the outer query.
> >>
> >> And once you use GROUP BY, you can only return aggregates (min, max,
> etc)
> >> or variables that you're grouping by. That means, you have also to
> group by
> >> the ?condition variable.
> >>
> >> Lorenz
> >>
> >>
> >> […]
>
> best regards, from berlin,
>
>
>
>
> ---
> james anderson | james@dydra.com | http://dydra.com
>
>
>
>
>
>
Re: SPARQL query
Posted by james anderson <ja...@dydra.com>.
good afternoon;
> On 2015-07-26, at 18:46, Nauman Ramzan <na...@gmail.com> wrote:
>
> Dear James Anderson !
> Its a great favour from you. Thank you very much.
>
> How can I get oid of that offer which have minimum price / at-least one
> offer id per product?
>
> Thank you again.
in case one wonders, as i am mostly at a loss when it comes to divining the consequences of a query with no insight into the dataset, i invited nauman here:
http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums <http://dydra.com/nauman/question-prod-offers/@query#grouped-as-sub-select-of-sums>
and worked through several queries to illustrate to him, how a subselect and an aggregate work.
>
> Regards
> Nauman
>
> On Sun, Jul 26, 2015 at 3:35 PM, buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> You still don't get the usage of GROUP BY in SPARQL I guess.
>> You have to return the ?pid variable not only GROUP BY it. The reason is
>> that the ?pid has to be projected to the outer query.
>>
>> And once you use GROUP BY, you can only return aggregates (min, max, etc)
>> or variables that you're grouping by. That means, you have also to group by
>> the ?condition variable.
>>
>> Lorenz
>>
>>
>> […]
best regards, from berlin,
---
james anderson | james@dydra.com | http://dydra.com
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Dear James Anderson !
Its a great favour from you. Thank you very much.
How can I get oid of that offer which have minimum price / at-least one
offer id per product?
Thank you again.
Regards
Nauman
On Sun, Jul 26, 2015 at 3:35 PM, buehmann <
buehmann@informatik.uni-leipzig.de> wrote:
> You still don't get the usage of GROUP BY in SPARQL I guess.
> You have to return the ?pid variable not only GROUP BY it. The reason is
> that the ?pid has to be projected to the outer query.
>
> And once you use GROUP BY, you can only return aggregates (min, max, etc)
> or variables that you're grouping by. That means, you have also to group by
> the ?condition variable.
>
> Lorenz
>
>
> On 26.07.2015 11:18, Nauman Ramzan wrote:
>
>> Hi Buehmann !
>> I am using GROUP BY ?pid inside inner-query as well as outer-query
>> Like
>>
>> PREFIX mod:<http://www.example.com/datam/op/>
>>> PREFIX prod:<http://www.example.com/products/>
>>> SELECT DISTINCT ?pid (?title )(?count)# (?condition)
>>> FROM <http://www.example.com/products>
>>> WHERE {
>>> ?pid dprop:productTitle ?title.
>>> ?pid dprop:productDescription ?description.
>>> {
>>> SELECT (COUNT(?oid) AS ?count) #(?condition)
>>>
>> FROM <http://www.example.com/offers> WHERE { ?oid oprop:isOfferOf
>>
>>> ?pid. ?oid dprop:condition ?condition. } GROUP BY ?pid
>>>
>> }
>>
>>> }
>>> GROUP BY ?pid
>>>
>>
>> I am still getting duplicate ?pid.
>> Second problem is I also wanted to get ?condition but if I'll un-comment
>> ?condition then compiler is showing this error
>>
>> Variable ?condition is used in the result set outside aggregate and not
>>
>>> mentioned in GROUP BY clause
>>>
>>
>> Can you please help me to correct this query.
>>
>> Thank you.
>>
>> On Sun, Jul 26, 2015 at 1:02 PM, buehmann <
>> buehmann@informatik.uni-leipzig.de> wrote:
>>
>> What Andy means is that the pid variable of the subselect is not bound to
>>> the outer query. Sub-SELECTs are evaluated first, those values have to be
>>> propagated/projected to the outer query, otherwise you don't get the
>>> intended values.
>>> It's so simple add
>>> GROUP BY ?pid
>>>
>>> to the sub-SELECT and also add
>>>
>>> SELECT ... ?pid
>>>
>>> Lorenz
>>>
>>>
>>> On 26.07.2015 08:36, Nauman Ramzan wrote:
>>>
>>> Dear Andy Good Morning !
>>>> Can you please explain more. How can I fix this problem ?
>>>> Because
>>>> in outer query I am getting ?pid one by one. in sub query instead of
>>>> taking
>>>> value from outer query subquery is taking value of ?pid from VALUES.
>>>>
>>>> My Problem I want to get Product information and counts of new and used
>>>>
>>>> offers against each product.
>>>>>
>>>>> Thank you.
>>>> Regards
>>>> Nauman
>>>>
>>>> On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 25/07/15 12:09, Nauman Ramzan wrote:
>>>>
>>>>> Dear Andy,
>>>>>
>>>>>> I am using Jena ARQ.
>>>>>>
>>>>>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>>>>>> nauman.emallates@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Hi James Anderson !
>>>>>>
>>>>>> Thank you for your help.
>>>>>>> Now construct this query
>>>>>>>
>>>>>>> CONSTRUCT{
>>>>>>>
>>>>>>> ?pid dprop:title ?title;
>>>>>>>
>>>>>>>> dprop:description ?description;
>>>>>>>> dprop:brand ?brand;
>>>>>>>> dprop:isPublic ?isPublic;
>>>>>>>> dprop:count ?total;
>>>>>>>> dprop:priceMin ?priceMin;
>>>>>>>> dprop:condition ?condition;
>>>>>>>> dprop:createdAt ?createdAt.
>>>>>>>> }
>>>>>>>> WHERE {
>>>>>>>> ?pid dprop:productTitle ?title;
>>>>>>>> dprop:productDescription ?description;
>>>>>>>> dprop:productBrand ?brand;
>>>>>>>> dprop:isPublic ?isPublic;
>>>>>>>> dprop:createdAt ?createdAt.
>>>>>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>>>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>>>>>> {
>>>>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>>>> ?condition WHERE{
>>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>>> ?oid dprop:price ?pr.
>>>>>>>> ?oid dprop:condition ?cond.
>>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>>> }
>>>>>>>> }
>>>>>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>>>>>> prod:Rl5RVl5Y
>>>>>>>> prod:Rl5RVl5U }
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> Everything is working fine. except sub-query calculation error.
>>>>>>> result
>>>>>>> of
>>>>>>> total is not correct.
>>>>>>>
>>>>>>> That maybe because there are 2 different ?pid variables.
>>>>>>>
>>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>
>>>>>> ?condition WHERE{
>>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>>> ?oid dprop:price ?pr.
>>>>>>>> ?oid dprop:condition ?cond.
>>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>>> }
>>>>>>>>
>>>>>>>> ?pid is not projected out so it is not joined with the one in the
>>>>>>>
>>>>>> VALUEs
>>>>> clause. You could GROUP BY ?pid and add it to the SELECT clause. You
>>>>> can
>>>>> also just have
>>>>>
>>>>> WHERE {
>>>>> SELECT ... { ... }
>>>>> GROUP BY ?pid
>>>>> }
>>>>>
>>>>> with everything inside the SELECT's {}
>>>>>
>>>>> Andy
>>>>>
>>>>>
>>>>> My schema(relation between product and offer ) you can see in first
>>>>>
>>>>> message.
>>>>>>
>>>>>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>>>>
>>>>>>> Hi Here is my question in details. Now i am getting counts and
>>>>>>>> other
>>>>>>>>
>>>>>>>> info.
>>>>>>>>> but i want to define/use this result as data of outer block.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>>>>>> same as
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>>>>>> Thank you.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> The query isn't legal SPARQL (parse error - non-group'ed
>>>>>>>>> variables
>>>>>>>>>
>>>>>>>> in
>>>>>>>> the
>>>>>>>> inner select - even after completing the prefixes). Previously, you
>>>>>>>> indicated you were using Virtuoso. Their support lists are on
>>>>>>>> SourceForge.
>>>>>>>>
>>>>>>>> It will help them to have a complete, minimal example.
>>>>>>>>
>>>>>>>> A small amount of data
>>>>>>>> A complete working query
>>>>>>>>
>>>>>>>> Andy
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>>>>>
>>>>>>>>> Hi all !
>>>>>>>>>
>>>>>>>>>> I have this type of data
>>>>>>>>>>
>>>>>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>>>>>
>>>>>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>>>>>
>>>>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>>>>>
>>>>>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>>>>>>
>>>>>>>>>>> now I want to get all offers of product1, product2.
>>>>>>>>>>> second counts of offers.
>>>>>>>>>>> Thank you
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> What have you tried?
>>>>>>>>>>>
>>>>>>>>>>> A complete, minimal example of what you have tried makes it
>>>>>>>>>>>
>>>>>>>>>> easier to
>>>>>>>>>> answer the question.
>>>>>>>>>>
>>>>>>>>>> Andy
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>
Re: SPARQL query
Posted by buehmann <bu...@informatik.uni-leipzig.de>.
You still don't get the usage of GROUP BY in SPARQL I guess.
You have to return the ?pid variable not only GROUP BY it. The reason is
that the ?pid has to be projected to the outer query.
And once you use GROUP BY, you can only return aggregates (min, max,
etc) or variables that you're grouping by. That means, you have also to
group by the ?condition variable.
Lorenz
On 26.07.2015 11:18, Nauman Ramzan wrote:
> Hi Buehmann !
> I am using GROUP BY ?pid inside inner-query as well as outer-query
> Like
>
>> PREFIX mod:<http://www.example.com/datam/op/>
>> PREFIX prod:<http://www.example.com/products/>
>> SELECT DISTINCT ?pid (?title )(?count)# (?condition)
>> FROM <http://www.example.com/products>
>> WHERE {
>> ?pid dprop:productTitle ?title.
>> ?pid dprop:productDescription ?description.
>> {
>> SELECT (COUNT(?oid) AS ?count) #(?condition)
> FROM <http://www.example.com/offers> WHERE { ?oid oprop:isOfferOf
>> ?pid. ?oid dprop:condition ?condition. } GROUP BY ?pid
> }
>> }
>> GROUP BY ?pid
>
> I am still getting duplicate ?pid.
> Second problem is I also wanted to get ?condition but if I'll un-comment
> ?condition then compiler is showing this error
>
> Variable ?condition is used in the result set outside aggregate and not
>> mentioned in GROUP BY clause
>
> Can you please help me to correct this query.
>
> Thank you.
>
> On Sun, Jul 26, 2015 at 1:02 PM, buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> What Andy means is that the pid variable of the subselect is not bound to
>> the outer query. Sub-SELECTs are evaluated first, those values have to be
>> propagated/projected to the outer query, otherwise you don't get the
>> intended values.
>> It's so simple add
>> GROUP BY ?pid
>>
>> to the sub-SELECT and also add
>>
>> SELECT ... ?pid
>>
>> Lorenz
>>
>>
>> On 26.07.2015 08:36, Nauman Ramzan wrote:
>>
>>> Dear Andy Good Morning !
>>> Can you please explain more. How can I fix this problem ?
>>> Because
>>> in outer query I am getting ?pid one by one. in sub query instead of
>>> taking
>>> value from outer query subquery is taking value of ?pid from VALUES.
>>>
>>> My Problem I want to get Product information and counts of new and used
>>>
>>>> offers against each product.
>>>>
>>> Thank you.
>>> Regards
>>> Nauman
>>>
>>> On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 25/07/15 12:09, Nauman Ramzan wrote:
>>>> Dear Andy,
>>>>> I am using Jena ARQ.
>>>>>
>>>>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>>>>> nauman.emallates@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Hi James Anderson !
>>>>>
>>>>>> Thank you for your help.
>>>>>> Now construct this query
>>>>>>
>>>>>> CONSTRUCT{
>>>>>>
>>>>>> ?pid dprop:title ?title;
>>>>>>> dprop:description ?description;
>>>>>>> dprop:brand ?brand;
>>>>>>> dprop:isPublic ?isPublic;
>>>>>>> dprop:count ?total;
>>>>>>> dprop:priceMin ?priceMin;
>>>>>>> dprop:condition ?condition;
>>>>>>> dprop:createdAt ?createdAt.
>>>>>>> }
>>>>>>> WHERE {
>>>>>>> ?pid dprop:productTitle ?title;
>>>>>>> dprop:productDescription ?description;
>>>>>>> dprop:productBrand ?brand;
>>>>>>> dprop:isPublic ?isPublic;
>>>>>>> dprop:createdAt ?createdAt.
>>>>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>>>>> {
>>>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>>> ?condition WHERE{
>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>> ?oid dprop:price ?pr.
>>>>>>> ?oid dprop:condition ?cond.
>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>> }
>>>>>>> }
>>>>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>>>>> prod:Rl5RVl5Y
>>>>>>> prod:Rl5RVl5U }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>> Everything is working fine. except sub-query calculation error. result
>>>>>> of
>>>>>> total is not correct.
>>>>>>
>>>>>> That maybe because there are 2 different ?pid variables.
>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>>> ?condition WHERE{
>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>> ?oid dprop:price ?pr.
>>>>>>> ?oid dprop:condition ?cond.
>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>> }
>>>>>>>
>>>>>> ?pid is not projected out so it is not joined with the one in the
>>>> VALUEs
>>>> clause. You could GROUP BY ?pid and add it to the SELECT clause. You
>>>> can
>>>> also just have
>>>>
>>>> WHERE {
>>>> SELECT ... { ... }
>>>> GROUP BY ?pid
>>>> }
>>>>
>>>> with everything inside the SELECT's {}
>>>>
>>>> Andy
>>>>
>>>>
>>>> My schema(relation between product and offer ) you can see in first
>>>>
>>>>> message.
>>>>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>>>
>>>>>>> Hi Here is my question in details. Now i am getting counts and other
>>>>>>>
>>>>>>>> info.
>>>>>>>> but i want to define/use this result as data of outer block.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>>>>> same as
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>>>>> Thank you.
>>>>>>>>
>>>>>>>>
>>>>>>>> The query isn't legal SPARQL (parse error - non-group'ed variables
>>>>>>> in
>>>>>>> the
>>>>>>> inner select - even after completing the prefixes). Previously, you
>>>>>>> indicated you were using Virtuoso. Their support lists are on
>>>>>>> SourceForge.
>>>>>>>
>>>>>>> It will help them to have a complete, minimal example.
>>>>>>>
>>>>>>> A small amount of data
>>>>>>> A complete working query
>>>>>>>
>>>>>>> Andy
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>>>>
>>>>>>>> Hi all !
>>>>>>>>> I have this type of data
>>>>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>>>>
>>>>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>>>>
>>>>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>>>>
>>>>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>>>> now I want to get all offers of product1, product2.
>>>>>>>>>> second counts of offers.
>>>>>>>>>> Thank you
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> What have you tried?
>>>>>>>>>>
>>>>>>>>>> A complete, minimal example of what you have tried makes it
>>>>>>>>> easier to
>>>>>>>>> answer the question.
>>>>>>>>>
>>>>>>>>> Andy
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
My use-case is I have this schema
>
> *M* offers -- dprop:isOfferOf -- *1* Product.
Now I have list of product ids and I want to get
1. Product information
2. Counts and min-Price of all (New and Used) offers
Thank you
Regards
Nauman
On Sun, Jul 26, 2015 at 1:18 PM, Nauman Ramzan <na...@gmail.com>
wrote:
> Hi Buehmann !
> I am using GROUP BY ?pid inside inner-query as well as outer-query
> Like
>
>> PREFIX mod:<http://www.example.com/datam/op/>
>> PREFIX prod:<http://www.example.com/products/>
>> SELECT DISTINCT ?pid (?title )(?count)# (?condition)
>> FROM <http://www.example.com/products>
>> WHERE {
>> ?pid dprop:productTitle ?title.
>> ?pid dprop:productDescription ?description.
>> {
>> SELECT (COUNT(?oid) AS ?count) #(?condition)
>
> FROM <http://www.example.com/offers> WHERE { ?oid oprop:isOfferOf
>> ?pid. ?oid dprop:condition ?condition. } GROUP BY ?pid
>
> }
>> }
>> GROUP BY ?pid
>
>
> I am still getting duplicate ?pid.
> Second problem is I also wanted to get ?condition but if I'll un-comment
> ?condition then compiler is showing this error
>
> Variable ?condition is used in the result set outside aggregate and not
>> mentioned in GROUP BY clause
>
>
> Can you please help me to correct this query.
>
> Thank you.
>
> On Sun, Jul 26, 2015 at 1:02 PM, buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> What Andy means is that the pid variable of the subselect is not bound to
>> the outer query. Sub-SELECTs are evaluated first, those values have to be
>> propagated/projected to the outer query, otherwise you don't get the
>> intended values.
>> It's so simple add
>> GROUP BY ?pid
>>
>> to the sub-SELECT and also add
>>
>> SELECT ... ?pid
>>
>> Lorenz
>>
>>
>> On 26.07.2015 08:36, Nauman Ramzan wrote:
>>
>>> Dear Andy Good Morning !
>>> Can you please explain more. How can I fix this problem ?
>>> Because
>>> in outer query I am getting ?pid one by one. in sub query instead of
>>> taking
>>> value from outer query subquery is taking value of ?pid from VALUES.
>>>
>>> My Problem I want to get Product information and counts of new and used
>>>
>>>> offers against each product.
>>>>
>>>
>>> Thank you.
>>> Regards
>>> Nauman
>>>
>>> On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 25/07/15 12:09, Nauman Ramzan wrote:
>>>>
>>>> Dear Andy,
>>>>>
>>>>> I am using Jena ARQ.
>>>>>
>>>>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>>>>> nauman.emallates@gmail.com>
>>>>>
>>>>> wrote:
>>>>>
>>>>> Hi James Anderson !
>>>>>
>>>>>> Thank you for your help.
>>>>>> Now construct this query
>>>>>>
>>>>>> CONSTRUCT{
>>>>>>
>>>>>> ?pid dprop:title ?title;
>>>>>>> dprop:description ?description;
>>>>>>> dprop:brand ?brand;
>>>>>>> dprop:isPublic ?isPublic;
>>>>>>> dprop:count ?total;
>>>>>>> dprop:priceMin ?priceMin;
>>>>>>> dprop:condition ?condition;
>>>>>>> dprop:createdAt ?createdAt.
>>>>>>> }
>>>>>>> WHERE {
>>>>>>> ?pid dprop:productTitle ?title;
>>>>>>> dprop:productDescription ?description;
>>>>>>> dprop:productBrand ?brand;
>>>>>>> dprop:isPublic ?isPublic;
>>>>>>> dprop:createdAt ?createdAt.
>>>>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>>>>> {
>>>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>>> ?condition WHERE{
>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>> ?oid dprop:price ?pr.
>>>>>>> ?oid dprop:condition ?cond.
>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>> }
>>>>>>> }
>>>>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>>>>> prod:Rl5RVl5Y
>>>>>>> prod:Rl5RVl5U }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>> Everything is working fine. except sub-query calculation error.
>>>>>> result of
>>>>>> total is not correct.
>>>>>>
>>>>>> That maybe because there are 2 different ?pid variables.
>>>>
>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>>> ?condition WHERE{
>>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>>> ?oid dprop:price ?pr.
>>>>>>> ?oid dprop:condition ?cond.
>>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>>> }
>>>>>>>
>>>>>> ?pid is not projected out so it is not joined with the one in the
>>>> VALUEs
>>>> clause. You could GROUP BY ?pid and add it to the SELECT clause. You
>>>> can
>>>> also just have
>>>>
>>>> WHERE {
>>>> SELECT ... { ... }
>>>> GROUP BY ?pid
>>>> }
>>>>
>>>> with everything inside the SELECT's {}
>>>>
>>>> Andy
>>>>
>>>>
>>>> My schema(relation between product and offer ) you can see in first
>>>>
>>>>> message.
>>>>>>
>>>>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>>>
>>>>>>> Hi Here is my question in details. Now i am getting counts and
>>>>>>> other
>>>>>>>
>>>>>>>> info.
>>>>>>>> but i want to define/use this result as data of outer block.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>>>>> same as
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>>>>> Thank you.
>>>>>>>>
>>>>>>>>
>>>>>>>> The query isn't legal SPARQL (parse error - non-group'ed variables
>>>>>>> in
>>>>>>> the
>>>>>>> inner select - even after completing the prefixes). Previously, you
>>>>>>> indicated you were using Virtuoso. Their support lists are on
>>>>>>> SourceForge.
>>>>>>>
>>>>>>> It will help them to have a complete, minimal example.
>>>>>>>
>>>>>>> A small amount of data
>>>>>>> A complete working query
>>>>>>>
>>>>>>> Andy
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>>>>
>>>>>>>> Hi all !
>>>>>>>>>
>>>>>>>>> I have this type of data
>>>>>>>>>>
>>>>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>>>>
>>>>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>>>>
>>>>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>>>>
>>>>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>>>>
>>>>>>>>>> now I want to get all offers of product1, product2.
>>>>>>>>>> second counts of offers.
>>>>>>>>>> Thank you
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> What have you tried?
>>>>>>>>>>
>>>>>>>>>> A complete, minimal example of what you have tried makes it
>>>>>>>>> easier to
>>>>>>>>> answer the question.
>>>>>>>>>
>>>>>>>>> Andy
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Hi Buehmann !
I am using GROUP BY ?pid inside inner-query as well as outer-query
Like
> PREFIX mod:<http://www.example.com/datam/op/>
> PREFIX prod:<http://www.example.com/products/>
> SELECT DISTINCT ?pid (?title )(?count)# (?condition)
> FROM <http://www.example.com/products>
> WHERE {
> ?pid dprop:productTitle ?title.
> ?pid dprop:productDescription ?description.
> {
> SELECT (COUNT(?oid) AS ?count) #(?condition)
FROM <http://www.example.com/offers> WHERE { ?oid oprop:isOfferOf
> ?pid. ?oid dprop:condition ?condition. } GROUP BY ?pid
}
> }
> GROUP BY ?pid
I am still getting duplicate ?pid.
Second problem is I also wanted to get ?condition but if I'll un-comment
?condition then compiler is showing this error
Variable ?condition is used in the result set outside aggregate and not
> mentioned in GROUP BY clause
Can you please help me to correct this query.
Thank you.
On Sun, Jul 26, 2015 at 1:02 PM, buehmann <
buehmann@informatik.uni-leipzig.de> wrote:
> What Andy means is that the pid variable of the subselect is not bound to
> the outer query. Sub-SELECTs are evaluated first, those values have to be
> propagated/projected to the outer query, otherwise you don't get the
> intended values.
> It's so simple add
> GROUP BY ?pid
>
> to the sub-SELECT and also add
>
> SELECT ... ?pid
>
> Lorenz
>
>
> On 26.07.2015 08:36, Nauman Ramzan wrote:
>
>> Dear Andy Good Morning !
>> Can you please explain more. How can I fix this problem ?
>> Because
>> in outer query I am getting ?pid one by one. in sub query instead of
>> taking
>> value from outer query subquery is taking value of ?pid from VALUES.
>>
>> My Problem I want to get Product information and counts of new and used
>>
>>> offers against each product.
>>>
>>
>> Thank you.
>> Regards
>> Nauman
>>
>> On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>> On 25/07/15 12:09, Nauman Ramzan wrote:
>>>
>>> Dear Andy,
>>>>
>>>> I am using Jena ARQ.
>>>>
>>>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>>>> nauman.emallates@gmail.com>
>>>> wrote:
>>>>
>>>> Hi James Anderson !
>>>>
>>>>> Thank you for your help.
>>>>> Now construct this query
>>>>>
>>>>> CONSTRUCT{
>>>>>
>>>>> ?pid dprop:title ?title;
>>>>>> dprop:description ?description;
>>>>>> dprop:brand ?brand;
>>>>>> dprop:isPublic ?isPublic;
>>>>>> dprop:count ?total;
>>>>>> dprop:priceMin ?priceMin;
>>>>>> dprop:condition ?condition;
>>>>>> dprop:createdAt ?createdAt.
>>>>>> }
>>>>>> WHERE {
>>>>>> ?pid dprop:productTitle ?title;
>>>>>> dprop:productDescription ?description;
>>>>>> dprop:productBrand ?brand;
>>>>>> dprop:isPublic ?isPublic;
>>>>>> dprop:createdAt ?createdAt.
>>>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>>>> {
>>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>> ?condition WHERE{
>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>> ?oid dprop:price ?pr.
>>>>>> ?oid dprop:condition ?cond.
>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>> }
>>>>>> }
>>>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>>>> prod:Rl5RVl5Y
>>>>>> prod:Rl5RVl5U }
>>>>>> }
>>>>>>
>>>>>>
>>>>> Everything is working fine. except sub-query calculation error. result
>>>>> of
>>>>> total is not correct.
>>>>>
>>>>> That maybe because there are 2 different ?pid variables.
>>>
>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>>> ?condition WHERE{
>>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>>> ?oid dprop:price ?pr.
>>>>>> ?oid dprop:condition ?cond.
>>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>>> }
>>>>>>
>>>>> ?pid is not projected out so it is not joined with the one in the
>>> VALUEs
>>> clause. You could GROUP BY ?pid and add it to the SELECT clause. You
>>> can
>>> also just have
>>>
>>> WHERE {
>>> SELECT ... { ... }
>>> GROUP BY ?pid
>>> }
>>>
>>> with everything inside the SELECT's {}
>>>
>>> Andy
>>>
>>>
>>> My schema(relation between product and offer ) you can see in first
>>>
>>>> message.
>>>>>
>>>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org>
>>>>> wrote:
>>>>>
>>>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>>
>>>>>> Hi Here is my question in details. Now i am getting counts and other
>>>>>>
>>>>>>> info.
>>>>>>> but i want to define/use this result as data of outer block.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>>>> same as
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>>>> Thank you.
>>>>>>>
>>>>>>>
>>>>>>> The query isn't legal SPARQL (parse error - non-group'ed variables
>>>>>> in
>>>>>> the
>>>>>> inner select - even after completing the prefixes). Previously, you
>>>>>> indicated you were using Virtuoso. Their support lists are on
>>>>>> SourceForge.
>>>>>>
>>>>>> It will help them to have a complete, minimal example.
>>>>>>
>>>>>> A small amount of data
>>>>>> A complete working query
>>>>>>
>>>>>> Andy
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>>>
>>>>>>> Hi all !
>>>>>>>>
>>>>>>>> I have this type of data
>>>>>>>>>
>>>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>>>
>>>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>>>
>>>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>>>
>>>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>>>
>>>>>>>>> now I want to get all offers of product1, product2.
>>>>>>>>> second counts of offers.
>>>>>>>>> Thank you
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> What have you tried?
>>>>>>>>>
>>>>>>>>> A complete, minimal example of what you have tried makes it
>>>>>>>> easier to
>>>>>>>> answer the question.
>>>>>>>>
>>>>>>>> Andy
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>
Re: SPARQL query
Posted by buehmann <bu...@informatik.uni-leipzig.de>.
What Andy means is that the pid variable of the subselect is not bound
to the outer query. Sub-SELECTs are evaluated first, those values have
to be propagated/projected to the outer query, otherwise you don't get
the intended values.
It's so simple add
GROUP BY ?pid
to the sub-SELECT and also add
SELECT ... ?pid
Lorenz
On 26.07.2015 08:36, Nauman Ramzan wrote:
> Dear Andy Good Morning !
> Can you please explain more. How can I fix this problem ?
> Because
> in outer query I am getting ?pid one by one. in sub query instead of taking
> value from outer query subquery is taking value of ?pid from VALUES.
>
> My Problem I want to get Product information and counts of new and used
>> offers against each product.
>
> Thank you.
> Regards
> Nauman
>
> On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 25/07/15 12:09, Nauman Ramzan wrote:
>>
>>> Dear Andy,
>>>
>>> I am using Jena ARQ.
>>>
>>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>>> nauman.emallates@gmail.com>
>>> wrote:
>>>
>>> Hi James Anderson !
>>>> Thank you for your help.
>>>> Now construct this query
>>>>
>>>> CONSTRUCT{
>>>>
>>>>> ?pid dprop:title ?title;
>>>>> dprop:description ?description;
>>>>> dprop:brand ?brand;
>>>>> dprop:isPublic ?isPublic;
>>>>> dprop:count ?total;
>>>>> dprop:priceMin ?priceMin;
>>>>> dprop:condition ?condition;
>>>>> dprop:createdAt ?createdAt.
>>>>> }
>>>>> WHERE {
>>>>> ?pid dprop:productTitle ?title;
>>>>> dprop:productDescription ?description;
>>>>> dprop:productBrand ?brand;
>>>>> dprop:isPublic ?isPublic;
>>>>> dprop:createdAt ?createdAt.
>>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>>> {
>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>> ?condition WHERE{
>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>> ?oid dprop:price ?pr.
>>>>> ?oid dprop:condition ?cond.
>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>> }
>>>>> }
>>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>>> prod:Rl5RVl5Y
>>>>> prod:Rl5RVl5U }
>>>>> }
>>>>>
>>>>
>>>> Everything is working fine. except sub-query calculation error. result of
>>>> total is not correct.
>>>>
>> That maybe because there are 2 different ?pid variables.
>>
>>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>>> ?condition WHERE{
>>>>> ?pid ^mod:isOfferOf ?oid.
>>>>> ?oid dprop:price ?pr.
>>>>> ?oid dprop:condition ?cond.
>>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>>> }
>> ?pid is not projected out so it is not joined with the one in the VALUEs
>> clause. You could GROUP BY ?pid and add it to the SELECT clause. You can
>> also just have
>>
>> WHERE {
>> SELECT ... { ... }
>> GROUP BY ?pid
>> }
>>
>> with everything inside the SELECT's {}
>>
>> Andy
>>
>>
>> My schema(relation between product and offer ) you can see in first
>>>> message.
>>>>
>>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>> Hi Here is my question in details. Now i am getting counts and other
>>>>>> info.
>>>>>> but i want to define/use this result as data of outer block.
>>>>>>
>>>>>>
>>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>>> same as
>>>>>>
>>>>>>
>>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>>> Thank you.
>>>>>>
>>>>>>
>>>>> The query isn't legal SPARQL (parse error - non-group'ed variables in
>>>>> the
>>>>> inner select - even after completing the prefixes). Previously, you
>>>>> indicated you were using Virtuoso. Their support lists are on
>>>>> SourceForge.
>>>>>
>>>>> It will help them to have a complete, minimal example.
>>>>>
>>>>> A small amount of data
>>>>> A complete working query
>>>>>
>>>>> Andy
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>>
>>>>>>> Hi all !
>>>>>>>
>>>>>>>> I have this type of data
>>>>>>>>
>>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>>
>>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>>
>>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>>
>>>>>>>> now I want to get all offers of product1, product2.
>>>>>>>> second counts of offers.
>>>>>>>> Thank you
>>>>>>>>
>>>>>>>>
>>>>>>>> What have you tried?
>>>>>>>>
>>>>>>> A complete, minimal example of what you have tried makes it easier to
>>>>>>> answer the question.
>>>>>>>
>>>>>>> Andy
>>>>>>>
>>>>>>>
>>>>>>>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Dear Andy Good Morning !
Can you please explain more. How can I fix this problem ?
Because
in outer query I am getting ?pid one by one. in sub query instead of taking
value from outer query subquery is taking value of ?pid from VALUES.
My Problem I want to get Product information and counts of new and used
> offers against each product.
Thank you.
Regards
Nauman
On Sat, Jul 25, 2015 at 9:06 PM, Andy Seaborne <an...@apache.org> wrote:
> On 25/07/15 12:09, Nauman Ramzan wrote:
>
>> Dear Andy,
>>
>> I am using Jena ARQ.
>>
>> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <
>> nauman.emallates@gmail.com>
>> wrote:
>>
>> Hi James Anderson !
>>> Thank you for your help.
>>> Now construct this query
>>>
>>> CONSTRUCT{
>>>
>>>> ?pid dprop:title ?title;
>>>> dprop:description ?description;
>>>> dprop:brand ?brand;
>>>> dprop:isPublic ?isPublic;
>>>> dprop:count ?total;
>>>> dprop:priceMin ?priceMin;
>>>> dprop:condition ?condition;
>>>> dprop:createdAt ?createdAt.
>>>> }
>>>> WHERE {
>>>> ?pid dprop:productTitle ?title;
>>>> dprop:productDescription ?description;
>>>> dprop:productBrand ?brand;
>>>> dprop:isPublic ?isPublic;
>>>> dprop:createdAt ?createdAt.
>>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>>> {
>>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>>> ?condition WHERE{
>>>> ?pid ^mod:isOfferOf ?oid.
>>>> ?oid dprop:price ?pr.
>>>> ?oid dprop:condition ?cond.
>>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>>> }
>>>> }
>>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W
>>>> prod:Rl5RVl5Y
>>>> prod:Rl5RVl5U }
>>>> }
>>>>
>>>
>>>
>>> Everything is working fine. except sub-query calculation error. result of
>>> total is not correct.
>>>
>>
> That maybe because there are 2 different ?pid variables.
>
> >>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
> >>> ?condition WHERE{
> >>> ?pid ^mod:isOfferOf ?oid.
> >>> ?oid dprop:price ?pr.
> >>> ?oid dprop:condition ?cond.
> >>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
> >>> }
>
> ?pid is not projected out so it is not joined with the one in the VALUEs
> clause. You could GROUP BY ?pid and add it to the SELECT clause. You can
> also just have
>
> WHERE {
> SELECT ... { ... }
> GROUP BY ?pid
> }
>
> with everything inside the SELECT's {}
>
> Andy
>
>
> My schema(relation between product and offer ) you can see in first
>>> message.
>>>
>>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>>
>>>> Hi Here is my question in details. Now i am getting counts and other
>>>>> info.
>>>>> but i want to define/use this result as data of outer block.
>>>>>
>>>>>
>>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>>> same as
>>>>>
>>>>>
>>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>>> Thank you.
>>>>>
>>>>>
>>>> The query isn't legal SPARQL (parse error - non-group'ed variables in
>>>> the
>>>> inner select - even after completing the prefixes). Previously, you
>>>> indicated you were using Virtuoso. Their support lists are on
>>>> SourceForge.
>>>>
>>>> It will help them to have a complete, minimal example.
>>>>
>>>> A small amount of data
>>>> A complete working query
>>>>
>>>> Andy
>>>>
>>>>
>>>>
>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org>
>>>>> wrote:
>>>>>
>>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>
>>>>>>
>>>>>> Hi all !
>>>>>>
>>>>>>> I have this type of data
>>>>>>>
>>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>>
>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>>
>>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>>
>>>>>>>>
>>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>>
>>>>>>> now I want to get all offers of product1, product2.
>>>>>>> second counts of offers.
>>>>>>> Thank you
>>>>>>>
>>>>>>>
>>>>>>> What have you tried?
>>>>>>>
>>>>>>
>>>>>> A complete, minimal example of what you have tried makes it easier to
>>>>>> answer the question.
>>>>>>
>>>>>> Andy
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
Re: SPARQL query
Posted by Andy Seaborne <an...@apache.org>.
On 25/07/15 12:09, Nauman Ramzan wrote:
> Dear Andy,
>
> I am using Jena ARQ.
>
> On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <na...@gmail.com>
> wrote:
>
>> Hi James Anderson !
>> Thank you for your help.
>> Now construct this query
>>
>> CONSTRUCT{
>>> ?pid dprop:title ?title;
>>> dprop:description ?description;
>>> dprop:brand ?brand;
>>> dprop:isPublic ?isPublic;
>>> dprop:count ?total;
>>> dprop:priceMin ?priceMin;
>>> dprop:condition ?condition;
>>> dprop:createdAt ?createdAt.
>>> }
>>> WHERE {
>>> ?pid dprop:productTitle ?title;
>>> dprop:productDescription ?description;
>>> dprop:productBrand ?brand;
>>> dprop:isPublic ?isPublic;
>>> dprop:createdAt ?createdAt.
>>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>>> {
>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>> ?condition WHERE{
>>> ?pid ^mod:isOfferOf ?oid.
>>> ?oid dprop:price ?pr.
>>> ?oid dprop:condition ?cond.
>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>> }
>>> }
>>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W prod:Rl5RVl5Y
>>> prod:Rl5RVl5U }
>>> }
>>
>>
>> Everything is working fine. except sub-query calculation error. result of
>> total is not correct.
That maybe because there are 2 different ?pid variables.
>>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>>> ?condition WHERE{
>>> ?pid ^mod:isOfferOf ?oid.
>>> ?oid dprop:price ?pr.
>>> ?oid dprop:condition ?cond.
>>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>>> }
?pid is not projected out so it is not joined with the one in the VALUEs
clause. You could GROUP BY ?pid and add it to the SELECT clause. You
can also just have
WHERE {
SELECT ... { ... }
GROUP BY ?pid
}
with everything inside the SELECT's {}
Andy
>> My schema(relation between product and offer ) you can see in first
>> message.
>>
>> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>>
>>>> Hi Here is my question in details. Now i am getting counts and other
>>>> info.
>>>> but i want to define/use this result as data of outer block.
>>>>
>>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>>> same as
>>>>
>>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>>> Thank you.
>>>>
>>>
>>> The query isn't legal SPARQL (parse error - non-group'ed variables in the
>>> inner select - even after completing the prefixes). Previously, you
>>> indicated you were using Virtuoso. Their support lists are on SourceForge.
>>>
>>> It will help them to have a complete, minimal example.
>>>
>>> A small amount of data
>>> A complete working query
>>>
>>> Andy
>>>
>>>
>>>
>>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>>
>>>>> Hi all !
>>>>>> I have this type of data
>>>>>>
>>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>>
>>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>>
>>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>>
>>>>>>
>>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>>
>>>>>> now I want to get all offers of product1, product2.
>>>>>> second counts of offers.
>>>>>> Thank you
>>>>>>
>>>>>>
>>>>>> What have you tried?
>>>>>
>>>>> A complete, minimal example of what you have tried makes it easier to
>>>>> answer the question.
>>>>>
>>>>> Andy
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Dear Andy,
I am using Jena ARQ.
On Sat, Jul 25, 2015 at 3:02 PM, Nauman Ramzan <na...@gmail.com>
wrote:
> Hi James Anderson !
> Thank you for your help.
> Now construct this query
>
> CONSTRUCT{
>> ?pid dprop:title ?title;
>> dprop:description ?description;
>> dprop:brand ?brand;
>> dprop:isPublic ?isPublic;
>> dprop:count ?total;
>> dprop:priceMin ?priceMin;
>> dprop:condition ?condition;
>> dprop:createdAt ?createdAt.
>> }
>> WHERE {
>> ?pid dprop:productTitle ?title;
>> dprop:productDescription ?description;
>> dprop:productBrand ?brand;
>> dprop:isPublic ?isPublic;
>> dprop:createdAt ?createdAt.
>> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
>> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
>> {
>> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin )
>> ?condition WHERE{
>> ?pid ^mod:isOfferOf ?oid.
>> ?oid dprop:price ?pr.
>> ?oid dprop:condition ?cond.
>> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
>> }
>> }
>> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W prod:Rl5RVl5Y
>> prod:Rl5RVl5U }
>> }
>
>
> Everything is working fine. except sub-query calculation error. result of
> total is not correct.
> My schema(relation between product and offer ) you can see in first
> message.
>
> On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 25/07/15 04:54, Nauman Ramzan wrote:
>>
>>> Hi Here is my question in details. Now i am getting counts and other
>>> info.
>>> but i want to define/use this result as data of outer block.
>>>
>>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>>> same as
>>>
>>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>>> Thank you.
>>>
>>
>> The query isn't legal SPARQL (parse error - non-group'ed variables in the
>> inner select - even after completing the prefixes). Previously, you
>> indicated you were using Virtuoso. Their support lists are on SourceForge.
>>
>> It will help them to have a complete, minimal example.
>>
>> A small amount of data
>> A complete working query
>>
>> Andy
>>
>>
>>
>>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>>
>>>> Hi all !
>>>>> I have this type of data
>>>>>
>>>>> <offer1> rdf:isOfferOf <product1>
>>>>>
>>>>>> <offer2> rdf:isOfferOf <product1>
>>>>>> <offer3> rdf:isOfferOf <product2>
>>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>>
>>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>>
>>>>>
>>>>> <offer7> rdf:isOfferOf <product7>
>>>>>
>>>>> now I want to get all offers of product1, product2.
>>>>> second counts of offers.
>>>>> Thank you
>>>>>
>>>>>
>>>>> What have you tried?
>>>>
>>>> A complete, minimal example of what you have tried makes it easier to
>>>> answer the question.
>>>>
>>>> Andy
>>>>
>>>>
>>>
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Hi James Anderson !
Thank you for your help.
Now construct this query
CONSTRUCT{
> ?pid dprop:title ?title;
> dprop:description ?description;
> dprop:brand ?brand;
> dprop:isPublic ?isPublic;
> dprop:count ?total;
> dprop:priceMin ?priceMin;
> dprop:condition ?condition;
> dprop:createdAt ?createdAt.
> }
> WHERE {
> ?pid dprop:productTitle ?title;
> dprop:productDescription ?description;
> dprop:productBrand ?brand;
> dprop:isPublic ?isPublic;
> dprop:createdAt ?createdAt.
> OPTIONAL { ?pid dprop:bulletpoint0 ?bulletpoint0 }
> OPTIONAL { ?pid dprop:bulletpoint1 ?bulletpoint1 }
> {
> SELECT (COUNT(?cond) AS ?total) (MIN(?pr) AS ?priceMin ) ?condition
> WHERE{
> ?pid ^mod:isOfferOf ?oid.
> ?oid dprop:price ?pr.
> ?oid dprop:condition ?cond.
> BIND (if( ?cond = 1, "New", "Used") AS ?condition).
> }
> }
> VALUES ?pid { prod:Rl5RVl5R prod:Rl5RVl5Q prod:Rl5RVl5W prod:Rl5RVl5Y
> prod:Rl5RVl5U }
> }
Everything is working fine. except sub-query calculation error. result of
total is not correct.
My schema(relation between product and offer ) you can see in first
message.
On Sat, Jul 25, 2015 at 1:00 PM, Andy Seaborne <an...@apache.org> wrote:
> On 25/07/15 04:54, Nauman Ramzan wrote:
>
>> Hi Here is my question in details. Now i am getting counts and other info.
>> but i want to define/use this result as data of outer block.
>>
>> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
>> same as
>>
>> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
>> Thank you.
>>
>
> The query isn't legal SPARQL (parse error - non-group'ed variables in the
> inner select - even after completing the prefixes). Previously, you
> indicated you were using Virtuoso. Their support lists are on SourceForge.
>
> It will help them to have a complete, minimal example.
>
> A small amount of data
> A complete working query
>
> Andy
>
>
>
>> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>>
>>> Hi all !
>>>> I have this type of data
>>>>
>>>> <offer1> rdf:isOfferOf <product1>
>>>>
>>>>> <offer2> rdf:isOfferOf <product1>
>>>>> <offer3> rdf:isOfferOf <product2>
>>>>> <offer4> rdf:isOfferOf <product2>
>>>>>
>>>>> <offer5> rdf:isOfferOf <product2>
>>>>>
>>>>
>>>> <offer7> rdf:isOfferOf <product7>
>>>>
>>>> now I want to get all offers of product1, product2.
>>>> second counts of offers.
>>>> Thank you
>>>>
>>>>
>>>> What have you tried?
>>>
>>> A complete, minimal example of what you have tried makes it easier to
>>> answer the question.
>>>
>>> Andy
>>>
>>>
>>
>
Re: SPARQL query
Posted by Andy Seaborne <an...@apache.org>.
On 25/07/15 04:54, Nauman Ramzan wrote:
> Hi Here is my question in details. Now i am getting counts and other info.
> but i want to define/use this result as data of outer block.
> http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
> same as
> http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
> Thank you.
The query isn't legal SPARQL (parse error - non-group'ed variables in
the inner select - even after completing the prefixes). Previously, you
indicated you were using Virtuoso. Their support lists are on SourceForge.
It will help them to have a complete, minimal example.
A small amount of data
A complete working query
Andy
>
> On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 21/07/15 11:35, Nauman Ramzan wrote:
>>
>>> Hi all !
>>> I have this type of data
>>>
>>> <offer1> rdf:isOfferOf <product1>
>>>> <offer2> rdf:isOfferOf <product1>
>>>> <offer3> rdf:isOfferOf <product2>
>>>> <offer4> rdf:isOfferOf <product2>
>>>>
>>>> <offer5> rdf:isOfferOf <product2>
>>>
>>> <offer7> rdf:isOfferOf <product7>
>>>
>>> now I want to get all offers of product1, product2.
>>> second counts of offers.
>>> Thank you
>>>
>>>
>> What have you tried?
>>
>> A complete, minimal example of what you have tried makes it easier to
>> answer the question.
>>
>> Andy
>>
>
Re: SPARQL query
Posted by Nauman Ramzan <na...@gmail.com>.
Hi Here is my question in details. Now i am getting counts and other info.
but i want to define/use this result as data of outer block.
http://answers.semanticweb.com/questions/32850/sparql-use-subquery-as-resultvariable-for-outer-query
same as
http://stackoverflow.com/questions/31586989/sparql-use-subquery-as-result-variable-for-outer-query
Thank you.
On Tue, Jul 21, 2015 at 5:04 PM, Andy Seaborne <an...@apache.org> wrote:
> On 21/07/15 11:35, Nauman Ramzan wrote:
>
>> Hi all !
>> I have this type of data
>>
>> <offer1> rdf:isOfferOf <product1>
>>> <offer2> rdf:isOfferOf <product1>
>>> <offer3> rdf:isOfferOf <product2>
>>> <offer4> rdf:isOfferOf <product2>
>>>
>>> <offer5> rdf:isOfferOf <product2>
>>
>> <offer7> rdf:isOfferOf <product7>
>>
>> now I want to get all offers of product1, product2.
>> second counts of offers.
>> Thank you
>>
>>
> What have you tried?
>
> A complete, minimal example of what you have tried makes it easier to
> answer the question.
>
> Andy
>
Re: SPARQL query
Posted by Andy Seaborne <an...@apache.org>.
On 21/07/15 11:35, Nauman Ramzan wrote:
> Hi all !
> I have this type of data
>
>> <offer1> rdf:isOfferOf <product1>
>> <offer2> rdf:isOfferOf <product1>
>> <offer3> rdf:isOfferOf <product2>
>> <offer4> rdf:isOfferOf <product2>
>>
> <offer5> rdf:isOfferOf <product2>
>
> <offer7> rdf:isOfferOf <product7>
>
> now I want to get all offers of product1, product2.
> second counts of offers.
> Thank you
>
What have you tried?
A complete, minimal example of what you have tried makes it easier to
answer the question.
Andy