launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01269
[Merge] lp:~sinzui/launchpad/rdf-links-1 into lp:launchpad/devel
Curtis Hovey has proposed merging lp:~sinzui/launchpad/rdf-links-1 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#6405 /rdf page doesn't provide access to RDF exports
https://bugs.launchpad.net/bugs/6405
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
--
https://code.launchpad.net/~sinzui/launchpad/rdf-links-1/+merge/36865
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/rdf-links-1 into lp:launchpad/devel.
=== 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 13:58:07 +0000
@@ -17,7 +17,6 @@
'LoginStatus',
'MaintenanceMessage',
'NavigationMenuTabs',
- 'RDFIndexView',
'SoftTimeoutView',
'get_launchpad_views',
]
@@ -927,8 +926,3 @@
def __call__(self):
raise NotFound(self.context, self.__name__)
-
-
-class RDFIndexView(LaunchpadView):
- """View for /rdf page."""
- page_title = label = "Launchpad RDF"
=== 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 13:58:07 +0000
@@ -75,19 +75,6 @@
parent_utility="canonical.launchpad.interfaces.ILaunchpadRoot"
/>
- <!-- RDF downloadable documents -->
- <browser:page
- for="canonical.launchpad.interfaces.ILaunchpadRoot"
- class="canonical.launchpad.browser.launchpad.RDFIndexView"
- name="rdf"
- template="templates/rdf-index.pt"
- permission="zope.Public"
- />
-
- <browser:resourceDirectory
- name="rdf"
- directory="rdfspec" />
-
<i18n:registerTranslations directory="locales" />
<browser:navigation
=== 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 13:58:07 +0000
@@ -9,6 +9,7 @@
'BaseRdfView',
'get_status_counts',
'MilestoneOverlayMixin',
+ 'RDFIndexView',
'RegistryEditFormView',
'RegistryDeleteViewMixin',
'StatusCount',
@@ -16,6 +17,7 @@
from operator import attrgetter
+import os
from storm.store import Store
from zope.component import getUtility
@@ -25,7 +27,11 @@
action,
LaunchpadEditFormView,
)
-from canonical.launchpad.webapp.publisher import canonical_url
+from canonical.launchpad.webapp.publisher import (
+ canonical_url,
+ LaunchpadView,
+ )
+from canonical.lazr import ExportedFolder
from lp.bugs.interfaces.bugtask import (
BugTaskSearchParams,
IBugTaskSet,
@@ -284,3 +290,14 @@
unicodedata = self.template()
encodeddata = unicodedata.encode('utf-8')
return encodeddata
+
+
+class RDFIndexView(LaunchpadView):
+ """View for /rdf page."""
+ page_title = label = "Launchpad RDF"
+
+
+class RDFFolder(ExportedFolder):
+ """Export the Launchpad RDF schemas."""
+ folder = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), '../rdfspec/')
=== 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 13:58:07 +0000
@@ -8,6 +8,23 @@
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
i18n_domain="launchpad">
+ <!-- RDF downloadable documents -->
+ <browser:page
+ for="canonical.launchpad.interfaces.ILaunchpadRoot"
+ class="lp.registry.browser.RDFIndexView"
+ name="rdf"
+ template="../templates/rdf-index.pt"
+ permission="zope.Public"
+ />
+
+ <browser:page
+ for="canonical.launchpad.webapp.interfaces.ILaunchpadApplication"
+ name="rdf-spec"
+ class="lp.registry.browser.RDFFolder"
+ attribute="__call__"
+ permission="zope.Public"
+ />
+
<browser:page
for="lp.registry.interfaces.product.IProduct"
name="+voucher-purchase-instructions"
=== 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 13:58:07 +0000
@@ -0,0 +1,35 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests for RDF main views."""
+
+__metaclass__ = type
+
+from zope.component import getUtility
+from canonical.launchpad.webapp.interfaces import (
+ ILaunchpadApplication,
+ ILaunchpadRoot,
+ )
+from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.testing import TestCaseWithFactory
+from lp.testing.views import create_view
+
+
+class TestRootRDF(TestCaseWithFactory):
+
+ layer = DatabaseFunctionalLayer
+
+ def test_root_rdf(self):
+ root = getUtility(ILaunchpadRoot)
+ view = create_view(root, name='rdf')
+ self.assertEqual('Launchpad RDF', view.page_title)
+
+ def test_launchpad_owl(self):
+ app = getUtility(ILaunchpadApplication)
+ view = create_view(app, name='rdf-spec')
+ owl = view.publishTraverse(view.request, 'launchpad.owl')
+ entity = 'ENTITY launchpad "https://launchpad.net/rdf-spec/launchpad#'
+ self.assertTrue(entity in owl())
+ self.assertEqual(
+ 'application/rdf+xml',
+ owl.request.response.getHeader('content-type'))
=== 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 13:58:07 +0000
@@ -5,7 +5,7 @@
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
-<!ENTITY launchpad "https://launchpad.net/rdf/launchpad#">
+<!ENTITY launchpad "https://launchpad.net/rdf-spec/launchpad#">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
<!ENTITY doaml "http://ns.balbinus.net/doaml#">
]>
=== 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 13:58:07 +0000
@@ -11,9 +11,12 @@
<div metal:fill-slot="main">
<p>
Launchpad provides <abbr title="Resource Description Framework">RDF</abbr>
- exports of project, project, branch, and release metadata,
- using <a href="/@@/rdf/launchpad.owl">an ontology defined in
- <abbr title="Web Ontology Language">OWL</abbr></a>.
+ descriptions of project groups, projects, series, releases, users, and
+ teams using <a href="/rdf-spec/launchpad.owl">an ontology defined in
+ <abbr title="Web Ontology Language">OWL</abbr></a>. Links to download
+ the RDF metadata are located on each resource's main page, except
+ for users and teams. All resources that have an RDF description provide
+ a meta link to the data in the page's head content.
</p>
</div>
=== 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 13:58:07 +0000
@@ -32,3 +32,6 @@
# of type text/x-diff inline, so making this text/plain because
# viewing .debdiff inline is the most common use-case.
mimetypes.add_type('text/plain', '.debdiff')
+
+ # Add support for Launchpad's OWL decription of it's RDF metadata.
+ mimetypes.add_type('application/rdf+xml', '.owl')
Follow ups