Make a Really Basic Catalog Service for the Web (CSW)
Easy Catalogue Services for the Web
Adapted from chapter 10: HTTP protocol binding of the OpenGIS® Catalogue Services Specification version 2.0.2
- only mandatory requirements are discussed
- only HTTP key-value-pair (KVP) requests are discussed (no XML POST or SOAP requests)
The interaction between a client and a server is accomplished using a standard request-response model of the HTTP protocol. That is, a client sends a request to a server using HTTP, and expects to receive a response to the request or an exception message. Request and response messages are encoded as keyword-value pairs within a request URI or using an XML entity-body. Optionally, requests may also be embedded in a messaging framework such as SOAP.
Basic CSW in a nutshell
CSW gives you overwhelming flexibility in how you return information. However, all you really MUST do is:
- support querying on the "core queryables", and
- return catalog records in a simple XML format we call csw:Record
The core queryables and csw:Record map directly to the 15 "classic" Dublin Core metadata terms, so the catalog in its basic form is pretty simple, and highly compatible with the most prevalent metadata standard in existence.
|OGC queryable term||Dublin Core element name||XML element name|
The rest of this document describes how to present this information in XML, and how to query it using CSW's primary query language. Other than that, the only thing to do is handle standard OGC service operations like GetCapabilities.
The Catalog Record
The heart and soul of the catalog is its representation of a catalog entry. In CSW this is called a record. The XML schema for a csw:Record is here. Notice that this schema is based on the XML schemas developed for the Dublin Core Metadata Initiative with the addition of the csw:AnyText and ows:BoundingBox elements.
csw:AnyText is a tricky element. CSW says that all elements in csw:Record MUST be available to be queried on, except csw:AnyText. This element is sort of an invisible placeholder for telling the catalog to do a full-text search of it's records. csw:AnyText SHOULD NEVER appear in a response message.
The ows:BoundingBox element, of course, is used to express the spatial extent of the record.
csw:Record contains the 10 CSW "core queryables", or which dc:identifier and dc:title are the only mandatory ones. Here is an example.
The brief view, csw:BriefRecord, consists only of dc:identifier, dc:title, dc:type, and ows:BoundingBox. Once again, only dc:identifier and dc:title are mandatory. Here is an example.
GetRecords operation (querying the catalog!)
The below example queries the catalog using a search for any occurence of the string 'pollution' in any field. The service, version, and request parameters are standard for an OGC service. The parameters that make this a catalog search are constraintlanguage, which says the query will be written in CQL, and constraint, which is the query (expressed in CQL).
&constraintlanguage=CQLTEXT&constraint="csw:AnyText Like '%pollution%'"
Since we're using all the defaults from CSW, we know that we'll be returning csw:SummaryRecords (wrapped in a little extra CSW response XML). Therefore, we know we could have specified any of the 10 core queryables above for our search. The below example limits the query to the title and subject fields.
&constraintlanguage=CQLTEXT&constraint="dc:title OR dc:subject LIKE '%pollution%'"
This operation is a subset of the GetRecords operation, and is included as a convenient short form for retrieving and linking to records in a catalogue. The key parameter is Id, which is a comma-separated list of anyURI, allowing you to request more than one record from the catalog.
This response will always be XML conforming to csw:SummaryRecord of MIME type application/xml.
The easiest way to implement the GetCapabilities operation is to create an XML file in a text editor that has all the required information. Here's an example of a basic capabilities document. The idea is to list contact information, and describe the operations the catalog supports, and what URLs to use to access those operations. You can also describe advanced query capabilities in the <ogc:Filter_Capabilities> section.
The mandatory DescribeRecord operation allows a client to discover elements of the information model supported by the target catalogue service. The operation allows some or all of the information model to be described. In this most basic CSW, that only supports csw:Record, the request and response to DescribeRecord are always the same:
|Sample CSW Capabilities document||6.38 KB|