Merge lp:~sinzui/launchpad/rdf-links-1 into lp:launchpad

Proposed by Curtis Hovey on 2010-10-15
Status: Merged
Approved by: Aaron Bentley on 2010-10-18
Approved revision: no longer in the source branch.
Merged at revision: 11747
Proposed branch: lp:~sinzui/launchpad/rdf-links-1
Merge into: lp:launchpad
Diff against target: 225 lines (+58/-52)
7 files modified
lib/lp/registry/stories/person/xx-person-rdf.txt (+13/-13)
lib/lp/registry/stories/product/xx-product-rdf.txt (+16/-15)
lib/lp/registry/stories/project/xx-project-rdf.txt (+15/-14)
lib/lp/registry/templates/person-rdf-contents.pt (+2/-4)
lib/lp/registry/templates/product-rdf.pt (+4/-2)
lib/lp/registry/templates/productrelease-rdf.pt (+4/-2)
lib/lp/registry/templates/project-rdf.pt (+4/-2)
To merge this branch: bzr merge lp:~sinzui/launchpad/rdf-links-1
Reviewer Review Type Date Requested Status
Aaron Bentley (community) 2010-10-15 Approve on 2010-10-18
Review via email: mp+38573@code.launchpad.net

Description of the Change

This is my branch to use foaf to specify membership and ownership.

    lp:~sinzui/launchpad/rdf-links-1
    Diff size: 164
    Launchpad bug: https://bugs.launchpad.net/bugs/660832
    Test command: ./bin/test -vv -t rdf
    Pre-implementation: no one
    Target release: 10.11

Use foaf to specify membership and ownership
---------------------------------------------

