community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r894262 - /comdev/nearby_people/nearby/foaf.py
Date Mon, 28 Dec 2009 22:51:16 GMT
Author: rgardler
Date: Mon Dec 28 22:51:15 2009
New Revision: 894262

URL: http://svn.apache.org/viewvc?rev=894262&view=rev
Log:
Store details of current projects for people

Modified:
    comdev/nearby_people/nearby/foaf.py

Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=894262&r1=894261&r2=894262&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Mon Dec 28 22:51:15 2009
@@ -27,6 +27,7 @@
 NS_GEO = "http://www.w3.org/2003/01/geo/wgs84_pos#"
 NS_FOAF = "http://xmlns.com/foaf/0.1/"
 NS_DOAP = "http://usefulinc.com/ns/doap#"
+NS_PM = "http://www.web-semantics.org/ns/pm#"
 
 class FOAF(object):
     def __init__(self, doap_file):
@@ -64,6 +65,7 @@
             uid  = None
             lat  = None
             long = None
+            projects = []
 
             if uri.startswith(PEOPLE_FOAF_NAMESPACE):
                 file = os.path.join(PEOPLE_FOAF_PATH, uri.replace(PEOPLE_FOAF_NAMESPACE,""))
@@ -74,6 +76,7 @@
                 longN = foaf.getElementsByTagNameNS(NS_GEO,"long")
                 latN  = foaf.getElementsByTagNameNS(NS_GEO,"lat")
                 uidN = foaf.getElementsByTagNameNS(NS_FOAF,"Person")
+                currentProjectsN = foaf.getElementsByTagNameNS(NS_FOAF,"currentProject")
                 if surnameN:
                     surname = surnameN[0].firstChild.data
                 if nameN:
@@ -105,11 +108,23 @@
                     if not long.startswith("-"):
                         long = "-%s" % long
 
+            if currentProjectsN:
+                print "start"
+                for projectN in currentProjectsN:
+                    projectName = projectN.getElementsByTagNameNS(NS_DOAP,"name")
+                    if not projectName:
+                        projectName = projectN.getElementsByTagNameNS(NS_PM,"name")
+                    if projectName:
+                        projects.append({"name": projectName[0].firstChild.data})
+                print projects
+                print "end"
+                print "\n"
+
             # Finish building up
             if name and surname and uid and lat and long:
                 self.people[name] = {
                     "name": name, "surname": surname, "uid":uid, 
-                    "latitude": lat, "longitude": long
+                    "latitude": lat, "longitude": long, "projects": projects
                 }
 
         self.updated_at = datetime.datetime.utcnow()



Mime
View raw message