You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Ondrej Zamazal <on...@vse.cz> on 2011/12/01 16:46:17 UTC

SPARQL query with negation using ARQ in Jena

Hi,
I am using ARQ in Jena and I am trying to figure out how I could query 
that a certain triple does not exist in the graph (negation as failure).

I found the document [1] where UNSAID operator is mentioned but it seems 
that this is not supported by ARQ. Right? There is also mentioned that 
combination of OPTIONAL and FILTER could work for some cases.  But I 
think that this is not sufficient for my case because there are not 
unbounded variables in my query, please see below.

In the query I would need to ask whether the specific triple is missing 
in a graph, e.g.

SELECT *
WHERE {
UNSAID { <http://ontology1#Concept1> rdfs:subClassOf 
<http://ontology1#Concept2> }.
}

I think UNSAID should be good for this case or maybe something like 'not 
ASK'. I would just need yes/no answer from query engine.

Would this be somehow possible?

Thank you for your reply in advance
Regards,
Ondrej

Re: SPARQL query with negation using ARQ in Jena

Posted by Andy Seaborne <an...@apache.org>.
See http://www.w3.org/TR/sparql11-query/#negation

UNSAID is an old ARQ extension.

FILTER NOT EXISTS
or
MINUS is better

	Andy


On 01/12/11 15:47, Ondrej Zamazal wrote:
> Sorry I forgot to add reference. Here it is:
>
> [1] http://www.w3.org/2009/sparql/wiki/Feature:Negation
>
> Regards,
> Ondrej
>
> On 12/01/2011 04:46 PM, Ondrej Zamazal wrote:
>> Hi,
>> I am using ARQ in Jena and I am trying to figure out how I could query
>> that a certain triple does not exist in the graph (negation as failure).
>>
>> I found the document [1] where UNSAID operator is mentioned but it
>> seems that this is not supported by ARQ. Right? There is also
>> mentioned that combination of OPTIONAL and FILTER could work for some
>> cases. But I think that this is not sufficient for my case because
>> there are not unbounded variables in my query, please see below.
>>
>> In the query I would need to ask whether the specific triple is
>> missing in a graph, e.g.
>>
>> SELECT *
>> WHERE {
>> UNSAID { <http://ontology1#Concept1> rdfs:subClassOf
>> <http://ontology1#Concept2> }.
>> }
>>
>> I think UNSAID should be good for this case or maybe something like
>> 'not ASK'. I would just need yes/no answer from query engine.
>>
>> Would this be somehow possible?
>>
>> Thank you for your reply in advance
>> Regards,
>> Ondrej
>


Re: SPARQL query with negation using ARQ in Jena

Posted by Ondrej Zamazal <on...@vse.cz>.
Sorry I forgot to add reference. Here it is:

[1] http://www.w3.org/2009/sparql/wiki/Feature:Negation

Regards,
Ondrej

On 12/01/2011 04:46 PM, Ondrej Zamazal wrote:
> Hi,
> I am using ARQ in Jena and I am trying to figure out how I could query 
> that a certain triple does not exist in the graph (negation as failure).
>
> I found the document [1] where UNSAID operator is mentioned but it 
> seems that this is not supported by ARQ. Right? There is also 
> mentioned that combination of OPTIONAL and FILTER could work for some 
> cases.  But I think that this is not sufficient for my case because 
> there are not unbounded variables in my query, please see below.
>
> In the query I would need to ask whether the specific triple is 
> missing in a graph, e.g.
>
> SELECT *
> WHERE {
> UNSAID { <http://ontology1#Concept1> rdfs:subClassOf 
> <http://ontology1#Concept2> }.
> }
>
> I think UNSAID should be good for this case or maybe something like 
> 'not ASK'. I would just need yes/no answer from query engine.
>
> Would this be somehow possible?
>
> Thank you for your reply in advance
> Regards,
> Ondrej