/** * Push the post with the specified ID to Redlink. * * @since 3.0.0 * * @param int $post_id The post ID. */ function wl_linked_data_push_to_redlink($post_id) { // Get the post. $post = get_post($post_id); wl_write_log("wl_linked_data_push_to_redlink [ post id :: {$post_id} ][ post type :: {$post->post_type} ]"); // Call the method on behalf of the post type. switch ($post->post_type) { case 'entity': wl_push_entity_post_to_redlink($post); break; default: wl_push_post_to_redlink($post); } // Reindex the triple store if buffering is turned off. if (false === WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING) { wordlift_reindex_triple_store(); } }
/** * Execute the SPARQL query from the buffer saved for the specified request id. * * @param int $request_id The request ID. */ function wl_execute_saved_sparql_update_query($request_id) { $filename = WL_TEMP_DIR . $request_id . '.sparql'; // If the file doesn't exist, exit. if (!file_exists($filename)) { wl_write_log("wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: {$filename} ]"); return; } wl_write_log("wl_execute_saved_sparql_update_query [ filename :: {$filename} ]"); // Get the query saved in the file. $query = file_get_contents($filename); // Execute the SPARQL query. rl_execute_sparql_update_query($query, false); // Reindex the triple store. wordlift_reindex_triple_store(); // Delete the temporary file. unlink($filename); }