Skip to content

Commit

Permalink
Create ode.hospitales.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
iker committed Nov 24, 2015
1 parent 2a1568a commit 2228f50
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions ode/ode.hospitales.xml
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author><!-- your name or company name --></author>
<description><!-- description of the table --></description>
<documentationURL><!-- url for API documentation --></documentationURL>
<apiKeyURL><!-- url for getting an API key if needed --></apiKeyURL>
<!--lowering-->
<sampleQuery> URIPattern: http://rdf.onekin.org/ode/{sanidadtown}</sampleQuery>
<sampleQuery> URIExample: http://rdf.onekin.org/ode/Bilbao</sampleQuery>
</meta>
<bindings>
<select itemPath="results.*" produces="XML">
<inputs>
<key id="url" type="xs:string" paramType="variable" default="http://opendata.euskadi.eus/contenidos/ds_localizaciones/hospitales_en_euskadi/opendata/hospitales.xml"/>
<key id="sanidadtown" type="xs:string" paramType="variable" required="true"/>
</inputs>
<execute>
<![CDATA[
var q = "env 'store://datatables.org/alltableswithkeys'; select row from xml where url =@url AND row.sanidadtown LIKE @sanidadtown";
var params ={};
params ['url']= url;
params ['sanidadtown']= sanidadtown+'%';
var query = y.query (q,params);
response.object = query.results;
]]>
</execute>
</select>
<function name="lifting">
<inputs>
<pipe id="oneXML" paramType="variable"/>
<key id="URI" paramType="variable" required="true"/>
</inputs>
<execute>
<![CDATA[
var oneJSON= y.xmlToJson(oneXML);
var oneJSONLD={};
oneJSONLD['@id']=URI;
oneJSONLD['@context']= {"dcterms":"http://purl.org/dc/terms/","rdfs":"http://www.w3.org/2000/01/rdf-schema#","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#"};
oneJSONLD['@type']= 'rdf:Bag';
oneJSONLD['dcterms:title'] = 'Lista de Hospitales / Ospitaleen zerrenda';
oneJSONLD['rdfs:member'] = 'http://rdf.onekin.org/ode/hospital/'+oneJSON['rows']['row']['sanidadname'];
response.object = oneJSONLD;]]>
</execute>
</function>
</bindings>
</table>

0 comments on commit 2228f50

Please sign in to comment.