예제 #1
0
 public static function boot()
 {
     parent::boot();
     // Setup event bindings...
     Sentence::creating(function ($sentence) {
         echo ":3";
         if ($sentence->subject_url) {
             if ($sentence->object_url) {
                 SparqlData::postData("<" . $sentence->subject_url . "> <" . $sentence->action . "> <" . $sentence->object_url . ">", "http://example.com/graph");
             } else {
                 if ($sentence->location_url) {
                     SparqlData::postData("<" . $sentence->subject_url . "> <" . $sentence->action . "> <" . $sentence->location_url . ">", "http://example.com/graph");
                 } else {
                     if ($sentence->object) {
                         SparqlData::postData("<" . $sentence->subject_url . "> <" . $sentence->action . "> \"" . $sentence->object . "\"", "http://example.com/graph");
                     } else {
                         if ($sentence->location) {
                             SparqlData::postData("<" . $sentence->subject_url . "> <" . $sentence->action . "> \"" . $sentence->location . "\"", "http://example.com/graph");
                         }
                     }
                 }
             }
         }
     });
 }
예제 #2
0
 public function query()
 {
     $query = Input::get("query");
     $query_html = str_replace("<", "&lt;", $query);
     $query_html = str_replace(">", "&gt;", $query_html);
     $result = SparqlData::query($query);
     $this->layout->content = View::make('ner.sparql_show', array("response" => $result, "query" => $query_html));
 }