Subject Re: [firebird-support] Subselect doesn't work
Author Helen Borrie
At 12:41 PM 25/11/2004 +0100, you wrote:


>Hi there!
>Given the following table
>
>CREATE TABLE ELENA_TRIPLES (
> SUBJECT VARCHAR(75),
> PREDICATE VARCHAR(300),
> OBJECT VARCHAR(5000)
>);
>
>Has somebody an idea why the current statement wouldn't work with firebird.

Yes. Firebird doesn't support derived tables (yet..)


>SELECT triples.PREDICATE, triples.ARG0, triples.ARG1
> FROM (SELECT 'http://test#goodTitle' AS PREDICATE, triples.SUBJECT AS
>ARG0, triples.OBJECT AS ARG1
> FROM ELENA_TRIPLES triples WHERE triples.PREDICATE
>='http://purl.org/dc/elements/1.1/title'
> AND triples.OBJECT = 'Artificial Intelligence'
> UNION SELECT 'http://test#goodTitle' AS PREDICATE, triples.SUBJECT AS
>ARG0, triples.OBJECT AS ARG1
> FROM ELENA_TRIPLES triples WHERE triples.PREDICATE =
>'http://purl.org/dc/elements/1.1/title'
> AND triples.OBJECT = 'Just Java' ) triples
> WHERE triples.PREDICATE = 'http://test#goodTitle'
><http://test#goodTitle%27>
>
>This query



>is acutally automatically generated by another component
>(edutella provider for triple tables), but firebird doesn't seem to be
>very happy with that.
>
>I put this query also in IBExpert, using fbclient.dll and it complaind
>with the SELECT statement in row. May there be a way to just rewirte
>this query in another way?

Except for the strange bracketed URL at the end (what is this?) this query
is meant to pick up a subset with a certain URL and return a substitute
URL. Thus, it appears to resolve to something much simpler:

SELECT
'http://test#goodTitle' AS PREDICATE,
triples.SUBJECT AS ARG0,
triples.OBJECT AS ARG1
FROM ELENA_TRIPLES triples
WHERE
triples.PREDICATE ='http://purl.org/dc/elements/1.1/title'
AND
(triples.OBJECT = 'Artificial Intelligence'
OR triples.OBJECT = 'Just Java')

What is this element meant for?
<http://test#goodTitle%27>

./heLen