S3DB

Recent site activity

  • S3QLSyntax
    attachment from Lena Deus
    attachment removed by Lena Deus
  • lixo
    edited by Jonas Almeida
  • Core
    attachment from Jonas Almeida
    edited by Jonas Almeida
  • core
    created by Jonas Almeida
  • SPARQL
    edited by Lena Deus
  • View All

Parallel Queries in S3QL

S3QL is a lower level query language than relational SQL. For that reason, it takes more queries to retrieve all statement associated with a certain number of Items. To avoid the wait time usually associated with waiting for one query to finish before starting the next, there are several options in PHP and other languages to run the queries in parallel. 
For example, if using PHP you can use this small function to achieve that goal. Once the function 'goparallel' is included in your script, use the following syntax to perform your queries in parallel and save the result in a single "results" array:

goparallel

<?php
include_once('goparallel.php');

$S3QL = array(
'http://ibl.mdanderson.org/edu/S3QL.php?key=xxxxx&query=<S3QL><from>items</from><where><collection_id>26969</collection_id></where></S3QL>',
'http://ibl.mdanderson.org/edu/S3QL.php?key=xxxxx&query=<S3QL><from>items</from><where><collection_id>26971</collection_id></where></S3QL>',
'http://ibl.mdanderson.org/edu/S3QL.php?key=xxxxx&query=<S3QL><from>items</from><where><collection_id>26973</collection_id></where></S3QL>',
'http://ibl.mdanderson.org/edu/S3QL.php?key=xxxxx&query=<S3QL><from>items</from><where><collection_id>26975</collection_id></where></S3QL>',
);

$results = goparallel($S3QL,1);#Replace the 1 with a 0 here to compare see your results without the parallelization

echo "Your queries results:<BR>";
echo '<pre>';print_r($results);
?>

Attachments (1)

  • goparallel.php - on Aug 10, 2009 12:03 PM by Lena Deus (version 1)
    3k Download