public function findOrCreate($edge, $vIn, $vOut)
 {
     if (!$edge || !$vIn || !$vOut) {
         throw new \Exception('Invalid arguments');
     }
     $vertex = new Vertex();
     // findOrCreate origin vertex
     $vertex->setSufix('in');
     $query = $vertex->findOrCreate($vIn->label, $vIn->properties, false);
     $vertex->prepareQuery($vIn->label, $vIn->properties);
     // findOrCreate target vertex
     $vertex->setSufix('out');
     $query .= $vertex->findOrCreate($vOut->label, $vOut->properties, false);
     $vertex->prepareQuery($vOut->label, $vOut->properties);
     //create edge betweeen vertices
     $edgeProperties = ParserProperties::parsePropertiesToInsert(false, $edge->properties);
     $query .= "vin.addEdge('{$edge->label}', vout";
     if (strlen($edgeProperties)) {
         $query .= ",{$edgeProperties});";
         $this->prepareQuery(false, $edge->properties);
     } else {
         $query .= ');';
     }
     //die($query);
     return $this->executeQuery($query);
 }
 public function findBy($label = false, $properties, $sendCommand = false)
 {
     $sufix = $this->getSufix();
     $query = 'g.V()';
     if ($label) {
         $query .= ".has(label,BIND_LABEL{$sufix})";
     }
     $parserProperties = ParserProperties::parsePropertiesToFindBy($properties, $sufix);
     $query .= "{$parserProperties}";
     if ($sendCommand) {
         $this->prepareQuery($label, $properties);
         return $this->executeQuery($query);
     }
     return $query;
 }