Re: [TEST] simple SPARQL condition and SNAF condition

SPARQL is made by W3C "RDF Data Access Working Group"
-- http://www.w3.org/2001/sw/DataAccess/

SPARQL is a query language for getting information
from RDF graphs. It provides facilities to:

o extract information in the form of URIs, blank nodes,
  plain and typed literals.
o extract RDF subgraphs.
o construct new RDF graphs based on information in the
  queried graphs.

... Writing a Simple Query

The example below shows a SPARQL query to find the title
of a book from the information in the given RDF graph.
The query consists of two parts, the SELECT clause and
the WHERE clause. The SELECT clause identifies the
variables to appear in the query results, and the WHERE
clause has one triple pattern.

Data:

<http://example.org/book/book1>
  <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" .

Query:

SELECT ?title  ### first item in the e:findall object
WHERE          ### second item in the e:findall object
{
  <http://example.org/book/book1>
    <http://purl.org/dc/elements/1.1/title> ?title .
}

Query Result:  ### third item in the e:findall object
title
-----------------
"SPARQL Tutorial"


My point is that such simple query builtin can be used
as RIF condition; forcing the unification of the third
item in the e:findall object with the empty list is an
easy way to have scoped negation as failure and I only
wanted to TEST this idea in a tangible way:

GIVEN http://www.agfa.com/w3c/euler/medic.n3
TEST http://www.agfa.com/w3c/euler/medicF.n3
WHY http://eulersharp.sourceforge.net/2006/02swap/medicE.n3

Does that work for you? 
-Jos

> Since I suspect many of us don't know sparql, Jos, can you
> explain what this means and why you posted it to RIF?
>
> -Chris
>
> jos.deroo@agfa.com wrote:
>> In writing Prolog I make a lot of use of findall
>> and in N3 I found it useful as
>>
>> e:findall
>>   rdfs:comment
>> """?SCOPE e:findall (?SELECT ?WHERE ?ANSWER).
>> unifies ?ANSWER with a list that contains all the
>> instantiations of ?SELECT satisfying the ?WHERE
>> clause in the ?SCOPE of all asserted n3 formulae
>> and their log:conclusion""";
>>   a rdf:Property;
>>   rdfs:domain log:Formula;
>>   rdfs:range rdf:List.
>>
>> I mean useful for 2 reasons
>> 1/ it is a way to have a simple SPARQL condition
>> 2/ it is a way to have a SNAF condition when used as
>>    ?SCOPE e:findall (?SELECT ?WHERE rdf:nil).
>>
>> There is a test case result at
>> http://eulersharp.sourceforge.net/2006/02swap/medicE.n3

-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/

Received on Sunday, 17 September 2006 14:35:06 UTC