W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2004

Another alternative to OR

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Tue, 5 Oct 2004 14:21:10 +0100
To: DAWG public list <public-rdf-dawg@w3.org>
Message-ID: <20041005132110.GK14231@login.ecs.soton.ac.uk>

Another systatic alternative to the inline disjunctive exressions I
dislike so much :) is UNION queries, which have been discussed a little,
as "multiple queries per request", "multiple WHEREs" or something similar.


	SELECT ?name
	WHERE { (?x foo:name ?name) }
	      OR { (?x bar:hasName ?name) } 

could be writen as:

	SELECT ?name
	WHERE (?x foo:name ?name)
	WHERE (?x bar:hasName ?name)

or some other equivalent (you wany want to repeat the SELECT).

This has the advantage over OR that it doesnt explode the query
complexity, and doesnt have such complicated interactions with OPTIONAL,
as every allowed combination of disjunctive expressions has to be spellt
out. The query evaluator can simply execute each match in turn, or it may
optimise it if it wishes to get more performance.

The downside is that it will make the queries more verbose if you have a
complicated disjunctive expression.

- Steve
Received on Tuesday, 5 October 2004 13:21:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:00:45 UTC