4250: Geonetwork Resolver upgrade: it must return only "private" Metadata Ids for CKAN harversting

Task-Url: https://support.d4science.org/issues/4250

Ultimated.. another todo remains

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@129150 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-06-16 16:12:05 +00:00
parent c5bab68908
commit 654bfe3cfd
8 changed files with 618 additions and 290 deletions

View File

@ -1,230 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<csw:SearchStatus timestamp="2016-06-16T10:46:04" />
<csw:SearchResults numberOfRecordsMatched="1359" numberOfRecordsReturned="10" elementSet="summary" nextRecord="11">
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-heg</dc:identifier>
<dc:title>FAO aquatic species distribution map of Heterodontus galeatus</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>276695</dc:subject>
<dc:subject>Heterodontus galeatus</dc:subject>
<dc:subject>HEG</dc:subject>
<dc:subject>Crested bullhead shark</dc:subject>
<dc:subject>Heterodontus galeatus</dc:subject>
<dc:subject>Heterodontidae</dc:subject>
<dc:subject>HETERODONTIFORMES</dc:subject>
<dc:subject>12656</dc:subject>
<dc:subject>fao-species-map-heg</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/eb7d98c4c597b05ce18ce35345af2eedbbc50ef2</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-07</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-hef</dc:identifier>
<dc:title>FAO aquatic species distribution map of Heterodontus francisci</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>276694</dc:subject>
<dc:subject>Heterodontus francisci</dc:subject>
<dc:subject>HEF</dc:subject>
<dc:subject>Horn shark</dc:subject>
<dc:subject>Heterodontus francisci</dc:subject>
<dc:subject>Heterodontidae</dc:subject>
<dc:subject>HETERODONTIFORMES</dc:subject>
<dc:subject>12655</dc:subject>
<dc:subject>fao-species-map-hef</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/a2a9b6439ce74eaf2a28afc6bef57eec6ec950b0</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-07</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-fsa-map-41.1.3</dc:identifier>
<dc:title>Salvador (Division 41.1.3 of FAO Major Area 41)</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>fishery statistical areas</dc:subject>
<dc:subject>Area management/restriction/regulation zones and reporting units</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/415720c1e1813e22dd87f453e20b1fbd4c560207</dc:subject>
<dc:subject>fao-fsa-map-41.1.3</dc:subject>
<dc:subject>41.1.3</dc:subject>
<dc:subject>Salvador (Division 41.1.3 of FAO Major Area 41)</dc:subject>
<dc:subject>DIVISION</dc:subject>
<dc:subject>boundaries</dc:subject>
<dc:relation>fao-fsa-map-41.1</dc:relation>
<dct:modified>2015-10-13</dct:modified>
<dct:abstract>The FAO major fishing areas for statistical purpose are defined by the CWP handbook of fishery statistical standards available at http://www.fao.org/fishery/cwp/handbook/h/en</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-cre</dc:identifier>
<dc:title>FAO aquatic species distribution map of Cancer pagurus</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>2627</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/c3518fda2e3c6765711757a92d24e57408eea429</dc:subject>
<dc:subject>CRE</dc:subject>
<dc:subject>Edible crab</dc:subject>
<dc:subject>Cancer pagurus</dc:subject>
<dc:subject>Cancridae</dc:subject>
<dc:subject>BRACHYURA</dc:subject>
<dc:subject>fao-species-map-cre</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-07</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-fsa-map-41.1.4</dc:identifier>
<dc:title>Nothern Oceanic (Division 41.1.4 of FAO Major Area 41)</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>fishery statistical areas</dc:subject>
<dc:subject>Area management/restriction/regulation zones and reporting units</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/b1d33b4be19ed2dc28e9b53b7087b77ac9821662</dc:subject>
<dc:subject>fao-fsa-map-41.1.4</dc:subject>
<dc:subject>41.1.4</dc:subject>
<dc:subject>Nothern Oceanic (Division 41.1.4 of FAO Major Area 41)</dc:subject>
<dc:subject>DIVISION</dc:subject>
<dc:subject>boundaries</dc:subject>
<dc:relation>fao-fsa-map-41.1</dc:relation>
<dct:modified>2015-10-13</dct:modified>
<dct:abstract>The FAO major fishing areas for statistical purpose are defined by the CWP handbook of fishery statistical standards available at http://www.fao.org/fishery/cwp/handbook/h/en</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-hea</dc:identifier>
<dc:title>FAO aquatic species distribution map of Heterodontus ramalheira</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>217626</dc:subject>
<dc:subject>Heterodontus ramalheira</dc:subject>
<dc:subject>HEA</dc:subject>
<dc:subject>Whitespotted bullhead shark</dc:subject>
<dc:subject>Heterodontus ramalheira</dc:subject>
<dc:subject>Heterodontidae</dc:subject>
<dc:subject>HETERODONTIFORMES</dc:subject>
<dc:subject>12661</dc:subject>
<dc:subject>fao-species-map-hea</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/be06aeb63705419c7b4c0912078337d03dbe708d</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-07</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-crb</dc:identifier>
<dc:title>FAO aquatic species distribution map of Callinectes sapidus</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>2632</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/3fe12b2c0394298dd5338da522bebadadf422326</dc:subject>
<dc:subject>CRB</dc:subject>
<dc:subject>Blue crab</dc:subject>
<dc:subject>Callinectes sapidus</dc:subject>
<dc:subject>Portunidae</dc:subject>
<dc:subject>BRACHYURA</dc:subject>
<dc:subject>fao-species-map-crb</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-07</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-species-map-zbl</dc:identifier>
<dc:title>FAO aquatic species distribution map of Bathothauma lyromma</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>aquatic species distribution</dc:subject>
<dc:subject>Species distribution</dc:subject>
<dc:subject>20437</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/b9e91f69580e800b8d1f7d7ee232e7f0bdbd4b47</dc:subject>
<dc:subject>ZBL</dc:subject>
<dc:subject>Lyre cranch squid</dc:subject>
<dc:subject>Bathothauma lyromma</dc:subject>
<dc:subject>Cranchiidae</dc:subject>
<dc:subject>CEPHALOPODA</dc:subject>
<dc:subject>fao-species-map-zbl</dc:subject>
<dc:subject>biota</dc:subject>
<dc:subject>boundaries</dc:subject>
<dct:modified>2015-10-27</dct:modified>
<dct:abstract>The main sources of information for the species distribution are the habitat description and geographic range contained in the published FAO Catalogues of Species (more details at http://www.fao.org/fishery/fishfinder ). Terms used in the descriptive context of the FAO Catalogues were converted in standard depth, geographic and ecological regions and inserted into a Geographic Information System.</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-fsa-map-41.1.1</dc:identifier>
<dc:title>Amazon (Division 41.1.1 of FAO Major Area 41)</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>fishery statistical areas</dc:subject>
<dc:subject>Area management/restriction/regulation zones and reporting units</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/323ea512949786623dccbcd8320f24a59686a485</dc:subject>
<dc:subject>fao-fsa-map-41.1.1</dc:subject>
<dc:subject>41.1.1</dc:subject>
<dc:subject>Amazon (Division 41.1.1 of FAO Major Area 41)</dc:subject>
<dc:subject>DIVISION</dc:subject>
<dc:subject>boundaries</dc:subject>
<dc:relation>fao-fsa-map-41.1</dc:relation>
<dct:modified>2015-10-13</dct:modified>
<dct:abstract>The FAO major fishing areas for statistical purpose are defined by the CWP handbook of fishery statistical standards available at http://www.fao.org/fishery/cwp/handbook/h/en</dct:abstract>
</csw:SummaryRecord>
<csw:SummaryRecord xmlns:dct="http://purl.org/dc/terms/" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier>fao-fsa-map-41.1.2</dc:identifier>
<dc:title>Natal (Division 41.1.2 of FAO Major Area 41)</dc:title>
<dc:type>dataset</dc:type>
<dc:subject>FAO</dc:subject>
<dc:subject>FIGIS</dc:subject>
<dc:subject>fishery</dc:subject>
<dc:subject>fisheries</dc:subject>
<dc:subject>fishery statistical areas</dc:subject>
<dc:subject>Area management/restriction/regulation zones and reporting units</dc:subject>
<dc:subject>http://www.fao.org/figis/lod/flod/entities/codedentity/ec79700361176dbf80815a9235d71bde3fbc0542</dc:subject>
<dc:subject>fao-fsa-map-41.1.2</dc:subject>
<dc:subject>41.1.2</dc:subject>
<dc:subject>Natal (Division 41.1.2 of FAO Major Area 41)</dc:subject>
<dc:subject>DIVISION</dc:subject>
<dc:subject>boundaries</dc:subject>
<dc:relation>fao-fsa-map-41.1</dc:relation>
<dct:modified>2015-10-13</dct:modified>
<dct:abstract>The FAO major fishing areas for statistical purpose are defined by the CWP handbook of fishery statistical standards available at http://www.fao.org/fishery/cwp/handbook/h/en</dct:abstract>
</csw:SummaryRecord>
</csw:SearchResults>
</csw:GetRecordsResponse>

View File

@ -32,8 +32,6 @@ public class GeonetworkRequestDecoder {
* @throws ServletException the servlet exception
*/
public GeonetworkRequestDecoder(String theServletPath, String queryString) throws ServletException{
logger.debug("is geonetwork request");
String path = theServletPath;
String pathWithoutGN = path.substring(UriResolverRewriteFilter.SERVLET_GEONETWORK.length()+1, path.length());
logger.debug("servlet path without "+UriResolverRewriteFilter.SERVLET_GEONETWORK + " is: " +pathWithoutGN);

View File

@ -64,38 +64,6 @@ public class UriResolverRewriteFilter implements Filter{
//IS A REQUEST FOR GEONETWORK AUTHENTICATION? (CKAN HARVESTING?)
if(isGeonetworkRequest(multiReadRequest.getServletPath())){
/*String path = multiReadRequest.getServletPath();
String pathWithoutGN = path.substring(SERVLET_GEONETWORK.length()+1, path.length());
logger.debug("servlet path without "+SERVLET_GEONETWORK + " is: " +pathWithoutGN);
String[] params = pathWithoutGN.split("/");
if(params[0]==null || params[0].isEmpty()){
logger.error("Scope is null or empty, you must set a valid scope /geonetwork/root_vo_vre");
throw new ServletException("Scope is null or empty, you must set a valid scope /geonetwork/root_vo_vre");
}
String scopeValue = getScope(params[0]);
logger.debug("scope value is: "+scopeValue);
String newURI = SERVLET_GEONETWORK + "?" + GeonetworkResolver.SCOPE + "=" + scopeValue;
if(params.length>1){
String remainPath = "";
// newURI +="&remainPath=";
for (int i = 1; i < params.length; i++) {
String httpGetParam = params[i];
if(httpGetParam!=null && !httpGetParam.isEmpty())
remainPath+="/"+httpGetParam;
}
newURI +="&"+GeonetworkResolver.REMAIN_PATH+"="+remainPath;
}
if(queryString!=null && !queryString.isEmpty())
newURI+="&"+queryString;
logger.debug("forward "+newURI);
//BODY DEBUG
// String readBody = IOUtils.toString(multiReadRequest.getReader());
// logger.debug("Read body request: "+readBody);
multiReadRequest.getRequestDispatcher(newURI).forward(multiReadRequest, response);*/
logger.debug("is geonetwork request");
GeonetworkRequestDecoder grd = new GeonetworkRequestDecoder(multiReadRequest.getServletPath(), queryString);
logger.debug("forward to: "+grd.getNewURI());

View File

@ -76,4 +76,16 @@ public class FilterGetRecords {
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FilterGetRecords [foundPublicIds=");
builder.append(foundPublicIds);
builder.append("]");
return builder.toString();
}
}

View File

@ -338,11 +338,14 @@ public class GeonetworkResolver extends HttpServlet{
try{
if(filterGetRecords!=null){
logger.info("I'm removing list of public IDs, Is it right? "+filterGetRecords);
in = GetResponseRecordFilter.removeSummaryIdsByListIds(new ByteArrayInputStream(byteArray.toByteArray()), filterGetRecords.getFoundPublicIds());
logger.info("I'm removing list of public IDs with "+filterGetRecords.getFoundPublicIds() +" IDs, Is it right?");
in = GetResponseRecordFilter.overrideResponseIdsByListIds(in, filterGetRecords.getFoundPublicIds());
}
int bytes = IOUtils.copy(in, out);
ReusableInputStream reus = new ReusableInputStream(in);
int bytes = IOUtils.copy(reus, out);
logger.trace("POST - RETURN : "+IOUtils.toString(reus));
if(bytes==0)
logger.warn("ResponseBody is empty, returning empty resp");
}catch(Exception e){

View File

@ -0,0 +1,78 @@
/**
*
*/
package org.gcube.datatransfer.resolver.gis.geonetwork;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 16, 2016
*/
public class ReusableInputStream extends InputStream {
private InputStream input;
private ByteArrayOutputStream output;
private ByteBuffer buffer;
public ReusableInputStream(InputStream input)
throws IOException {
this.input = input;
this.output = new ByteArrayOutputStream(input.available()); // Note:
// it's
// resizable
// anyway.
}
@Override
public int read()
throws IOException {
byte[] b = new byte[1];
read(b, 0, 1);
return b[0];
}
@Override
public int read(byte[] bytes)
throws IOException {
return read(bytes, 0, bytes.length);
}
@Override
public int read(byte[] bytes, int offset, int length)
throws IOException {
if (buffer == null) {
int read = input.read(bytes, offset, length);
if (read <= 0) {
input.close();
input = null;
buffer = ByteBuffer.wrap(output.toByteArray());
output = null;
return -1;
}
else {
output.write(bytes, offset, read);
return read;
}
}
else {
int read = Math.min(length, buffer.remaining());
if (read <= 0) {
buffer.flip();
return -1;
}
else {
buffer.get(bytes, offset, read);
return read;
}
}
}
// You might want to @Override flush(), close(), etc to delegate to input.
}

View File

@ -27,8 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
@ -38,6 +36,10 @@ import org.w3c.dom.NodeList;
*/
public class GetResponseRecordFilter {
/**
*
*/
private static final String A_PUBLIC_ID_PLEASE_IGNORE = "A public id please ignore";
public static Logger logger = LoggerFactory.getLogger(GetResponseRecordFilter.class);
/**
@ -50,16 +52,17 @@ public class GetResponseRecordFilter {
private static boolean deleteSummaryRecord(Document doc, String identifier) {
// <csw:SummaryRecord> list
NodeList nodes = doc.getElementsByTagName("csw:SummaryRecord");
logger.trace("SummaryRecord are: " + nodes.getLength());
NodeList nodes = doc.getElementsByTagName("gmd:MD_Metadata");
logger.trace("gmd:MD_Metadata are: " + nodes.getLength());
for (int i = 0; i < nodes.getLength(); i++) {
Element summaryRecord = (Element) nodes.item(i);
Element mdMetadata = (Element) nodes.item(i);
// <dc:identifier>
Element id = (Element) summaryRecord.getElementsByTagName("dc:identifier").item(0);
String idValue = id.getTextContent();
logger.trace("Summary dc:identifier is: " + idValue);
Element id = (Element) mdMetadata.getElementsByTagName("gmd:fileIdentifier").item(0);
Element gco = (Element) id.getElementsByTagName("gco:CharacterString").item(0);
String idValue = gco.getTextContent();
logger.trace("Summary gmd:fileIdentifier is: " + idValue);
if (idValue.equals(identifier)) {
summaryRecord.getParentNode().removeChild(summaryRecord);
mdMetadata.getParentNode().removeChild(mdMetadata);
logger.trace("Removed child " + idValue);
return true;
}
@ -67,6 +70,34 @@ public class GetResponseRecordFilter {
return false;
}
/**
* Override summary record.
*
* @param doc the doc
* @param identifier the identifier
* @return true, if successful
*/
private static boolean overrideSummaryRecord(Document doc, String identifier) {
// <csw:SummaryRecord> list
NodeList nodes = doc.getElementsByTagName("gmd:MD_Metadata");
logger.debug("gmd:MD_Metadata are: " + nodes.getLength());
for (int i = 0; i < nodes.getLength(); i++) {
Element mdMetadata = (Element) nodes.item(i);
// <dc:identifier>
Element id = (Element) mdMetadata.getElementsByTagName("gmd:fileIdentifier").item(0);
Element gco = (Element) id.getElementsByTagName("gco:CharacterString").item(0);
String idValue = gco.getTextContent();
logger.trace("Summary gmd:fileIdentifier is: " + idValue);
if (idValue.equals(identifier)) {
gco.setTextContent(A_PUBLIC_ID_PLEASE_IGNORE);
logger.debug("Overrided child " + idValue);
return true;
}
}
return false;
}
/**
* Removes the summary ids by list ids.
@ -76,7 +107,7 @@ public class GetResponseRecordFilter {
* @return the input stream
* @throws IOException Signals that an I/O exception has occurred.
*/
public static InputStream removeSummaryIdsByListIds(InputStream getRecordsResponse, List<String> idsToRemove) throws IOException {
public static InputStream overrideResponseIdsByListIds(InputStream getRecordsResponse, List<String> idsToRemove) throws IOException {
try {
// logger.trace("getRecordsResponse is: "+IOUtils.toString(getRecordsResponse));
@ -85,14 +116,15 @@ public class GetResponseRecordFilter {
dbf.setValidating(false);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(bis);
int removed = 0;
int override = 0;
for (String identifier : idsToRemove) {
if(deleteSummaryRecord(doc, identifier))
removed++;
if(overrideSummaryRecord(doc, identifier))
override++;
}
logger.debug("Removed "+removed +" node/s");
logger.debug("Overrided "+override +" node/s");
NodeList nodeList = doc.getElementsByTagName("csw:SearchResults");
//TODO IS IT POSSIBLE TO REMOVE?
/*NodeList nodeList = doc.getElementsByTagName("csw:SearchResults");
if(nodeList!=null && nodeList.item(0)!=null){
Node nd = nodeList.item(0);
// update staff attribute
@ -113,8 +145,7 @@ public class GetResponseRecordFilter {
}catch (Exception e) {
logger.warn("An error occurred during attribe numberOfRecordsMatched updating, skipping operation");
}
}
}*/
return documentToInputStream(doc);
}
catch (Exception e) {
@ -143,16 +174,19 @@ public class GetResponseRecordFilter {
}
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
File file = new File("GetResponseRecords.xml");
List<String> idsToRemove = new ArrayList<String>();
idsToRemove.add("fao-species-map-hef");
idsToRemove.add("fao-species-map-hea");
idsToRemove.add("fao-species-map-crb");
idsToRemove.add("fao-fsa-map-41.1.2");
idsToRemove.add("fao-species-map-sol");
idsToRemove.add("fao-species-map-sop");
try {
InputStream is = GetResponseRecordFilter.removeSummaryIdsByListIds(new FileInputStream(file), idsToRemove);
InputStream is = GetResponseRecordFilter.overrideResponseIdsByListIds(new FileInputStream(file), idsToRemove);
System.out.println(IOUtils.toString(is));
}
@ -160,6 +194,5 @@ public class GetResponseRecordFilter {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,466 @@
<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<csw:SearchStatus timestamp="2016-06-16T17:19:15" />
<csw:SearchResults numberOfRecordsMatched="1359" numberOfRecordsReturned="10" elementSet="brief" nextRecord="1220">
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-snk</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Thyrsites atun</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SNK&amp;bbox=-180.0,-90.0,180.0,90.0&amp;width=600&amp;height=300&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-180.0</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-90.0</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>180.0</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>90.0</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-soc</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Oncorhynchus nerka</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SOC&amp;bbox=130.0681,32.9042,250.22820000000002,72.0993&amp;width=600&amp;height=196&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>130.0681</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>34.9042</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>-109.77179999999998</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>70.0993</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-sol</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Solea solea</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SOL&amp;bbox=-19.7671,14.0685,41.4415,68.3647&amp;width=600&amp;height=532&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-17.7671</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>16.0685</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>39.4415</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>66.3647</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-son</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Somniosus pacificus</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SON&amp;bbox=117.5364,16.7333,251.3789,75.7452&amp;width=600&amp;height=265&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>117.5364</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>18.7333</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>-108.62110000000001</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>73.7452</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-sop</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Penaeus notialis</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SOP&amp;bbox=-90.9268,-25.8107,15.8536,25.329&amp;width=600&amp;height=287&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-88.9268</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-23.8107</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>13.8536</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>23.329</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-sor</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Somniosus rostratus</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SOR&amp;bbox=-87.429,2.8512000000000004,16.3107,51.051&amp;width=600&amp;height=279&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-85.429</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>4.8512</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>14.3107</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>49.051</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-spj</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Sphyrna tiburo</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SPJ&amp;bbox=-122.8181,-34.9314,-23.2731,43.915&amp;width=600&amp;height=475&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-120.8181</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-32.9314</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>-25.2731</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>41.915</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-spk</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Sphyrna mokarran</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SPK&amp;bbox=-128.5451,-7.0792,152.0144,49.2805&amp;width=600&amp;height=121&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-126.5451</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-5.0792</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>150.0144</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>47.2805</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-spl</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Sphyrna lewini</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SPL&amp;bbox=-180.0,-90.0,180.0,90.0&amp;width=600&amp;height=300&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-180.0</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-90.0</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>180.0</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>90.0</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
<gmd:fileIdentifier>
<gco:CharacterString>fao-species-map-spr</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng" />
</gmd:hierarchyLevel>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAO aquatic species distribution map of Sprattus sprattus</gco:CharacterString>
</gmd:title>
</gmd:CI_Citation>
</gmd:citation>
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>http://www.fao.org/figis/geoserver/wms?service=WMS&amp;version=1.1.0&amp;request=GetMap&amp;layers=fifao:UN_CONTINENT2,species:SPECIES_DIST_SPR&amp;bbox=-13.3797,27.8885,43.7761,67.9022&amp;width=600&amp;height=420&amp;srs=EPSG:4326&amp;format=image%2Fpng</gco:CharacterString>
</gmd:fileName>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-11.3797</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>29.8885</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:eastBoundLongitude>
<gco:Decimal>41.7761</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:northBoundLatitude>
<gco:Decimal>65.9022</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
</csw:SearchResults>
</csw:GetRecordsResponse>