Sample CSW requests

Queryable properties

In the context of CSW, there's a set of predefined queryable properties that you can search against. Those properties might not form actual part of the CSW information model, yet they're mandated to be respected by the specification in order for a CSW client not to require having any knowledge of what the information model(s) a CSW service works upon before being able to perform some useful searches.

The list of supported queryable properties is available as part of the GetRecords operation metadata in the Capabilities document, such as:

    .....
    <ows:Operation name="GetRecords">
      .....
      <ows:Constraint name="SupportedISOQueryables">
        <ows:Value>Operation</ows:Value>
        <ows:Value>Format</ows:Value>
        <ows:Value>OrganisationName</ows:Value>
        <ows:Value>Type</ows:Value>
        <ows:Value>Abstract</ows:Value>
        .....
      </ows:Constraint>
      <ows:Constraint name="AdditionalQueryables">
        <ows:Value>SpecificationDate</ows:Value>
        <ows:Value>ConditionApplyingToAccessAndUse</ows:Value>
        .....
      </ows:Constraint>
    </ows:Operation>

Now, the question is, how these queryable properties map to ISO 19139 records?

Well, it's a two step process. First the Queryables are mapped to Lucene searchable fields by the [config-csw.xml] file, then the Lucene searchable fields are mapped to ISO 19139 elements through the  index-fields.xsl file.

So, the translated mapping from "predefined queryable properties" to 19139 fields is as follow:

  • AnyText: Any property of type gco:CharacterString (didn't check if geonetwork actually does that but I think it only matches against the Lucene indexed properties defined bellow).

SupportedISOQueryables:

QueryableLucene fieldISO 19139 mapping
Abstract abstract gmd:abstract/gco:CharacterString
AlternateTitle altTitle gmd:alternateTitle/gco:CharacterString
CouplingType couplingType //srv:SV_CouplingType/srv:code/@codeListValue
CreationDate createDate gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='revision']/gmd:date/gco:Date
Denominator denominator gmd:spatialResolution/gmd:MD_Resolution/gmd:equivalentScale/gmd:MD_RepresentativeFraction/gmd:denominator/gco:Integer
DistanceUOM distanceUom gmd:spatialResolution/gmd:MD_Resolution/gmd:distance/gco:Distance/@uom
DistanceValue distanceVal gmd:spatialResolution/gmd:MD_Resolution/gmd:distance/gco:Distance
Format format gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name/gco:CharacterString
GeographicDescriptionCode geoDescCode */gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicDescription/gmd:geographicIdentifier/gmd:MD_Identifier/gmd:code/gco:CharacterString
HasSecurityConstraints secConstr true iif(exists(||[gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:resourceConstraints/gmd:MD_SecurityConstraints)) (syntax is ™ of mine)
Identifier fileId gmd:fileIdentifier/gco:CharacterString
KeywordType keywordType */gmd:MD_Keywords/gmd:type/gmd:MD_KeywordTypeCode/@codeListValue
Language language gmd:language/gco:CharacterString
Modified changeDate gmd:dateStamp/gco:DateTime
OperatesOn operatesOn srv:operatesOn/@uuidref
OperatesOnIdentifier operatesOnIdentifier srv:coupledResource/srv:coupledResource
OperatesOnName operatesOnName srv:coupledResource/srv:SV_CoupledResource/srv:operationName/gco:CharacterString
Operation operation //srv:SV_OperationMetadata/srv:operationName/gco:CharacterString
OrganisationName orgName [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString
ParentIdentifier parentId gmd:parentIdentifier/gco:CharacterString
PublicationDate publicationDate [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='publication']/gmd:date/gco:Date
ResourceIdentifier identifier [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString
ResourceLanguage datasetLang [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:language/gco:CharacterString
RevisionDate revisionDate [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='revision']/gmd:date/gco:Date
ServiceType serviceType [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/srv:serviceType/gco:LocalName
ServiceTypeVersion serviceTypeVersion [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/srv:serviceTypeVersion/gco:CharacterString
Subject subject */gmd:MD_Keywords/[gmd:keyword/gco:CharacterString|gmd:keyword/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString
TempExtent_begin tempExtentBegin [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/*/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent
TempExtent_end [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/*/gmd:EX_Extent/gml:TimePeriod/gml:endPosition
Title title [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString
TopicCategory topicCat [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:topicCategory/gmd:MD_TopicCategoryCode
Type type gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue || 'dataset' (ie, 'dataset' by default)

AdditionalQueryables:

QueryableLucene fieldISO 19139 mapping
AccessConstraints accessConstr [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]gmd:resourceConstraints//gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue
Classification classif gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]gmd:resourceConstraints//gmd:classification/gmd:MD_ClassificationCode/@codeListValue
ConditionApplyingToAccessAndUse conditionApplyingToAccessAndUse [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]gmd:resourceConstraints//gmd:useLimitation/gco:CharacterString
Degree degree gmd:dataQualityInfo/*/gmd:report/*/gmd:result//gmd:pass/gco:Boolean
Lineage lineage gmd:dataQualityInfo/*/gmd:lineage/*/gmd:statement/gco:CharacterString
MetadataPointOfContact metadataPOC gmd:contact/*/gmd:organisationName/gco:CharacterString
OtherConstraints otherConstr [gmd:identificationInfo//gmd:MD_DataIdentification|gmd:identificationInfo/srv:SV_ServiceIdentification]/gmd:resourceConstraints//gmd:otherConstraints/gco:CharacterString
SpecificationDate specificationDate gmd:dataQualityInfo/*/gmd:report/*/gmd:result//gmd:specification/*/gmd:date/*/gmd:date/gco:DateTime
SpecificationDateType specificationDateType gmd:dataQualityInfo/*/gmd:report/*/gmd:result//gmd:specification/*/gmd:date/*/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue
SpecificationTitle specificationTitle gmd:dataQualityInfo/*/gmd:report/*/gmd:result//gmd:specification/*/gmd:title/gco:CharacterString

Querying by XPATH

Unfortunately, GeoNetwork does not support addressing an attribute by XPATH in a GetRecords query. Meaning we're limited to the abstract queryables defined above, and possibly the ability to add custom ones if we need to. This is sad bye one hand because XPATH support (which is optional in the spec) would give us all the query flexibility we could ever need; but by the other hand I kind of like the separation of concerns between the internal data model (well, the native metadata model, as GN has no internal object model at all), and the queryable properties.

GetCapabilities

The simplest: GetCapabilities

GetRecordById

Retrieves one or more metadata record given their fileIdentifier.

Check the samples at GetRecordById

Searches

Searching a CSW catalog is to be made through the GetRecords operation.

Transactions

The Transaction operation, unlike GetRecords and GetRecordById, can only be performed using HTTP POST method, and is composed of a single XML document defining the transaction. The document's body, being either for an Insert, Update or Delete operation is made of a Transaction root element and a nested Insert, Update, or Delete element. The response for a successful request is always an xml document stating the number of records affected by the operation.

Transaction Insert

Transaction Update

Transaction Delete

GeoNetwork Transactions in Python

See GN_Transactions_in_python


back to CSW_client_implementation_guidelines