本文整理汇总了PHP中Trace::exist方法的典型用法代码示例。如果您正苦于以下问题:PHP Trace::exist方法的具体用法?PHP Trace::exist怎么用?PHP Trace::exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace::exist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteIndicator
function deleteIndicator($name)
{
$res = $this->indicatorDB->findOne(array('owner' => $this->user, 'Name' => $name));
if ($res != null) {
$transformation = $res["Transformation"];
$s = sizeof($transformation) - 1;
for ($i = $s; $i >= 0; $i--) {
$tname = str_replace(' ', '_', $name . " {$i}");
$t = new Trace($this->BaseUri . $tname);
if ($t->exist()) {
$t->Delete();
}
}
$this->indicatorDB->remove(array('owner' => $this->user, 'Name' => $name));
}
$res = $this->indicatorDB->findOne(array('owner' => $this->user, 'Name' => $name));
if ($res == null) {
return true;
} else {
return false;
}
}
示例2: refresh
function refresh($json, $after = null, $before = null)
{
$trace = $this->TraceOrigin[0];
$this->name = $json["Name"];
$formule = $json["formule"];
$this->formule = $json["formule"];
$input = $json["input"];
$variable = array();
$transformation = $json["Transformation"];
// verification si la dernière transformation est faite ou non !!
// si oui pas la peine de refaire toutes les transformation. avec KTBS les obsels se propagent !!!cool non ?
// si non on fait les transformations.
$s = sizeof($transformation) - 1;
$tname = str_replace(' ', '_', $this->name . " {$s}");
$b = $trace->getBaseUri();
$trverif = new Trace($b . $tname);
$c = $json["createdOn"];
$encode = true;
if (!$trverif->exist()) {
$encode = false;
$k = 0;
$models = array();
if ($transformation == null && $c == null) {
$encode = false;
goto notransformation;
}
if ($transformation == null && $c != null) {
$encode = true;
goto notransformation;
}
} else {
$trace = $trverif;
}
notransformation:
$this->ComputedTrace = $trace;
$reponse = RestfulHelper::getInfo($trace->getUri());
while ($reponse == null) {
sleep(2);
$reponse = RestfulHelper::getInfo($trace->getUri());
}
$values = array();
// $cond = array();
// if($after != null){
// $time = strtotime($after)*1000;
// $cond[] = 'minb='.$time;
// }
// if($before != null){
// $time = strtotime($before)*1000;
// $cond[] = 'maxb='.$time;
// }
// $times = implode('&', $cond);
$Tcomp = new ComputedTrace($trace->getBaseUri(), 'time' . str_replace(' ', '_', $this->name));
if ($Tcomp->exist()) {
$Tcomp->Delete();
}
$Tcomp->config('filter', array($trace));
$Tcomp->setFilterParameter($after, $before);
$Tcomp->filter();
$trace = new Trace($Tcomp->getUri());
foreach ($input as $key => $value) {
$sparql = $value["operation"];
if ($encode == false) {
$sparql = urlencode($sparql);
}
$URL = null;
// if(strlen($times) == 0 ){
$URL = $trace->getUri() . "@obsels?query=" . $sparql;
// }
// else{
// $URL = $trace->getUri()."@obsels?".$times."&query=".$sparql;
// }
$r = RestfulHelper::httpInfo($URL);
while ($r == "409") {
sleep(1);
$r = RestfulHelper::httpInfo($URL);
}
$reponse = RestfulHelper::getInfo($URL);
$rep = json_decode($reponse, true);
$res = $rep['results'];
$resultat = $res['bindings'];
$val = $resultat[0];
$keys = array_keys($val);
$a = $val[$keys[0]];
$va = $a["value"];
if (gettype(intval($va)) != "integer") {
$va = 0;
}
$values[$value['name']] = $va;
}
$f = $formule;
foreach ($values as $key => $value) {
$f = str_replace($key, $value, $f);
}
$m = new EvalMath();
$m->suppress_errors = true;
$equation = explode("=", $f);
$res = $m->evaluate($equation[1]);
$Tcomp->Delete();
if ($res == false) {
return array("var" => $equation[0], "val" => "ERROR : Time intervale caused an error");
//.........这里部分代码省略.........
示例3: array
if (!$trace->exist()) {
$TypeObsel = array("#Click-Button");
$AttributeCond = array();
$condition = array();
$ComputedTraceAction = new CreateComputedTrace($_POST['BaseURI'], $_POST['TraceName'] . $_POST['ActionName'], $_POST['TraceName'], null);
$ComputedTraceAction->CreateComputedTrace_sparql($TypeObsel, $AttributeCond, $condition);
}
exit;
}
if ($_POST['ActionName'] == "GoogleActions") {
$trace = new Trace($_POST['BaseURI'] . $_POST['TraceName'] . $_POST['ActionName']);
if (!$trace->exist()) {
$TypeObsel = array("#Click-lien-google", "#Recherche-Google");
$AttributeCond = array();
$condition = array();
$ComputedTraceAction = new CreateComputedTrace($_POST['BaseURI'], $_POST['TraceName'] . $_POST['ActionName'], $_POST['TraceName'], null);
$ComputedTraceAction->CreateComputedTrace_sparql($TypeObsel, $AttributeCond, $condition);
}
exit;
}
if ($_POST['ActionName'] == "You-TubeActions") {
$trace = new Trace($_POST['BaseURI'] . $_POST['TraceName'] . $_POST['ActionName']);
if (!$trace->exist()) {
$TypeObsel = array("#Abonner-Video", "#Annuler-Abonnement", "#dislike-video", "#Aime-Video");
$AttributeCond = array();
$condition = array();
$ComputedTraceAction = new CreateComputedTrace($_POST['BaseURI'], $_POST['TraceName'] . $_POST['ActionName'], $_POST['TraceName'], null);
$ComputedTraceAction->CreateComputedTrace_sparql($TypeObsel, $AttributeCond, $condition);
}
exit;
}