A recent change to Launchpad (james_w at #launchpad mentioned
https://code.edge.launchpad.net/~sinzui/launchpad/rdf-links-0/+merge/36475)
broke the RDF syntax for the team members list.

Looks like the lp's OWL never expected to use its own specifiedAt as a member.
However, I do not think the lp:specifiedAt is needed. We can express this in
FOAF and FOAF is good. lp:owner will also need updating.

Rules
-----

    * Teams will use:
      <foaf:Group>
        <foaf:member rdf:resource="/~user-id/+rdf"/>
      </foaf:Group>
    * Projects, products, and releases will use:
      <lp:owner>
        <foaf:Agent>
          <foaf:Account rdf:resource="/~user-id/+rdf"/>
        </foaf:Agent>
      </lp:owner>

QA
--

From a python console with python-rdflib installed run this:
      from rdflib.Graph import Graph
      g = Graph()
      g.parse('https://edge.launchpad.net/~getdeb-uploaders/+rdf')
      g.parse('https://edge.launchpad.net/~sinzui/+rdf')
      g.parse('https://edge.launchpad.net/gdp/+rdf')
      g.parse('https://edge.launchpad.net/launchpad-project/+rdf')

Lint
----

Linting changed files:
  lib/lp/registry/stories/person/xx-person-rdf.txt
  lib/lp/registry/stories/product/xx-product-rdf.txt
  lib/lp/registry/stories/project/xx-project-rdf.txt
  lib/lp/registry/templates/person-rdf-contents.pt
  lib/lp/registry/templates/product-rdf.pt
  lib/lp/registry/templates/productrelease-rdf.pt
  lib/lp/registry/templates/project-rdf.pt

^ There are indentation problems in the tests. I will fix these after the
review so that the diff does not hide my changes.

Test
----

Revised test to verify foaf markup.
    * lib/lp/registry/stories/person/xx-person-rdf.txt
    * lib/lp/registry/stories/product/xx-product-rdf.txt
    * lib/lp/registry/stories/project/xx-project-rdf.txt

Implementation
--------------

Updated member markup
    * lib/lp/registry/templates/person-rdf-contents.pt

Updated owner markup:
    * lib/lp/registry/templates/product-rdf.pt
    * lib/lp/registry/templates/productrelease-rdf.pt
    * lib/lp/registry/templates/project-rdf.pt

To post a comment you must log in.
Aaron Bentley (abentley) wrote :

Some examples say "foaf:Accoun" rather than "foaf:Account"

review: Needs Fixing
Curtis Hovey (sinzui) wrote :

On Mon, 2010-10-18 at 18:41 +0000, Aaron Bentley wrote:
> Review: Needs Fixing
> Some examples say "foaf:Accoun" rather than "foaf:Account"

I must have been running tests in the wrong branch. I fixed the two
failing tests that expects Account to be mispelled.

This RDF branch has another idiotic problem bu defining a user as a
group. The xx-person-rdf.txt tests rightly fails because the template is
saying the member is a group with only one member, the user. The markup
should be a single element stating the url of the member.

1=== modified file 'lib/lp/registry/stories/product/xx-product-rdf.txt'
2--- lib/lp/registry/stories/product/xx-product-rdf.txt 2010-10-15 16:28:56 +0000
3+++ lib/lp/registry/stories/product/xx-product-rdf.txt 2010-10-18 18:52:34 +0000
4@@ -14,7 +14,7 @@
5 ...
6 <lp:owner>
7 <foaf:Agent>
8- <foaf:Accoun rdf:resource="/~name12/+rdf"/>
9+ <foaf:Account rdf:resource="/~name12/+rdf"/>
10 </foaf:Agent>
11 </lp:owner>
12 ...
13
14=== modified file 'lib/lp/registry/stories/project/xx-project-rdf.txt'
15--- lib/lp/registry/stories/project/xx-project-rdf.txt 2010-10-15 16:28:56 +0000
16+++ lib/lp/registry/stories/project/xx-project-rdf.txt 2010-10-18 19:01:34 +0000
17@@ -14,7 +14,7 @@
18 ...
19 <lp:owner>
20 <foaf:Agent>
21- <foaf:Accoun rdf:resource="/~name12/+rdf"/>
22+ <foaf:Account rdf:resource="/~name12/+rdf"/>
23 </foaf:Agent>
24 </lp:owner>
25 ...
26
27=== modified file 'lib/lp/registry/templates/person-rdf-contents.pt'
28--- lib/lp/registry/templates/person-rdf-contents.pt 2010-10-15 16:28:56 +0000
29+++ lib/lp/registry/templates/person-rdf-contents.pt 2010-10-18 19:01:15 +0000
30@@ -42,12 +42,8 @@
31 tal:attributes="rdf:resource context/logo/http_url" />
32 <foaf:img tal:condition="context/mugshot"
33 tal:attributes="rdf:resource context/mugshot/http_url" />
34- <foaf:member tal:repeat="person context/allmembers">
35- <foaf:Group>
36- <foaf:member
37- tal:attributes="rdf:resource string:${person/fmt:url}/+rdf" />
38- </foaf:Group>
39- </foaf:member>
40+ <foaf:member tal:repeat="person context/allmembers"
41+ tal:attributes="rdf:resource string:${person/fmt:url}/+rdf" />
42 </foaf:Group>
43 </tal:public>
44 </tal:ns>
45
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/stories/person/xx-person-rdf.txt'
2--- lib/lp/registry/stories/person/xx-person-rdf.txt 2010-09-23 04:29:51 +0000
3+++ lib/lp/registry/stories/person/xx-person-rdf.txt 2010-10-19 01:17:45 +0000
4@@ -1,4 +1,5 @@
5-= Person RDF Pages =
6+Person RDF Pages
7+================
8
9 We export FOAF RDF metadata from the /~Person.name/+index document.
10
11@@ -9,7 +10,9 @@
12 >>> print soup.renderContents()
13 <link rel="meta" type="application/rdf+xml" title="FOAF" href="+rdf" />
14
15-== Individual RDF ==
16+
17+Individual RDF
18+--------------
19
20 And this is what the FOAF document for an individual actually looks
21 like. It includes GPG information, if the user has any.
22@@ -54,7 +57,9 @@
23 >>> print document.documentElement.nodeName
24 rdf:RDF
25
26-== Team RDF ==
27+
28+Team RDF
29+--------
30
31 Teams also have an RDF export, which includes information for each
32 member of the team. Let's add a logo to Mark's user so we can see the
33@@ -79,21 +84,16 @@
34 <foaf:Group>
35 <foaf:name>testing Spanish team</foaf:name>
36 <foaf:nick>testing-spanish-team</foaf:nick>
37- <foaf:member>
38- <lp:specifiedAt rdf:resource="/~carlos/+rdf"/>
39- </foaf:member>
40- <foaf:member>
41- <lp:specifiedAt rdf:resource="/~name16/+rdf"/>
42- </foaf:member>
43- <foaf:member>
44- <lp:specifiedAt rdf:resource="/~mark/+rdf"/>
45- </foaf:member>
46+ <foaf:member rdf:resource="/~carlos/+rdf"/>
47+ <foaf:member rdf:resource="/~name16/+rdf"/>
48+ <foaf:member rdf:resource="/~mark/+rdf"/>
49 ...
50 </foaf:Group>
51 </rdf:RDF>
52
53
54-== Corner Cases ==
55+Corner Cases
56+------------
57
58 Note how ascii and non-ascii names are rendered properly:
59
60
61=== modified file 'lib/lp/registry/stories/product/xx-product-rdf.txt'
62--- lib/lp/registry/stories/product/xx-product-rdf.txt 2010-09-23 04:29:51 +0000
63+++ lib/lp/registry/stories/product/xx-product-rdf.txt 2010-10-19 01:17:45 +0000
64@@ -1,29 +1,30 @@
65 We export DOAP RDF metadata for products from a link in the
66 /productname/+index document:
67
68- >>> anon_browser.open("http://launchpad.dev/firefox")
69- >>> anon_browser.getLink("RDF metadata").click()
70- >>> print anon_browser.contents
71- <?xml version="1.0" encoding="utf-8"...?>
72- <rdf:RDF ...xmlns:lp="https://launchpad.net/rdf/launchpad#"...>
73+ >>> anon_browser.open("http://launchpad.dev/firefox")
74+ >>> anon_browser.getLink("RDF metadata").click()
75+ >>> print anon_browser.contents
76+ <?xml version="1.0" encoding="utf-8"...?>
77+ <rdf:RDF ...xmlns:lp="https://launchpad.net/rdf/launchpad#"...>
78 <lp:Product>
79 <lp:specifiedAt rdf:resource="/firefox/+rdf"...
80 <lp:name>firefox</lp:name>
81 <lp:displayName>Mozilla Firefox</lp:displayName>
82 <lp:title>Mozilla Firefox</lp:title>
83- ...
84+ ...
85 <lp:owner>
86- <lp:specifiedAt rdf:resource="/~name12/+rdf"/>
87+ <foaf:Agent>
88+ <foaf:Account rdf:resource="/~name12/+rdf"/>
89+ </foaf:Agent>
90 </lp:owner>
91- ...
92+ ...
93 </lp:Product>
94- </rdf:RDF>
95- <BLANKLINE>
96+ </rdf:RDF>
97+ <BLANKLINE>
98
99 And it's valid XML and RDF:
100
101- >>> from xml.dom.minidom import parseString
102- >>> document = parseString(str(anon_browser.contents))
103- >>> print document.documentElement.nodeName
104- rdf:RDF
105-
106+ >>> from xml.dom.minidom import parseString
107+ >>> document = parseString(str(anon_browser.contents))
108+ >>> print document.documentElement.nodeName
109+ rdf:RDF
110
111=== modified file 'lib/lp/registry/stories/project/xx-project-rdf.txt'
112--- lib/lp/registry/stories/project/xx-project-rdf.txt 2010-09-23 04:29:51 +0000
113+++ lib/lp/registry/stories/project/xx-project-rdf.txt 2010-10-19 01:17:45 +0000
114@@ -1,28 +1,29 @@
115 We export DOAP RDF metadata for projects from a link in the
116 /projectname/+index document:
117
118- >>> anon_browser.open("http://launchpad.dev/mozilla")
119- >>> anon_browser.getLink("Download RDF metadata").click()
120- >>> print anon_browser.contents
121- <?xml version="1.0" encoding="utf-8"...
122- <rdf:RDF ...xmlns:lp="https://launchpad.net/rdf/launchpad#"...
123+ >>> anon_browser.open("http://launchpad.dev/mozilla")
124+ >>> anon_browser.getLink("Download RDF metadata").click()
125+ >>> print anon_browser.contents
126+ <?xml version="1.0" encoding="utf-8"...
127+ <rdf:RDF ...xmlns:lp="https://launchpad.net/rdf/launchpad#"...
128 <lp:Project>
129 <lp:specifiedAt rdf:resource="/mozilla/+rdf"...
130 <lp:name>mozilla</lp:name>
131 <lp:displayName>the Mozilla Project</lp:displayName>
132 <lp:title>The Mozilla Project</lp:title>
133- ...
134+ ...
135 <lp:owner>
136- <lp:specifiedAt rdf:resource="/~name12/+rdf"/>
137+ <foaf:Agent>
138+ <foaf:Account rdf:resource="/~name12/+rdf"/>
139+ </foaf:Agent>
140 </lp:owner>
141- ...
142+ ...
143 </lp:Project>
144- </rdf:RDF>
145+ </rdf:RDF>
146
147 It's valid XML and RDF:
148
149- >>> from xml.dom.minidom import parseString
150- >>> document = parseString(str(anon_browser.contents))
151- >>> print document.documentElement.nodeName
152- rdf:RDF
153-
154+ >>> from xml.dom.minidom import parseString
155+ >>> document = parseString(str(anon_browser.contents))
156+ >>> print document.documentElement.nodeName
157+ rdf:RDF
158
159=== modified file 'lib/lp/registry/templates/person-rdf-contents.pt'
160--- lib/lp/registry/templates/person-rdf-contents.pt 2010-09-23 17:23:06 +0000
161+++ lib/lp/registry/templates/person-rdf-contents.pt 2010-10-19 01:17:45 +0000
162@@ -42,10 +42,8 @@
163 tal:attributes="rdf:resource context/logo/http_url" />
164 <foaf:img tal:condition="context/mugshot"
165 tal:attributes="rdf:resource context/mugshot/http_url" />
166- <foaf:member tal:repeat="person context/allmembers">
167- <lp:specifiedAt tal:attributes="rdf:resource
168- string:${person/fmt:url}/+rdf" />
169- </foaf:member>
170+ <foaf:member tal:repeat="person context/allmembers"
171+ tal:attributes="rdf:resource string:${person/fmt:url}/+rdf" />
172 </foaf:Group>
173 </tal:public>
174 </tal:ns>
175
176=== modified file 'lib/lp/registry/templates/product-rdf.pt'
177--- lib/lp/registry/templates/product-rdf.pt 2010-09-23 03:24:10 +0000
178+++ lib/lp/registry/templates/product-rdf.pt 2010-10-19 01:17:45 +0000
179@@ -56,8 +56,10 @@
180 </lp:ProductSeries>
181 </lp:series>
182 <lp:owner>
183- <lp:specifiedAt tal:attributes="rdf:resource
184- string:${context/owner/fmt:url}/+rdf" />
185+ <foaf:Agent>
186+ <foaf:Account
187+ tal:attributes="rdf:resource string:${context/owner/fmt:url}/+rdf"/>
188+ </foaf:Agent>
189 </lp:owner>
190 <lp:status tal:condition="context/active">Active</lp:status>
191 <lp:status tal:condition="not:context/active">Inactive</lp:status>
192
193=== modified file 'lib/lp/registry/templates/productrelease-rdf.pt'
194--- lib/lp/registry/templates/productrelease-rdf.pt 2010-09-23 03:24:10 +0000
195+++ lib/lp/registry/templates/productrelease-rdf.pt 2010-10-19 01:17:45 +0000
196@@ -32,8 +32,10 @@
197 </lp:ProductSeries>
198 </lp:inProductSeries>
199 <lp:owner>
200- <lp:specifiedAt tal:attributes="rdf:resource
201- string:${context/owner/fmt:url}/+rdf" />
202+ <foaf:Agent>
203+ <foaf:Account
204+ tal:attributes="rdf:resource string:${context/owner/fmt:url}/+rdf"/>
205+ </foaf:Agent>
206 </lp:owner>
207 </lp:ProductRelease>
208 </rdf:RDF>
209
210=== modified file 'lib/lp/registry/templates/project-rdf.pt'
211--- lib/lp/registry/templates/project-rdf.pt 2010-09-23 03:24:10 +0000
212+++ lib/lp/registry/templates/project-rdf.pt 2010-10-19 01:17:45 +0000
213@@ -42,8 +42,10 @@
214 </lp:Product>
215 </lp:product>
216 <lp:owner>
217- <lp:specifiedAt tal:attributes="rdf:resource
218- string:${context/owner/fmt:url}/+rdf" />
219+ <foaf:Agent>
220+ <foaf:Account
221+ tal:attributes="rdf:resource string:${context/owner/fmt:url}/+rdf"/>
222+ </foaf:Agent>
223 </lp:owner>
224 <lp:status tal:condition="context/active">Active</lp:status>
225 <lp:status tal:condition="not:context/active">Inactive</lp:status>