From b9a473b6a5371dde3eb5d722f9fa103029eebc60 Mon Sep 17 00:00:00 2001
From: Alvaro Graves <alvaro@graves.cl>
Date: Mon, 5 Sep 2011 07:45:30 -0700
Subject: [PATCH] temp commit 3

---
 classes/Utils.php~                            | 157 ------------------
 ...a63e1d92b5e02960e7039e14a5754d707e4e60.php |  85 ----------
 meta/db.sqlite                                | Bin 36864 -> 36864 bytes
 views/default.view.html~                      |  24 +--
 4 files changed, 13 insertions(+), 253 deletions(-)
 delete mode 100644 classes/Utils.php~
 delete mode 100644 compiled/65a63e1d92b5e02960e7039e14a5754d707e4e60.php

diff --git a/classes/Utils.php~ b/classes/Utils.php~
deleted file mode 100644
index c36c8c27..00000000
--- a/classes/Utils.php~
+++ /dev/null
@@ -1,157 +0,0 @@
-<? 
-
-class Utils{
-  
-  public static function send303($uri, $ext){
-  	header("HTTP/1.0 303 See Other");
-  	header("Location: ".$uri);
-  	header("Content-type: ".$ext);
-  	echo $uri."\n\n";
-  	exit(0);
-  }
-  
-  public static function send404($uri){
-  	header("HTTP/1.0 404 Not Found");
-  	echo "I could not find ".$uri." or information about it.\n\n";
-  	exit(0);
-  }
-  
-  public static function send406($uri){
-  	header("HTTP/1.0 406 Not Acceptable");
-  	echo "I can't find a representation suitable for the content type you accept\n\n";
-  	exit(0);
-  }
-  
-  public static function send500($uri){
-  	header("HTTP/1.0 500 Internal Server Error");
-  	echo "An internal error ocurred. Please try later\n\n";
-  	exit(0);
-  }
-  
-  public static function uri2curie($uri){
-  	global $conf;
-  	$ns = $conf['ns'];
-  	$curie = $uri;
-  	foreach($ns as $k => $v){
-  	  $curie = preg_replace("|^$v|", "$k:", $uri);
-  	  if($curie != $uri){
-  	  	break;
-  	  }
-  	}
-  	return $curie;
-  }
-  
-  public static function getTemplate($uri){
-  	$filename = str_replace(":", "_", $uri);
-  	if(file_exists ($filename)){
-  	  include_once($filename);
-  	}
-  }
-  
-  private static function sparqlResult2Obj($data){
-  	$aux = $data['results']['bindings'];
-  	$obj = array();
-  	foreach($aux as $w){
-  	  $row = array();
-  	  foreach($w as $k => $v){
-  	  	$row[$k]['value'] = $v['value'];
-  	  	if($v['type'] == 'uri'){
-  	  	  $row[$k]['curie'] = Utils::uri2curie($v['value']);
-  	  	  $row[$k]['uri'] = 1;
-  	  	}
-  	  }
-  	  array_push($obj, $row);
-  	}
-  	return $obj;
-  }
-  
-  public static function showView($uri, $data, $view){
-  	global $conf;
-  	$base = $conf['view']['standard'];
-  	$base['value']['this'] = $uri;
-  	$base['curie']['this'] = Utils::uri2curie($uri);
-  	$base['ns'] = $conf['ns'];
-  	require('lib/Haanga/lib/Haanga.php');
-  	Haanga::configure(array(
-  	  'template_dir' => './',
-  	  'cache_dir' => 'compiled/',
-  	  ));
-  	$r = Utils::sparqlResult2Obj($data);
-	$vars = compact('base', 'r');
-	Haanga::Load($view, $vars);
-  	
-  }
-  
-  public static function getExtension($accept_string){
-  	global $conf;
-  	$extension = "html";
-  	foreach($conf['http_accept'] as $ext => $accept_arr){
-  	  if(in_array($accept_string, $accept_arr)){
-  	    $extension = $ext;
-  	  }
-  	}
-  	return $extension;
-  }
-  
-  public static function getBestContentType($accept_string){
-  	global $conf;
-  	/*
-  	* TODO: Choose best content type from
-  	* things like
-  	* "text/html;q=0.2,application/xml;q=0.1"
-  	* and so on. In the meantime,
-  	* assume there is only one CT
-  	*/
-  	$a = split(",", $accept_string);
-  	$ct = 'text/html';
-  	if(strstr($a[0], ";")){
-  	  $a = split(";", $a[0]);
-  	}
-  	foreach($conf['http_accept'] as $ext => $arr){
-  	  if(in_array($a[0], $arr)){
-  	  	$ct = $a[0];
-  	  }
-  	}
-  	
-  	return $ct;
-  }
-  
-  public static function processQuery($modelFile, $uri, $endpoint){
-    global $conf;
-    //Check if files for model and view exist
-	
-	$query = file_get_contents($modelFile);
-	$query = preg_replace("|".$conf['resource']['url_delimiter']."|", "<".$uri.">", $query);
-echo $query;
-	header('Content-Type: '.$acceptContentType);
-	if(preg_match("/describe/i", $query)){
-	  $results = $endpoint->query($query, $conf['endpoint']['describe']['output']);
-	  require('lib/arc2/ARC2.php');
-	  $parser = ARC2::getRDFParser();
-	  $parser->parse($conf['basedir'], $results);
-	  $triples = $parser->getTriples();
-	  $ser;
-	  switch ($extension){
-	  case 'ttl':
-	  	$ser = ARC2::getTurtleSerializer();
-	  	break;
-	  case 'nt':
-	  	$ser = ARC2::getNTriplesSerializer();
-	  	break;
-	  case 'rdf':
-	  	$ser = ARC2::getRDFXMLSerializer();
-	  	break;
-	  }
-	  $doc = $ser->getSerializedTriples($triples);
-	  echo $doc;
-	  exit(0);
-	}
-	elseif(preg_match("/select/i", $query)){
-	  return $endpoint->query($query, $conf['endpoint']['select']['output']);
-	  if(sizeof($results['results']['bindings']) == 0){
-	  	Utils::send404($uri);
-	  }
-	}
-  }
-}
-?>
diff --git a/compiled/65a63e1d92b5e02960e7039e14a5754d707e4e60.php b/compiled/65a63e1d92b5e02960e7039e14a5754d707e4e60.php
deleted file mode 100644
index b36aa0bd..00000000
--- a/compiled/65a63e1d92b5e02960e7039e14a5754d707e4e60.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-$HAANGA_VERSION  = '1.0.4';
-/* Generated from /Users/alvarograves/github/lodspeakr/views/default.view.html */
-function haanga_65a63e1d92b5e02960e7039e14a5754d707e4e60($vars, $return=FALSE, $blocks=array())
-{
-    extract($vars);
-    if ($return == TRUE) {
-        ob_start();
-    }
-    echo '<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
-    "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" ';
-    foreach ($base['ns'] as  $i => $ns) {
-        echo 'xmlns:'.htmlspecialchars($i).'="'.htmlspecialchars($ns).'" 
-    ';
-    }
-    echo 'version="XHTML+RDFa 1.0" xml:lang="en">
-    <head>
-    <title>Page about '.htmlspecialchars($base['this']['value']).'</title>
-    <link href="'.htmlspecialchars($base['baseUrl']).'/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
-  </head>
-  <body>                               
-    <h1>Page about <a href=\''.htmlspecialchars($base['this']['value']).'\'>'.htmlspecialchars($base['this']['curie']).'</a></h1>
-  <div>
-    <h2>Information from '.htmlspecialchars($base['this']['curie']).'</h2>
-    <table about="'.htmlspecialchars($base['this']['value']).'"> 
-    ';
-    foreach ($r as  $row) {
-        echo '
-      ';
-        if ($row['s1'] != $null) {
-            echo '
-      <tr>
-        <td><a href=\''.htmlspecialchars($row['s1']->value).'\'>'.htmlspecialchars($row['s1']->value).'</a></td>
-        ';
-            if ($row['p1']->uri == 1) {
-                echo '
-        <td><a rel=\''.htmlspecialchars($row['s1']->curie).'\' href=\''.htmlspecialchars($row['p1']->value).'\'>'.htmlspecialchars($row['p1']->curie).'</a></td>
-        ';
-            } else {
-                echo '
-        <td><span property=\''.htmlspecialchars($row['s1']->curie).'\'>'.htmlspecialchars($row['p1']->value).'</span></td>
-        ';
-            }
-            echo '
-        </tr>
-      ';
-        }
-        echo '
-    ';
-    }
-    echo '
-    </table>
-    <br/><br/>
-    <h2>Information pointing to '.htmlspecialchars($base['this']['curie']).'</h2>
-
-    <table about="'.htmlspecialchars($base['this']['value']).'"> 
-    ';
-    foreach ($r as  $row) {
-        echo '
-    
-      ';
-        if ($row['s2'] != $null) {
-            echo '
-    <tr>
-        <td><a rev=\''.htmlspecialchars($row['p2']['curie']).'\' href=\''.htmlspecialchars($row['s2']['value']).'\'>'.htmlspecialchars($row['s2']['curie']).'</a></td>
-        <td><a href=\''.htmlspecialchars($row['p2']['value']).'\'>'.htmlspecialchars($row['p2']['curie']).'</a></td>
-    </tr>
-    ';
-        }
-        echo '
-    ';
-    }
-    echo '
-    </table>
-    </div>
-  </body>
-</html>
-
-';
-    if ($return == TRUE) {
-        return ob_get_clean();
-    }
-}
\ No newline at end of file
diff --git a/meta/db.sqlite b/meta/db.sqlite
index 970b8ef3b9954dbdbab4b05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009IL
zKmY**5I_I{1Q0*~0R#~Ervm9e^mZ~wmh;tlB|A0*E`dOKB3s&-uW22xd0r4zR8WhW
zT8^sC*jERMr-DP3M8<-g)`9lh+S9E>2ma=`w4E}JG8UY+4GVi?(sIQ(!dQ^DRB;^C
YD@xa+&}%PsF8LCC*!+kHAaIVrFSm_((*OVf

diff --git a/views/default.view.html~ b/views/default.view.html~
index 69724883..83bede91 100644
--- a/views/default.view.html~
+++ b/views/default.view.html~
@@ -1,38 +1,40 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
     "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}" 
+    <html {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}" 
     {%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
     <head>
     <title>Page about {{base.value.this}}</title>
-    <link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
+    <link href="{{base.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
   </head>
   <body>
-    <h1>Page about <a href='{{base.this.value}}'>{{base.curie.this}}</a></h1>
+    <h1>Page about <a href='{{base.value.this}}'>{{base.curie.this}}</a></h1>
+  <br/>
+  <br/>
   <div>
-    <h2>Information from {{base.this.curie}}</h2>
+    <h2>Information from {{base.curie.this}}</h2>
     <table about="{{base.value.this}}"> 
     {% for row in r %}
-      {% if row.s1.value != null %}
+      {% if row.value.s1 != null %}
       <tr>
-        <td><a href='{{row.s1.value}}'>{{row.s1.curie}}</a></td>
+        <td><a href='{{row.value.s1}}'>{{row.curie.s1}}</a></td>
         {% if row.uri.p1 == 1 %}
-        <td><a rel='{{row.s1.curie}}' href='{{row.p1.value}}'>{{row.p1.curie}}</a></td>
+        <td><a rel='{{row.curie.s1}}' href='{{row.value.p1}}'>{{row.curie.p1}}</a></td>
         {% else %}
-        <td><span property='{{row.s1.curie}}'>{{row.p1.value}}</span></td>
+        <td><span property='{{row.curie.s1}}'>{{row.value.p1}}</span></td>
         {% endif %}
         </tr>
       {% endif %}
     {% endfor %}
     </table>
     <br/><br/>
-    <h2>Information pointing to {{base.this.curie}}</h2>
+    <h2>Information pointing to {{base.curie.this}}</h2>
     <table about="{{base.value.this}}"> 
     {% for row in r %}
       {% if row.value.s2 != null %}
     <tr>
-        <td><a rev='{{row.p2.curie}}' href='{{row.value.s2}}'>{{row.s2.curie}}</a></td>
-        <td><a href='{{row.value.p2}}'>{{row.p2.curie}}</a></td>
+        <td><a rev='{{row.curie.p2}}' href='{{row.value.s2}}'>{{row.curie.s2}}</a></td>
+        <td><a href='{{row.value.p2}}'>{{row.curie.p2}}</a></td>
     </tr>
     {%endif %}
     {% endfor %}
-- 
GitLab