Thanks, Andy.
I think I will have to implement my parallel op.
Here is the query:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dailymed: <
http://www4.wiwiss.fu-berlin.de/dailymed/resource/dailymed/>
PREFIX drugbank: <
http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/>
PREFIX sider: <http://www4.wiwiss.fu-berlin.de/sider/resource/sider/>
PREFIX dbpprop: <http://dbpedia.org/property/>

SELECT ?dgai ?sen ?dgin ?dgls WHERE {
*SERVICE <http://www4.wiwiss.fu-berlin.de/dailymed/sparql> {
* <http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056>
dailymed:activeIngredient ?dgai .
 ?dgai rdfs:label ?dgain .
 <http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056>
dailymed:genericDrug ?gdg .
 <http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056> owl:sameAs
?sa .
}
*SERVICE <http://www4.wiwiss.fu-berlin.de/drugbank/sparql> {
*  ?gdg drugbank:pharmacology  ?dgin ;
}
OPTIONAL {
*  SERVICE <http://www4.wiwiss.fu-berlin.de/sider/sparql> {
*    ?sa sider:sideEffect ?se .
    ?se sider:sideEffectName ?sen .
  }
}
OPTIONAL {
*  SERVICE <http://dbpedia.org/sparql> {
*    ?sa dbpprop:legalStatus ?dgls .
  }
}

}

Dailymed must be queried at first, but drugbank, sider and dbpedia could be
queried simultaneously as they do not depend on each other.

Regards,
Regis.


2011/6/13 Andy Seaborne <[email protected]>

>  How can I allow parallel query execution in one SPARQL Algebra
>>>
>> Expression?
>
>> Is there some SPARQL algebra operation implemented in ARQ to do
>>> that? I want to manually optimize one SPARQL algebra expression
>>> executing some SERVICE operations in parallel.
>>>
>>
> There's no built-in way at the moment but nothing stops it being done.
>
> The optimizer tries to linearize execution with "sequence", which most of
> the time is a better choice.  Multiple threads on a machine can be used for
> multiple parallel requests (e.g. Fuseki).
>
> With service the right choice is hard to make - if one SERVICE is very
> small, it's better to do it, and ask the other SERVICE(s) more grounded
> patterns.
>
> You may need to write your own ops - the first pattern looks quite grounded
> though.
>
>        Andy
>
> (What's the query?  Unprefixed algebra is a bit difficult to read :-)
>
>
> On 13/06/11 19:04, Regis Pires Magalhăes wrote:
>
>> In the following example *drugbank*, *sider* and *dbpedia* service
>> operations could be executed in parallel after *dailymed* service
>> execution. How could I define such parallelism in an SPARQL Algebra
>> expression?
>>
>>   (project (?dgai ?sen ?dgin ?dgls)
>>     (conditional
>>       (conditional
>>         (sequence
>> *          (service<http://www4.wiwiss.fu-berlin.de/dailymed/sparql>*
>>             (bgp
>>               (triple<
>> http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056>  <
>>
>> http://www4.wiwiss.fu-berlin.de/dailymed/resource/dailymed/activeIngredient
>> >
>> ?dgai)
>>               (triple ?dgai<http://www.w3.org/2000/01/rdf-schema#label>
>> ?dgain)
>>               (triple<
>> http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056>  <
>> http://www4.wiwiss.fu-berlin.de/dailymed/resource/dailymed/genericDrug>
>> ?gdg)
>>               (triple<
>> http://www4.wiwiss.fu-berlin.de/dailymed/resource/drugs/3056>  <
>> http://www.w3.org/2002/07/owl#sameAs>  ?sa)
>>             ))
>> *          (service<http://www4.wiwiss.fu-berlin.de/drugbank/sparql>
>> *            (bgp (triple ?gdg<
>> http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/pharmacology>
>> ?dgin))))
>> *        (service<http://www4.wiwiss.fu-berlin.de/sider/sparql>
>> *          (bgp
>>             (triple ?sa<
>> http://www4.wiwiss.fu-berlin.de/sider/resource/sider/sideEffect>  ?se)
>>             (triple ?se<
>> http://www4.wiwiss.fu-berlin.de/sider/resource/sider/sideEffectName>
>>  ?sen)
>>           )))
>> *      (service<http://dbpedia.org/sparql>
>> *        (bgp (triple ?sa<http://dbpedia.org/property/legalStatus>
>> ?dgls)))))
>>
>>
>> Regards,
>> Regis.
>>
>>
>>
>> Em 13 de junho de 2011 13:40, Regis Pires Magalhăes<
>> [email protected]
>>
>>  escreveu:
>>>
>>
>>  How can I allow parallel query execution in one SPARQL Algebra
>>> Expression?
>>> Is there some SPARQL algebra operation implemented in ARQ to do that?
>>> I want to manually optimize one SPARQL algebra expression executing some
>>> SERVICE operations in parallel.
>>>
>>> Regards,
>>> Regis.
>>>
>>>
>>>
>>

Reply via email to