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

Proposed by Curtis Hovey
Status: Merged
Approved by: Leonard Richardson
Approved revision: no longer in the source branch.
Merged at revision: 11651
Proposed branch: lp:~sinzui/launchpad/rdf-links-1
Merge into: lp:launchpad
Diff against target: 205 lines (+80/-24)
8 files modified
lib/canonical/launchpad/browser/launchpad.py (+0/-6)
lib/canonical/launchpad/configure.zcml (+0/-13)
lib/lp/registry/browser/__init__.py (+18/-1)
lib/lp/registry/browser/configure.zcml (+17/-0)
lib/lp/registry/browser/tests/test_rdf.py (+35/-0)
lib/lp/registry/rdfspec/launchpad.owl (+1/-1)
lib/lp/registry/templates/rdf-index.pt (+6/-3)
lib/lp/services/mime.py (+3/-0)
To merge this branch: bzr merge lp:~sinzui/launchpad/rdf-links-1
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Approve
Review via email: mp+36865@code.launchpad.net

Description of the change

This is my branch to fix the /rdf explanation and OWL.

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

Fix the /rdf explanation and OWL
---------------------------------

/rdf states Launchpad provides exports of project metadata. This is not
exactly true. Launchpad provides RDF description of projects and people.

The link the the OWL was broken in 2006.

Rules
-----

    * Moved the view, template, and OWL to lp.registry.
    * Add an ExportedFolder to support the OWL file.
    * Revised the description of Launchpad's RDF.

QA
--

    * Visit https://edge.launchpad.net/rdf
    * Verify the page explains what has RDF and how it can be retrieved.
    * Follow the link to the OWL file.
    * Verify the file downloads (or displays in your browser if it supports
      application/rdf+xml)

Lint
----

Linting changed files:
  lib/canonical/launchpad/configure.zcml
  lib/canonical/launchpad/browser/launchpad.py
  lib/lp/registry/browser/__init__.py
  lib/lp/registry/browser/configure.zcml
  lib/lp/registry/browser/tests/test_rdf.py
  lib/lp/registry/rdfspec/launchpad.owl
  lib/lp/registry/templates/rdf-index.pt
  lib/lp/services/mime.py

Test
----

Added a test to verify the view and the OWL file.
    * lib/lp/registry/browser/tests/test_rdf.py

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

Moved the RDFIndexView to lp.registry and define RDFFolder to replace the
broken resourceDirectory.
    * lib/canonical/launchpad/configure.zcml
    * lib/canonical/launchpad/browser/launchpad.py
    * lib/lp/registry/browser/configure.zcml
    * lib/lp/registry/browser/__init__.py

Revised the namespace to match the exported folder and added mimetype
support for OWL.
    * lib/lp/registry/rdfspec/launchpad.owl
    * lib/lp/services/mime.py

