pycsw Home | Documentation | Issue Tracker | FAQ | Download

Profile Plugins

Overview

pycsw allows for the implementation of profiles to the core standard. Profiles allow specification of additional metadata format types (i.e. ISO 19139:2007, NASA DIF, INSPIRE, etc.) to the repository, which can be queried and presented to the client. pycsw supports a plugin architecture which allows for runtime loading of Python code.

All profiles must be placed in the server/profiles directory.

Requirements

pycsw/
 server/
   profile.py # defines abstract profile object (properties and methods) and functions to load plugins
   profiles/ # directory to store profiles
     __init__.py # empty
     apiso/ # profile directory
       apiso.py # profile code
       ... # supporting files, etc.

Abstract Base Class Definition

All profile code must be instantiated as a subclass of profile.Profile. For example:

from server import profile

class FooProfile(profile.Profile):
    profile.Profile.__init__(self, 'foo', '1.0.0', 'My Profile', 'http://example.org/', 'http://example.org/foons', 'foo:TypeName', 'http://example.org/foons')

Your profile plugin class (FooProfile) must implement all methods as per profile.Profile. Profile methods must always return lxml.etree.Element types, or None.

Enabling Profiles

All profiles are disabled by default. To specify profiles at runtime, set the server.profiles value in the Configuration to the name of the package (in the server/profiles directory). To enable multiple profiles, specify as a comma separated value. See Configuration for more information.

Testing

Profiles must provide a tester interface (similar to tester/index.html), which must provide example requests specific to the profile. See Tester for more information.

Supported Profiles

ISO Metadata Application Profile (1.0.0)

Overview

The ISO Metadata Application Profile (APISO) is a profile of CSW 2.0.2 which enables discovery of geospatial metadata following ISO 19139:2007 and ISO 19119:2005/PDAM 1.

Configuration

To expose your geospatial metadata via the APISO, via pycsw, perform the following actions:

  • enable APISO support
  • setup the database
  • import metadata
  • configure the db connection

Enabling APISO Support

By default, all profiles in pycsw are disabled. To enable APISO, set [server.profiles]=apiso in default.cfg.

Setting up the Database

$ cd /path/to/pycsw
$ export PYTHONPATH=`pwd`
$ python ./sbin/setup_db.py ./server/profiles/apiso/etc/schemas/sql/md_metadata.ddl md_metadata.db

Importing Metadata

$ python ./server/profiles/apiso/sbin/load_csw_records.py /path/to/records md_metadata.db

This will import all *.xml records from /path/to/records into md_metadata.db.

Configuring the Database Connection

By default, server/profiles/apiso/apiso.cfg-shipped contains all required binding information. If you are setting up your database as per above, the default configuration needs only the repository.db value to be updated. Otherwise, you can map your own database table and columns.

Testing

A testing interface is available in server/profiles/apiso/tester/index.html which contains tests specific to APISO to demonstrate functionality. See Tester for more information.