Lucas, Mark; I believe Mark has the right idea, but the sub-select isn't necessary:

SELECT ?subject (count(?child) AS ?nchild)
WHERE {
    ?subject kennedys:child ?child .
 
} GROUP BY ?subject
 HAVING(?nchild <7 && 3 <?nchild )

HAVING is executed after the projection in the SELECT statement.

-- Scott

On 9/25/2014, 3:44 PM, Mark Graham wrote:
Hi Lucas,

Can you try this against the Kenedys.ttl in the examples folder. This may help inform what you want to accomplish with this query.

SELECT *
{{
SELECT ?subject (count(?child) AS ?nchild) WHERE {
    ?subject kennedys:child ?child .
 
}GROUP BY ?subject}FILTER (?nchild <7). FILTER (2 <?nchild)
}




Thanks,
Mark


Mark Graham
TopQuadrant Support



On Thu, Sep 25, 2014 at 1:58 PM, Lucas de Oliveira Teixeira <[email protected]> wrote:
Hi guys,

Suppose that we have the following triples:


:Influenza :hasSymptom :Fever
:Influenza :hasSymptom :Headache
:Influenza :hasSymptom :SoreThroat
:Influenza :minQuantityOfSymptoms 1
:Influenza :maxQuantityOfSymptoms 3


I want to develop a SPARQL query that returns a number of solutions within the **minQuantityOfSymptoms** and **maxQuantityOfSymptoms**.

I achieved a similar result by using the LIMIT modifier, however I have to explicity declare the upper bound, so that way there is no randomness. The following query uses the LIMIT modifier and return always two symptoms:


SELECT ?symptom WHERE {
    :Influenza :hasSymptom ?symptom .
} LIMIT 2


I appreciate the help.
Thanks!
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to