Index: rdfproxy.module
===================================================================
--- rdfproxy.module	(revision 2758)
+++ rdfproxy.module	(working copy)
@@ -28,7 +28,7 @@
       'type' => MENU_CALLBACK,
       'access callback' => 'user_access',
       'access arguments' => array('import via RDF proxy'),
-      'page callback' => 'rdfproxy_lookup',
+      'page callback' => 'rdfproxy_lookup_redirect',
       'page arguments' => array(2),
     ),
     'admin/build/rdfproxy/add' => array(
@@ -49,8 +49,12 @@
     ),
   );
 }
+function rdfproxy_lookup_redirect($profile) {
+	$node = rdfproxy_lookup($profile,$_GET['uri']);
+	if ($node->nid) drupal_goto('node/'.$node->nid);
+	return 'Unable to find information for provided uri';
+}
 
-
 /**
  * Specialized menu callback to load an RDF proxy profile.
  */
@@ -67,7 +71,7 @@
 /**
  * Lookup function which fetches RDF data from a SPARQL endpoint.
  */
-function rdfproxy_lookup($profile, $default_values = array()) {
+function rdfproxy_lookup($profile,$uri=null, $default_values = array()) {
 //  echo 'lookup';
 //  var_dump($profile);
 //global $rdf_namespaces;
@@ -83,14 +87,14 @@
   }
   
   
-  if (!$_GET['uri']) {
+  if (!$uri) {
     drupal_set_message('The RDF proxy lookup requires an URI to be provided', 'error');
     return FALSE;
   }
   
   // FIXME in sparql module.
   require_once drupal_get_path('module', 'sparql') . '/sparql.client.inc';
-  $query = str_replace('%uri', '<' . $_GET['uri'] . '>', $profile->sparql_query);
+  $query = str_replace('%uri', '<' . $uri . '>', $profile->sparql_query);
   $sparql_res = sparql_request($profile->sparql_endpoint, $query);
   //var_dump($sparql_res);
   
@@ -139,7 +143,7 @@
   foreach ($instances as $uri => $instance) {
     $nodes[] = _rdfproxy_node_save($uri, $instance['type'], $instance['values'], $profile);
   }
-  return array_pop($nodes);
+   return array_pop($nodes);
 }
 
 /**
@@ -163,7 +167,7 @@
 //var_dump($expire);
     if ($expires > time()) {
 //      drupal_goto('node/' . $nid);
-      return node_load($nid);
+       return node_load($nid);
     }
     
   }
@@ -267,7 +271,7 @@
 //  drupal_goto('node/' . $node->nid);
   
 //var_dump($node);
-  return $node;
+   return $node;
 }
 
 