Revised the text of the page.
    * lib/lp/registry/templates/rdf-index.pt

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py 2010-09-24 00:45:05 +0000
+++ lib/canonical/launchpad/browser/launchpad.py 2010-09-28 19:22:43 +0000
@@ -17,7 +17,6 @@
17 'LoginStatus',17 'LoginStatus',
18 'MaintenanceMessage',18 'MaintenanceMessage',
19 'NavigationMenuTabs',19 'NavigationMenuTabs',
20 'RDFIndexView',
21 'SoftTimeoutView',20 'SoftTimeoutView',
22 'get_launchpad_views',21 'get_launchpad_views',
23 ]22 ]
@@ -927,8 +926,3 @@
927926
928 def __call__(self):927 def __call__(self):
929 raise NotFound(self.context, self.__name__)928 raise NotFound(self.context, self.__name__)
930
931
932class RDFIndexView(LaunchpadView):
933 """View for /rdf page."""
934 page_title = label = "Launchpad RDF"
935929
=== modified file 'lib/canonical/launchpad/configure.zcml'
--- lib/canonical/launchpad/configure.zcml 2010-09-12 15:15:16 +0000
+++ lib/canonical/launchpad/configure.zcml 2010-09-28 19:22:43 +0000
@@ -75,19 +75,6 @@
75 parent_utility="canonical.launchpad.interfaces.ILaunchpadRoot"75 parent_utility="canonical.launchpad.interfaces.ILaunchpadRoot"
76 />76 />
7777
78 <!-- RDF downloadable documents -->
79 <browser:page
80 for="canonical.launchpad.interfaces.ILaunchpadRoot"
81 class="canonical.launchpad.browser.launchpad.RDFIndexView"
82 name="rdf"
83 template="templates/rdf-index.pt"
84 permission="zope.Public"
85 />
86
87 <browser:resourceDirectory
88 name="rdf"
89 directory="rdfspec" />
90
91 <i18n:registerTranslations directory="locales" />78 <i18n:registerTranslations directory="locales" />
9279
93 <browser:navigation80 <browser:navigation
9481
=== modified file 'lib/lp/registry/browser/__init__.py'
--- lib/lp/registry/browser/__init__.py 2010-09-23 16:15:34 +0000
+++ lib/lp/registry/browser/__init__.py 2010-09-28 19:22:43 +0000
@@ -9,6 +9,7 @@
9 'BaseRdfView',9 'BaseRdfView',
10 'get_status_counts',10 'get_status_counts',
11 'MilestoneOverlayMixin',11 'MilestoneOverlayMixin',
12 'RDFIndexView',
12 'RegistryEditFormView',13 'RegistryEditFormView',
13 'RegistryDeleteViewMixin',14 'RegistryDeleteViewMixin',
14 'StatusCount',15 'StatusCount',
@@ -16,6 +17,7 @@
1617
1718
18from operator import attrgetter19from operator import attrgetter
20import os
1921
20from storm.store import Store22from storm.store import Store
21from zope.component import getUtility23from zope.component import getUtility
@@ -25,7 +27,11 @@
25 action,27 action,
26 LaunchpadEditFormView,28 LaunchpadEditFormView,
27 )29 )
28from canonical.launchpad.webapp.publisher import canonical_url30from canonical.launchpad.webapp.publisher import (
31 canonical_url,
32 LaunchpadView,
33 )
34from canonical.lazr import ExportedFolder
29from lp.bugs.interfaces.bugtask import (35from lp.bugs.interfaces.bugtask import (
30 BugTaskSearchParams,36 BugTaskSearchParams,
31 IBugTaskSet,37 IBugTaskSet,
@@ -284,3 +290,14 @@
284 unicodedata = self.template()290 unicodedata = self.template()
285 encodeddata = unicodedata.encode('utf-8')291 encodeddata = unicodedata.encode('utf-8')
286 return encodeddata292 return encodeddata
293
294
295class RDFIndexView(LaunchpadView):
296 """View for /rdf page."""
297 page_title = label = "Launchpad RDF"
298
299
300class RDFFolder(ExportedFolder):
301 """Export the Launchpad RDF schemas."""
302 folder = os.path.join(
303 os.path.dirname(os.path.realpath(__file__)), '../rdfspec/')
287304
=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml 2010-09-21 03:30:43 +0000
+++ lib/lp/registry/browser/configure.zcml 2010-09-28 19:22:43 +0000
@@ -8,6 +8,23 @@
8 xmlns:i18n="http://namespaces.zope.org/i18n"8 xmlns:i18n="http://namespaces.zope.org/i18n"
9 xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"9 xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
10 i18n_domain="launchpad">10 i18n_domain="launchpad">
11 <!-- RDF downloadable documents -->
12 <browser:page
13 for="canonical.launchpad.interfaces.ILaunchpadRoot"
14 class="lp.registry.browser.RDFIndexView"
15 name="rdf"
16 template="../templates/rdf-index.pt"
17 permission="zope.Public"
18 />
19
20 <browser:page
21 for="canonical.launchpad.webapp.interfaces.ILaunchpadApplication"
22 name="rdf-spec"
23 class="lp.registry.browser.RDFFolder"
24 attribute="__call__"
25 permission="zope.Public"
26 />
27
11 <browser:page28 <browser:page
12 for="lp.registry.interfaces.product.IProduct"29 for="lp.registry.interfaces.product.IProduct"
13 name="+voucher-purchase-instructions"30 name="+voucher-purchase-instructions"
1431
=== added file 'lib/lp/registry/browser/tests/test_rdf.py'
--- lib/lp/registry/browser/tests/test_rdf.py 1970-01-01 00:00:00 +0000
+++ lib/lp/registry/browser/tests/test_rdf.py 2010-09-28 19:22:43 +0000
@@ -0,0 +1,35 @@
1# Copyright 2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4"""Tests for RDF main views."""
5
6__metaclass__ = type
7
8from zope.component import getUtility
9from canonical.launchpad.webapp.interfaces import (
10 ILaunchpadApplication,
11 ILaunchpadRoot,
12 )
13from canonical.testing.layers import DatabaseFunctionalLayer
14from lp.testing import TestCaseWithFactory
15from lp.testing.views import create_view
16
17
18class TestRootRDF(TestCaseWithFactory):
19
20 layer = DatabaseFunctionalLayer
21
22 def test_root_rdf(self):
23 root = getUtility(ILaunchpadRoot)
24 view = create_view(root, name='rdf')
25 self.assertEqual('Launchpad RDF', view.page_title)
26
27 def test_launchpad_owl(self):
28 app = getUtility(ILaunchpadApplication)
29 view = create_view(app, name='rdf-spec')
30 owl = view.publishTraverse(view.request, 'launchpad.owl')
31 entity = 'ENTITY launchpad "https://launchpad.net/rdf-spec/launchpad#'
32 self.assertTrue(entity in owl())
33 self.assertEqual(
34 'application/rdf+xml',
35 owl.request.response.getHeader('content-type'))
036
=== renamed directory 'lib/canonical/launchpad/rdfspec' => 'lib/lp/registry/rdfspec'
=== modified file 'lib/lp/registry/rdfspec/launchpad.owl'
--- lib/canonical/launchpad/rdfspec/launchpad.owl 2009-06-30 21:06:27 +0000
+++ lib/lp/registry/rdfspec/launchpad.owl 2010-09-28 19:22:43 +0000
@@ -5,7 +5,7 @@
5<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">5<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
6<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">6<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
7<!ENTITY owl "http://www.w3.org/2002/07/owl#">7<!ENTITY owl "http://www.w3.org/2002/07/owl#">
8<!ENTITY launchpad "https://launchpad.net/rdf/launchpad#">8<!ENTITY launchpad "https://launchpad.net/rdf-spec/launchpad#">
9<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">9<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
10<!ENTITY doaml "http://ns.balbinus.net/doaml#">10<!ENTITY doaml "http://ns.balbinus.net/doaml#">
11]>11]>
1212
=== renamed file 'lib/canonical/launchpad/templates/rdf-index.pt' => 'lib/lp/registry/templates/rdf-index.pt'
--- lib/canonical/launchpad/templates/rdf-index.pt 2009-09-18 14:12:06 +0000
+++ lib/lp/registry/templates/rdf-index.pt 2010-09-28 19:22:43 +0000
@@ -11,9 +11,12 @@
11<div metal:fill-slot="main">11<div metal:fill-slot="main">
12 <p>12 <p>
13 Launchpad provides <abbr title="Resource Description Framework">RDF</abbr>13 Launchpad provides <abbr title="Resource Description Framework">RDF</abbr>
14 exports of project, project, branch, and release metadata,14 descriptions of project groups, projects, series, releases, users, and
15 using <a href="/@@/rdf/launchpad.owl">an ontology defined in15 teams using <a href="/rdf-spec/launchpad.owl">an ontology defined in
16 <abbr title="Web Ontology Language">OWL</abbr></a>.16 <abbr title="Web Ontology Language">OWL</abbr></a>. Links to download
17 the RDF metadata are located on each resource's main page, except
18 for users and teams. All resources that have an RDF description provide
19 a meta link to the data in the page's head content.
17 </p>20 </p>
18</div>21</div>
1922
2023
=== modified file 'lib/lp/services/mime.py'
--- lib/lp/services/mime.py 2010-04-28 20:18:48 +0000
+++ lib/lp/services/mime.py 2010-09-28 19:22:43 +0000
@@ -32,3 +32,6 @@
32 # of type text/x-diff inline, so making this text/plain because32 # of type text/x-diff inline, so making this text/plain because
33 # viewing .debdiff inline is the most common use-case.33 # viewing .debdiff inline is the most common use-case.
34 mimetypes.add_type('text/plain', '.debdiff')34 mimetypes.add_type('text/plain', '.debdiff')
35
36 # Add support for Launchpad's OWL decription of its RDF metadata.
37 mimetypes.add_type('application/rdf+xml', '.owl')