RE: Query, rules and RDF datatyping

> -----Original Message-----
> From: www-rdf-rules-request@w3.org
[mailto:www-rdf-rules-request@w3.org]
> On Behalf Of Graham Klyne
> Sent: Wednesday, October 08, 2003 10:10 AM
> To: www-rdf-rules@w3.org
> Subject: Query, rules and RDF datatyping
> 
> 
[...]

> 
> I'll build this up by example, using bits of (approximate) RDQL.
Consider
> the query:
> 
> SELECT ?x, ?y
> WHERE
>    :vehicle :standingCapacity ?x .
>    :vehicle :seatedCapacity ?y .
> 
> This is pretty boring, and doesn't come close to what I want to
> achieve.  But RDQL offers <SUCHTHAT> clauses, which I think are
introduced
> by "AND" (the grammar in citation [1] doesn't actually say):
> 
> SELECT ?x, ?y
> WHERE
>    :vehicle :standingCapacity ?x .
>    :vehicle :seatedCapacity ?y .
> AND
>    ?x + ?y = 60 .
> 
> This allows me to build conditions based on arithmetic operations, but
> doesn't give access to the results.  But if I say:
> 
> SELECT ?z
> WHERE
>    :vehicle :standingCapacity ?x .
>    :vehicle :seatedCapacity ?y .
> AND
>    ?x + ?y = ?z .

So do I understand correctly that it's not currently possible to return
bindings from constraints in a RDQL query? And that's what you need to
support your datatyping rules? I'd always wondered why the two pieces
were separate - triple bindings and additional constraints - i.e. why
isn't it just:

 WHERE
    :vehicle :standingCapacity ?x .
    :vehicle :seatedCapacity ?y .
    ?x + ?y = ?z .

We treat them that way in RDFQL - e.g.

WHERE {[standingCapacity] [vehicle] ?x} 
	AND  {[seatedCapacity] [vehicle] ?y}
	AND ?z=add(?x, ?y)


> Here, the constraint clause is treated not simply as returning a
> true/false
> result, but is extended so that (like a clause in Prolog) any variable
> bindings that may added to make the clause true are also returned.
The
> simple constraint case simply returns the existing variable binding or
> none
> at all.  If there is more than one possible binding for ?z, then
> additional
> query results may be generated.
> 
> So consider the query:
> 
> SELECT ?x, ?y, ?z
> WHERE
>    :vehicle :standingCapacity ?x .
>    :vehicle :seatedCapacity ?y .
> AND
>    ?x + ?y <= ?z . && ( ?z = 30 . || ?z = 60 . )
> 
> applied to the following target graphs:
> 
> (1)  :vehicle :standingCapacity 20 .     -->   [(?x=20,?y=30,?z=60)]
>       :vehicle :seatedCapacity 30 .
> (just one result)
> 
> (2)  :vehicle :standingCapacity 30 .     -->   []
>       :vehicle :seatedCapacity 40 .
> (no result)
> 
> (2)  :vehicle :standingCapacity 10 .     -->   [(?x=10,?y=20,?z=30),
>       :vehicle :seatedCapacity 20 .              (?x=10,?y=20,?z=60)]
> (two results)
> 
> This begs questions about how new variable bindings may be generated,
> particularly since I want to be able to use this with both forward and
> backward rule chaining, but I have some ideas that I think I can see
how
> to
> prototype.

This gets you into the finite domain constraint world, doesn't it - i.e.
you need some way of enumerating the possible (finite) values for a
particular variable (and hopefully some means of propagating constraints
to avoid combinatorial hell and make it practical with non-toy domains.)

 
> #g
> --


Geoff Chappell

Received on Wednesday, 8 October 2003 11:01:03 UTC