- From: Leonard Jacuzzo <jacuzzo@gmail.com>
- Date: Thu, 15 Sep 2011 08:25:49 -0400
- To: Farhana Sarker <joyamamun@gmail.com>
- Cc: public-sparql-dev@w3.org
- Message-ID: <CAPxg9HjtgPrSuu77_NquOmzkT3TtZxqck_QofKtV-uQ-C+BjMQ@mail.gmail.com>
Farhana, I think that you need to use the OPTIONAL key word. This will allow you to get a return if one of the OPTIONAL parts is matched. However, this would return true when only one OPTIONAL part matches. I am not sure how you would get it to return only when three of the OPTIONAL parts match, as opposed to just one. Maybe if you used OPTIONAL with &&, several times with the various desired combinations? I am fairly new to this too. Best wishes, Leonard On Tue, Sep 13, 2011 at 11:24 AM, Farhana Sarker <joyamamun@gmail.com>wrote: > Hi, > > I am a new SPARQL user. > I need to write a query using SPARQL which can be set conditions and will > be able to return the value if AT LEAST 3 condition is TRUE. > > For example: > > I want to return all the id and other information from my datasets where 6 > conditions are given (as shown below) and want to retrieve information for > whom at least ANY 3 conditions are TRUE. Could you please help me to write > the query correctly as the below query returns for which all the conditions > are TRUE.But I need to retrieve information for whom at least ANY 3 > conditions are TRUE. > > select ?id ?a ?b ?c ?d ?e ?f ?g > > where { > > ?id myns:a ?a. > > filter (regex(?a, "professional")). > > ?id myns:b ?b. > > filter (?b = "P") > > ?id myns:c ?c. > > filter (?c != "UH") > > ?id myns:d ?d. > > filter (?d<2.7) > > ?id myns:e ?e. > > filter (?e<2.7) > > ?id myns:f ?f. > > filter (?f = “M”) > > ?id myns:g ?g. > > filter (?g != “S”) > > } > > > > Thank you > > Farhana >
Received on Thursday, 15 September 2011 16:06:53 UTC