Re: Using SELECT instead ASK

Samur,

On 24 Jul 2008, at 16:21, saraujo@inf.puc-rio.br wrote:

> Thank you Richard. But imagine that I have a query like that:
>
> select ?????? where {
> <http://www.semanticnavigation.org/2008/faceto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/faceto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> <http://www.semanticnavigation.org/2008/zeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/zeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> <http://www.semanticnavigation.org/2008/nozeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/nozeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> }

Not entirely sure what you are trying to achieve. If you write it like  
this, then every occurrence of ?p has to be bound to the *same* value  
or the query won't match at all.

I don't understand what the query is supposed to achieve, so I can't  
answer your question.

> Suppose that, in this query, I want to verify which  
> resource(subject) has
> some the values <http://www.semanticnavigation.org/2008/faceto#x> and
> <http://www.semanticnavigation.org/2008/faceto#y>  in the object. Note
> that my focus is in the SUBJECT not in the PROPERTY(?p), that is the
> variable in the query.
> Using your strategy (FILTER), this will became a very huge query for
> several different subjects.

If you want to do funky things, then you sometimes need a huge query.  
Also, using FILTERs the query doesn't become much bigger than it  
already is.

Note that you can use boolean predicates in FILTERs:

   FILTER (?s == <...faceto> || ?s == <...zeto> || ?s == <...nozeto>) .

This can reduce the query size a *lot*.

> Thinking in this scenario, It would be easier whether were possible  
> to do
> something like that:
>
> select ?S where {
> <http://www.semanticnavigation.org/2008/faceto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/faceto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> <http://www.semanticnavigation.org/2008/zeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/zeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> <http://www.semanticnavigation.org/2008/nozeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#x> .
> <http://www.semanticnavigation.org/2008/nozeto> ?p
> <http://www.semanticnavigation.org/2008/faceto#y> .
>
> }
>
>
> Where, ?S represents all the subjects that were matched.
>
> Do you know whether It is possible to something like that with SPARQL?

It's not possible. If you want to return something in the SELECT  
clause, then you need to write it as a variable in the query.

Richard



>
>
> Cheers,
> Samur
>>
>>
>> On 23 Jul 2008, at 19:09, saraujo@inf.puc-rio.br wrote:
>>> Hi people, I would like to get the SUBJECT of the following query:
>>>
>>> select ?o where {<http://www.semanticnavigation.org/2008/faceto> ? 
>>> p ?
>>> o}
>>
>> I'm sure I don't have to mention that this is a rather pointless
>> query ;-)
>>
>> But I'm sure you have your (weird) reason.
>>
>> I guess you are looking for something like this:
>>
>> SELECT ?s
>> WHERE {
>>    ?s ?p ?o .
>>    FILTER (?s == <http://www.semanticnavigation.org/2008/faceto>)
>> }
>>
>> Hope that helps,
>> Richard
>>
>>
>>
>>>
>>>
>>> How could I do it with sparql SELECT?  Instead I get the object ?o I
>>> would
>>> like to get the SUBJECT, is it possible using only SELECT?
>>>
>>> Regards
>>> Samur
>>>
>>>
>>
>>
>

Received on Thursday, 24 July 2008 16:57:34 UTC