Fixed in SVN.

        Andy

On 28/06/11 18:18, Andy Seaborne wrote:
It's a bug, I'm afraid.

A workaround is to use a different variable in each UNION branch and
combine them in the overall SELECT:



PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT
?stw ?stw_pref (COALESCE(?rel1, ?rel2) AS ?rel) ?thesoz_pref ?thesoz
WHERE {
{
SELECT DISTINCT ?stw ('=' as ?rel2) ?thesoz
WHERE {
?stw skos:exactMatch ?thesoz .
?stw skos:inScheme <http://zbw.eu/stw> .
?thesoz skos:inScheme <http://lod.gesis.org/thesoz/> .
}
} UNION {
SELECT DISTINCT ?stw ('<' as ?rel1) ?thesoz
WHERE {
?stw skos:broadMatch ?thesoz .
?stw skos:inScheme <http://zbw.eu/stw> .
?thesoz skos:inScheme <http://lod.gesis.org/thesoz/> .
}
} .
?stw skos:prefLabel ?stw_pref .
?thesoz skos:prefLabel ?thesoz_pref
}


Andy

On 28/06/11 16:09, Neubert Joachim wrote:
Out of two SKOS thesauri, I want to get an overview list of all mappings
(with different relations, like skos:exactMatch, skos:broadMatch, etc.)

I tried:

PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?stw ?stw_pref ?rel ?thesoz_pref ?thesoz
WHERE {
{
SELECT DISTINCT ?stw ('=' as ?rel) ?thesoz
WHERE {
?stw skos:exactMatch ?thesoz .
?stw skos:inScheme<http://zbw.eu/stw> .
?thesoz skos:inScheme<http://lod.gesis.org/thesoz/> .
}
} UNION {
SELECT DISTINCT ?stw ('<' as ?rel) ?thesoz
WHERE {
?stw skos:broadMatch ?thesoz .
?stw skos:inScheme<http://zbw.eu/stw> .
?thesoz skos:inScheme<http://lod.gesis.org/thesoz/> .
}
} .
?stw skos:prefLabel ?stw_pref .
?thesoz skos:prefLabel ?thesoz_pref
}

and got the error:

Variable used when already in-scope: ?rel in ("<" AS ?rel)

How could I work arround this? I suspect many of you had come across a
similar problems, and hopefully solved them somehow ...

Cheers, Joachim




Reply via email to