From 1875d39651f9d21b1c537fa8a79a0ce923c1f9a2 Mon Sep 17 00:00:00 2001
From: alvaro <alvaro@alia.(none)>
Date: Wed, 11 Apr 2012 20:08:38 -0700
Subject: [PATCH] Adding .type and .lang to literal results

For example

```
{% for i in models.main%}
Language tag of "{{i.variable.value}}" is "{{i.variable.lang}}"
Datatype of "{{i.variable.value" is "{{i.variable.type}}"
{%endfor%}
```

This solves #105
---
 README            |  2 +-
 classes/Utils.php | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 48e7e609..839586ed 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 lodspeakr - Linked Open Data Simple Publishing Kit
 author: Alvaro Graves (alvaro@graves.cl)
-version: 20120329 
+version: 20120411 
 
 Simplest Installation
 ---------------------
diff --git a/classes/Utils.php b/classes/Utils.php
index 64a40faf..29028d5f 100644
--- a/classes/Utils.php
+++ b/classes/Utils.php
@@ -87,7 +87,15 @@ class Utils{
   	  	  	  $row[$k]['uri'] = 1;
   	  	  	}elseif($v['type'] == 'bnode'){
   	  	  	  $row[$k]['curie'] = 'blankNode';
-  	  	  	}  	  	  	
+  	  	  	}else{
+  	  	  	  if($v['datatype']){
+  	  	  	    $row[$k]['type'] = $v['datatype'];
+  	  	  	  }
+  	  	  	  if($v['xml:lang']){
+  	  	  	    $row[$k]['lang'] = $v['xml:lang'];
+  	  	  	  }
+
+  	  	  	}
   	  	  }
   	  	  /*if(sizeof($aux) == 1){
   	  	  $obj = $row;
@@ -428,9 +436,6 @@ class Utils{
   	  	if(Utils::getResultsType($query) == $conf['output']['select']){
   	  	  $rPointer[$strippedModelFile] = Utils::sparqlResult2Obj($aux);
   	  	  $fPointer[$strippedModelFile] = $rPointer[$strippedModelFile][0];
-  	  	  /*if(sizeof($rPointer)>0){
-  	  	  $rPointer[$modelFile]['firstResults'] = $rPointer[$modelFile][0];
-  	  	  }*/
   	  	}else{
   	  	  $lodspk['resultRdf'] = true;
   	  	  $rPointer[$strippedModelFile] = $aux;
@@ -439,9 +444,6 @@ class Utils{
   	  	if(Utils::getResultsType($query) == $conf['output']['select']){
   	  	  $rPointer = Utils::sparqlResult2Obj($aux);
   	  	  $fPointer[$strippedModelFile] = $rPointer[0];
-  	  	  /*if(sizeof($rPointer)>0){
-  	  	  $rPointer['firstResults'] = $rPointer[0];
-  	  	  }*/
   	  	}else{
   	  	  $lodspk['resultRdf'] = true;
   	  	  $rPointer = $aux;
-- 
GitLab