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 <[email protected]>
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 <[email protected]> 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 <[email protected]> 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







Reply via email to