function generatefromJson($json)
 {
     $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"];
     if (isset($json['from'])) {
         $f = $json['from'];
     }
     $encode = true;
     if (!$trverif->exist()) {
         $encode = false;
         $this->vAa($json);
         $k = 0;
         $models = array();
         if ($transformation == null && $c == null) {
             $encode = false;
             goto notransformation;
         }
         if ($transformation == null && $c != null) {
             $encode = true;
             goto notransformation;
         }
         if ($f != null) {
             $encode = true;
         }
         foreach ($transformation as $key => $value) {
             $trans[] = $value;
             $method = $value["method"];
             $transnum = str_replace(' ', '_', $this->name . " {$k}");
             if ($method == 'sparql') {
                 $condition = array();
                 $AttributeCond = array();
                 $TypeObsel = array();
                 $param = $value["Parameter"];
                 $before = $param["before"];
                 $after = $param["after"];
                 $OTypes = $param["ObselType"];
                 $i = 1;
                 if ($OTypes != null && sizeof($OTypes) != 0) {
                     foreach ($OTypes as $key => $value) {
                         if (isset($value["obselTypeId"])) {
                             $t = $value["obselTypeId"];
                         } else {
                             $t = null;
                         }
                         if (isset($value["attribute"])) {
                             $attribute = $value["attribute"];
                         } else {
                             $attribute = null;
                         }
                         if ($attribute != null && $attribute != "null") {
                             foreach ($attribute as $key => $value) {
                                 $AttributeCond[] = str_replace("#", "", $value["nameAttributeId"]);
                                 $constraint = $value["constraint"];
                                 if ($constraint != null && $constraint != "null") {
                                     foreach ($constraint as $key => $value) {
                                         $AttributeCondition = array();
                                         $AttributeCondition[] = array("index" => "{$i}", "value" => $value);
                                         $condition[] = array('type' => $t, 'attribute' => $AttributeCondition);
                                         $i++;
                                     }
                                 } else {
                                     $TypeObsel[] = $t;
                                 }
                             }
                         } else {
                             $TypeObsel[] = $t;
                         }
                     }
                 } else {
                     continue;
                 }
                 $ComputedTraceAction = new CreateComputedTrace($trace->getBaseUri(), $transnum, $trace->getName(), null);
                 if (empty($AttributeCond)) {
                     $ComputedTraceAction->CreateComputedTrace_sparql($TypeObsel, $AttributeCond, $condition);
                 } else {
                     $ComputedTraceAction->CreateComputedTrace_sparql2($TypeObsel, $AttributeCond, $condition);
                 }
                 $trace = new Trace($ComputedTraceAction->getUri());
                 $reponse = RestfulHelper::getInfo($trace->getUri());
                 while ($reponse == null) {
                     $reponse = RestfulHelper::getInfo($trace->getUri());
                 }
                 $k++;
                 // method sparql automate
             }
             if ($method == 'filter') {
                 // method filter automate
             }
             if ($method == 'fusion') {
                 // method fusion automate
             }
         }
     } else {
         $trace = $trverif;
     }
     // for ($i=0; $i < $s ; $i++) {
     // 		$tname = str_replace(' ', '_', $this->name." $i");
     // 		$trr = new Trace($b.$tname);
     // 		$trr->getObsels();
     // 	}
     notransformation:
     $this->ComputedTrace = $trace;
     $reponse = RestfulHelper::getInfo($trace->getUri());
     while ($reponse == null) {
         sleep(2);
         $reponse = RestfulHelper::getInfo($trace->getUri());
     }
     $values = array();
     foreach ($input as $key => $value) {
         $sparql = $value["operation"];
         if ($encode == false) {
             $sparql = urlencode($sparql);
         }
         $URL = $trace->getUri() . "@obsels?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]);
     return array("var" => $equation[0], "val" => $equation[1]);
     if ($res == false) {
         $trace = $this->TraceOrigin[0];
         $manager = new Indicator_Manager($trace->getUri());
         $manager->deleteIndicator($this->name);
         return array("var" => $equation[0], "val" => "ERROR : something went wrong.");
     } else {
         return array("var" => $equation[0], "val" => $res);
     }
 }
    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;
}