Do you have to use FROM in the second query?
On 03/05/2023 17:58, jaa...@kolumbus.fi wrote:
Hello,
I have the two queries below which I run from my code so that the 1st
query returns about 3000 ?ng and ?t_id pairs which will then be used in
the second query in the place of $STAT and $RDF_ID. So I'm calling the
second query in a loop about 3000 times.
I've noticed that it is time consuming; it takes about 4-5 minutes. How
could I combine the queries so that I could get all the information by
just one call ?
$PREFIXS
SELECT *
WHERE
{
{
GRAPH stat:outputchannel
{
?subject outchl:refersToTable ?t_id .
?subject outchl:refersToNamedGraph ?ng .
?subject outchl:hasOutputFileId ?o_id.
filter (regex(?o_id,"of_001"))
}
}
}
and
$PREFIXS
SELECT *
FROM stat:outputchannel
FROM stat:tabAdmin
FROM tilasto:$STAT
WHERE {
?pxfile pxt:tableId "$RDF_ID".
?pxfile pxt:hasStatus ?status.
?pxfile pxt:hasFrequency ?frequency.
?pxfile pxt:isPresentationOf ?cube.
?cube dc:description ?title_fi.
?cube dc:language ?language.
?cube cubemeta:hasStatisticalProgramme ?statisticalProgram.
?cube cubemeta:lastUpdated ?lastUpdated.
?cube cubemeta:refersToOutputFile ?of.
?subject outchl:hasOutputFileId ?of.
?subject outchl:refersToOutputChannel ?channel_prefix .
?kanta outchl:hasOutputChannelId ?channel_prefix .
?kanta outchl:directoryPathRoot ?directoryPathRoot .
?kanta a outchl_ont:OutputChannel .
filter(?language ="fi"^^xsd:language)
filter (lang(?title_fi) = "fi")
filter ( langMatches(lang(?directoryPathRoot),"fi") )
}
Br jaana M