Serena,
this is better than nothing, but I still need more info (at least an input document that allows me to run your query out of the box) to get a clue what might go on.
Christian ___________________________
2011/7/20 Lusha Wang lwang40@syr.edu:
hI Christian I feel like this is not about my code. Because most of the time I can get results correctly. But I still pasted my code in the following:
<html> <body> <?php
include("BaseXClient.php"); $start=$_GET['start']; $end = $_GET['end']; //$type=$_GET['type'];
if($start!=null && $end!=null) { echo "all entites that are within this time period:".$start."--".$end."<br>";
$cmd='for $Document in doc("newdf")//Document[xs:date(./Date/text()) <=xs:date("'.$end.'") and xs:date(./Date/text()) >=xs:date("'.$start.'")] return <Document>{ for $d in $Document/HasDomain/@domain/data() where $Document/HasDomain return <Domain>{attribute{"id"}{$d}, attribute{"data"}{doc("newdf")//Domain[@id/data()=$d]/Name/text()}}</Domain>, for $u in $Document/HasURL/@url/data() where $Document/HasURL return <URL>{attribute{"id"}{$u}, attribute{"data"}{doc("newdf")//URL[@id/data()=$u]/Name/text()} }</URL>, for $i in $Document/HasIP/@ip/data() where $Document/HasIP return <IP>{attribute{"id"}{$i}, attribute{"data"}{doc("newdf")//Ip[@id/data()=$i]/Name/text()}}</IP>, $Document/Time,$Document/Author,$Document/IsReply}</Document>'; }
// commands to be performed
$replace_string=array("<Document>"=>" ","</Document>"=>" ","<Domain"=>" ","/>"=>" ","<URL"=>" ","<IP"=>" ","<Author"=>" ","<Time>"=>" ","</Time>"=>" "); try {
set_time_limit(0); ini_set('max_execution_time',1000);
// create session $session = new Session("localhost", 1984, "admin", "admin"); if($cmd!=null) {
$query = $session->query($cmd); print $query->init(); $count=0; if(!$query->more()) echo "no results"; while($query->more()) { $result=$query->next(); $result=strtr($result,$replace_string); echo $result."<br>"; } print $query->close(); }
print $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?>
</body> </html> ________________________________________ From: Christian Grün [christian.gruen@gmail.com] Sent: Wednesday, July 20, 2011 12:59 PM To: Lusha Wang Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] about performance
Serena,
thanks for your e-mail, and.. Sorry, it's difficult to give you advice without any reproducible code [1]. Please take some time and send us a small code example that allows us to find out what's going wrong.
Best, Christian
[1] http://sscce.org/ ___________________________
On Wed, Jul 20, 2011 at 7:52 PM, Lusha Wang lwang40@syr.edu wrote:
Hello Everyone When I tried the online basex demo, no mater how frequent I submit the query, i can always get results. However, in my own machine, i started the basex server, and then I use php script to query the server, sometimes, no results are returned. Is there any way to solve this problem? Thanks a lot.
Sincerely Serena
basex-talk@mailman.uni-konstanz.de