Exemplo n.º 1
0
 public function quick_add($aspect_type_name, $aspect_data)
 {
     // $current_aspect_group = new AspectGroup;
     // $current_aspect_group->load($this->get_aspect_group_id());
     // $aspect_type_array = $current_aspect_group->get_group_members();
     // $new_aspect_id = array_search($aspect_type_name, $aspect_type_array);
     // if ($new_aspect_id){
     $new_aspect = AspectFactory::create($aspect_type_name, $aspect_data);
     $new_aspect->save();
     $this->add_aspect($new_aspect);
     // }
 }
Exemplo n.º 2
0
 public function write_aspect()
 {
     $new_aspect = AspectFactory::create('AylienEntities', $this->result);
     $new_aspect->aspect_source = 'Aylien Entity Extraction';
     $new_aspect->is_hidden = 1;
     $new_aspect->save();
     $new_subject = new Subject();
     $new_subject->load($this->subject_id);
     $new_subject->add_aspect($new_aspect);
 }
Exemplo n.º 3
0
function run_parse_loop()
{
    $db = Database::get_instance();
    $right_now = sql_datetime();
    $yesterday = sql_datetime(strtotime('24 hours ago'));
    $query = $db->prepare("SELECT id, aspect_type FROM aspects WHERE (last_parsed IS NULL) OR (last_parsed < ?)");
    $data = array($yesterday);
    if ($query->execute($data)) {
        while ($row = $query->fetch()) {
            $current_aspect = AspectFactory::create($row['aspect_type']);
            $current_aspect->load($row['id']);
            $current_aspect->parse();
            // new LogEntry("Parsed aspect ID: ".$row['id']);
            $current_aspect->last_parsed = sql_datetime();
            $current_aspect->update();
        }
    }
}