[GeoNetwork-users] CQL in CSW GET requests (GN 2.6.3) - repost

I'm trying to figure out the syntax for various CSW GET requests that use CQL, for equivalent working CSW POST requests, but I seem to be going around in circles. I've seen posted on this list some similar questions relating to CSW GET requests, but none appear to have been fully answered.

The issue I have is how I write my CQL constraint, I seem to always get all the metadata records returned (or found), rather than the subset I want.

For example:

POST (to http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?)

<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
    xmlns:apiso="http://www.opengis.net/cat/csw/apiso/1.0&quot;
    xmlns:ogc="http://www.opengis.net/ogc&quot;
    xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW"
    resultType="results"
    outputFormat="application/xml"
    outputSchema="http://www.isotc211.org/2005/gmd&quot;
    startPosition="1" maxRecords="10">
    <csw:Query typeNames="gmd:MD_Metadata">
        <csw:ElementSetName typeNames="gmd:MD_Metadata">brief</csw:ElementSetName>
        <csw:Constraint version="1.1.0">
            <Filter xmlns="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <PropertyIsLike wildCard="%" singleChar="?" escapeChar="\">
                    <PropertyName>AnyText</PropertyName>
                    <Literal>%NERC_DDC%</Literal>
                </PropertyIsLike>
            </Filter>
        </csw:Constraint>
    </csw:Query>
</csw:GetRecords>

Matches 321 results (and returns the first 10)

GET

I've tried this (which I assumed was equivalent):

<a href="http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint="AnyText%20Like%20%NERC\_DDC%"&amp;&quot;&gt;http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint="AnyText%20Like%20%NERC\_DDC%"&amp;

But it matches 331 results.

I've tried several variants (as below)

&constraint=%22AnyText%20Like%20%25%NERC_DDC%%25%22 also matches 331 results.

&constraint=%22AnyText%20Like%20%25NERC_DDC%25%22 fails, as does

&constraint=%22AnyText%20Like%20NERC_DDC%22

prefixing csw: in front of AnyText doesn't seem to make any difference.

I was wondering whether the AnyText property wasn't supported so I've tried another query.

POST

<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
xmlns:apiso="http://www.opengis.net/cat/csw/apiso/1.0&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gmd="http://www.isotc211.org/2005/gmd&quot;
service="CSW" resultType="results"
outputFormat="application/xml"
outputSchema="http://www.isotc211.org/2005/gmd&quot;
startPosition="1" maxRecords="10">
<csw:Query typeNames="gmd:MD_Metadata">
<csw:ElementSetName
typeNames="gmd:MD_Metadata">brief</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>apiso:ServiceType</ogc:PropertyName>
<ogc:Literal>view</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

Matches 7 records.

GET

http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraints="apiso:ServiceType=view"&

Matches 331 records. :frowning:

Have I got the syntax wrong? (if so what schoolboy error have I made)

thanks

James

--
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.

Hi James,

Try :
http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint=AnyText%20Like%20’NERC_DDC’&
or
http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint=AnyText%20Like%20’%26NERC_DDC%26’&

% is not so useful for anyText (ie. full text) which is an anlayzed
(including tokenizing) field when indexed.

The second option does not seems to work on your node, it's working
here locally on trunk. Check your log file for any encoding error
maybe ?

HTH.

Francois

2011/5/3 Passmore, James H. <jpass@anonymised.com>:

I'm trying to figure out the syntax for various CSW GET requests that use CQL, for equivalent working CSW POST requests, but I seem to be going around in circles. I've seen posted on this list some similar questions relating to CSW GET requests, but none appear to have been fully answered.

The issue I have is how I write my CQL constraint, I seem to always get all the metadata records returned (or found), rather than the subset I want.

For example:

POST (to http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?)

<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
xmlns:apiso="http://www.opengis.net/cat/csw/apiso/1.0&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW"
resultType="results"
outputFormat="application/xml"
outputSchema="http://www.isotc211.org/2005/gmd&quot;
startPosition="1" maxRecords="10">
<csw:Query typeNames="gmd:MD_Metadata">
<csw:ElementSetName typeNames="gmd:MD_Metadata">brief</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<PropertyIsLike wildCard="%" singleChar="?" escapeChar="\">
<PropertyName>AnyText</PropertyName>
<Literal>%NERC_DDC%</Literal>
</PropertyIsLike>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

Matches 321 results (and returns the first 10)

GET

I've tried this (which I assumed was equivalent):

<a href="http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint="AnyText%20Like%20%NERC\_DDC%"&amp;&quot;&gt;http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraint="AnyText%20Like%20%NERC\_DDC%"&amp;

But it matches 331 results.

I've tried several variants (as below)

&constraint=%22AnyText%20Like%20%25%NERC_DDC%%25%22 also matches 331 results.

&constraint=%22AnyText%20Like%20%25NERC_DDC%25%22 fails, as does

&constraint=%22AnyText%20Like%20NERC_DDC%22

prefixing csw: in front of AnyText doesn't seem to make any difference.

I was wondering whether the AnyText property wasn't supported so I've tried another query.

POST

<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
xmlns:apiso="http://www.opengis.net/cat/csw/apiso/1.0&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gmd="http://www.isotc211.org/2005/gmd&quot;
service="CSW" resultType="results"
outputFormat="application/xml"
outputSchema="http://www.isotc211.org/2005/gmd&quot;
startPosition="1" maxRecords="10">
<csw:Query typeNames="gmd:MD_Metadata">
<csw:ElementSetName
typeNames="gmd:MD_Metadata">brief</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>apiso:ServiceType</ogc:PropertyName>
<ogc:Literal>view</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

Matches 7 records.

GET

http://ogcdev.bgs.ac.uk/geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&STARTPOSITION=1&MAXRECORDS=10&REQUEST=GetRecords&RESULTTYPE=results&OUTPUTFORMAT=application/xml&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&TYPENAMES=gmd:MD_Metadata&ELEMENTSETNAME=brief&CONSTRAINT_LANGUAGE_VERSION=1.1.0&CONSTRAINTLANGUAGE=CQL_TEXT&NAMESPACE=xmlns(ogc=http://www.opengis.net/ogc),xmlns(gml=http://www.opengis.net/gml),xmlns(apiso=http://www.opengis.net/cat/csw/apiso/1.0),xmlns(csw=http://www.opengis.net/cat/csw/2.0.2)&constraints="apiso:ServiceType=view"&

Matches 331 records. :frowning:

Have I got the syntax wrong? (if so what schoolboy error have I made)

thanks

James

--
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork