community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1239945 - in /comdev/nearby_people/templates: people.json people.rdf pick_place.json
Date Fri, 03 Feb 2012 00:03:30 GMT
Author: nick
Date: Fri Feb  3 00:03:30 2012
New Revision: 1239945

URL: http://svn.apache.org/viewvc?rev=1239945&view=rev
Log:
Add templates for a proper JSON api for finding people and places, and RDF for finding people

Added:
    comdev/nearby_people/templates/people.json
    comdev/nearby_people/templates/people.rdf
    comdev/nearby_people/templates/pick_place.json

Added: comdev/nearby_people/templates/people.json
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/people.json?rev=1239945&view=auto
==============================================================================
--- comdev/nearby_people/templates/people.json (added)
+++ comdev/nearby_people/templates/people.json Fri Feb  3 00:03:30 2012
@@ -0,0 +1,45 @@
+{
+   "results": {{ people|length }},
+   "people": [
+      {% for dist,p in people %}
+         {
+            "uid": "{{p.uid}}",
+            "name": "{{p.name}}",
+            "surname": "{{p.surname}}",
+            "details": "{{p.link}}",
+{#            "email": "{{p.email}}", #}
+            {% if p.avatar %}
+               "avatar": "{{p.avatar}}",
+            {% endif %}
+            "projects": [
+               {% for project in p.projects %}
+                  "{{project.name}}"{% if forloop.last %},{% endif %}
+               {% endfor %}
+            ],
+            "weblogs": {
+               {% for blog in p.weblogs %}
+                  "{{blog.title}}": "{{blog.url}}" {% if forloop.last %},{% endif %}
+               {% endfor %}
+            },
+
+            "location": {
+                "distance": {{dist}},
+                "latitude": {{p.latitude}}, 
+                "longitude": {{p.longitude }}
+            }
+         },
+      {% endfor %}
+   ],
+   "location": {
+      "request": { "latitude": {{location.latitude}}, 
+                   "longitude": {{location.longitude }} },
+      "result": {
+          "center": { "latitude": {{center_lat}}, 
+                      "longitude": {{center_long}} },
+          "top_right":   { "latitude": {{tr_lat}}, "longitude": {{tr_long}} },
+          "bottom_left": { "latitude": {{bl_lat}}, "longitude": {{bl_long}} },
+          "large_distances": {{ large_distance|lower }}
+      }
+   },
+   "type": "{{people_type}}"
+}

Added: comdev/nearby_people/templates/people.rdf
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/people.rdf?rev=1239945&view=auto
==============================================================================
--- comdev/nearby_people/templates/people.rdf (added)
+++ comdev/nearby_people/templates/people.rdf Fri Feb  3 00:03:30 2012
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<rdf:RDF xml:lang="en" xmlns="http://usefulinc.com/ns/doap#" 
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+   xmlns:asfext="http://projects.apache.org/ns/asfext#" 
+   xmlns:foaf="http://xmlns.com/foaf/0.1/"
+   xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
+
+<Project>
+   <name>People near {{location.latitude}}, {{location.longitude}}</name>
+
+   <helper>
+      {% for dist,p in people %}
+         <foaf:Person rdf:ID="{{p.uid}}">
+            <foaf:name>{{p.name}}</foaf:name>
+            <foaf:family_name>{{p.surname}}</foaf:family_name>
+            <!-- TODO Add a bit more -->
+
+            <foaf:based_near>
+              <geo:Point>
+                <geo:lat>{{p.latitude}}</geo:lat>
+                <geo:long>{{p.longitude}}</geo:long>
+              </geo:Point>
+            </foaf:based_near>
+         </foaf:Person>
+      {% endfor %}
+   </helper>
+</Project>
+</rdf:RDF>

Added: comdev/nearby_people/templates/pick_place.json
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/pick_place.json?rev=1239945&view=auto
==============================================================================
--- comdev/nearby_people/templates/pick_place.json (added)
+++ comdev/nearby_people/templates/pick_place.json Fri Feb  3 00:03:30 2012
@@ -0,0 +1,12 @@
+{
+   "results": {{ places|length }},
+   "places": [
+      {% for p in places %}
+        {
+          "name": "{{p.name}}", "country": "{{p.country}}",
+          "latitude": {{p.latitude}}, "longitude": {{p.longitude}},
+          "id": "{{forloop.counter}}",
+        },
+      {% endfor %}
+   ]
+}



Mime
View raw message