Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 1337 lines (1194 sloc) 45 KB
<?xml version="1.0"?>
<!--
Data HUb Service (DHuS) - For Space data distribution.
Copyright (C) 2013,2014,2015,2016 European Space Agency (ESA)
Copyright (C) 2013,2014,2015,2016 GAEL Systems
Copyright (C) 2013,2014,2015,2016 Serco Spa
This file is part of DHuS software sources.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE rdf:RDF [
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
<!ENTITY s2 "http://www.esa.int/s2#">
<!ENTITY drb "http://www.gael.fr/drb#">
<!ENTITY dhus "http://www.gael.fr/dhus#">
<!ENTITY img "http://www.gael.fr/drb/image#">
<!ENTITY jpeg2000 "http://www.gael.fr/drb/jpeg2000#">
]>
<rdf:RDF xmlns:owl ="&owl;"
xmlns:rdf ="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns:s2 ="&s2;"
xmlns:drb ="&drb;"
xmlns:img ="&img;"
xmlns:dhus="&dhus;"
xmlns:jpeg2000="&jpeg2000;"
xml:base ="&s2;">
<owl:Ontology rdf:about="&s2;"/>
<!-- USER PRODUCT -->
<rdf:Description rdf:about="&s2;userProduct">
<dhus:metadataTypes rdf:parseType="Literal">
<metadataType id="generationTime"
name="Generation time"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="format"
name="Format"
contentType="text/plain"
category="product">
<solrField name="format"
type="string"
required="true"/>
</metadataType>
<metadataType id="beginPosition"
name="Sensing start"
contentType="text/date+iso8601"
category="product">
<solrField name="beginposition"
type="tdate"/>
</metadataType>
<metadataType id="endPosition"
name="Sensing stop"
contentType="text/date+iso8601"
category="product">
<solrField name="endposition"
type="tdate"/>
</metadataType>
<metadataType id="processingbaseline"
name="Processing baseline"
contentType="text/plain"
category="product">
<solrField name="processingbaseline"
type="text_general"/>
</metadataType>
<metadataType id="platformName"
name="Satellite name"
contentType="text/plain"
category="platform">
<solrField name="platformname"
type="text_general"/>
</metadataType>
<metadataType id="platformNumber"
name="Satellite number"
contentType="text/plain"
category="platform">
</metadataType>
<metadataType id="filename"
name="Filename"
contentType="text/plain"
category="">
<solrField name="filename"
type="string"
required="true"/>
</metadataType>
<metadataType id="instrumentName"
name="Instrument name"
contentType="text/plain"
category="instrument">
<solrField name="instrumentname"
type="text_general"/>
</metadataType>
<metadataType id="instrumentShortName"
name="Instrument abbreviation"
contentType="text/plain"
category="instrument">
<solrField name="instrumentshortname"
type="text_general"/>
</metadataType>
<metadataType id="instrument"
name="Instrument"
contentType="text/plain"
category="summary">
</metadataType>
<metadataType id="date"
name="Date"
contentType="text/date+iso8601"
category="summary">
</metadataType>
<metadataType id="satellite"
name="Satellite"
contentType="text/plain"
category="summary">
</metadataType>
<metadataType id="size"
name="Size"
contentType="text/plain"
category="summary">
<solrField name="size"
type="string"/>
</metadataType>
<metadataType id="cloudCoverPercentage"
name="Cloud cover percentage"
contentType="text/plain"
category="product">
<solrField name="cloudcoverpercentage"
type="double"/>
</metadataType>
<metadataType id="dataTakeId"
name="Mission datatake id"
contentType="text/plain"
category="product">
<solrField name="s2datatakeid"
type="text_general"/>
</metadataType>
<metadataType id="orbitNumber"
name="Orbit number (start)"
contentType="text/integer"
category="product">
<solrField name="orbitnumber"
type="int"/>
</metadataType>
<metadataType id="relativeOrbitNumber"
name="Relative orbit (start)"
contentType="text/integer"
category="product">
<solrField name="relativeorbitnumber"
type="int"/>
</metadataType>
<metadataType id="productType"
name="Product type"
contentType="text/plain"
category="product">
<solrField name="producttype"
type="text_general"/>
</metadataType>
<metadataType id="sensorOperationalMode"
name="Instrument mode"
contentType="text/plain"
category="instrument">
<solrField name="sensoroperationalmode"
type="text_general"/>
</metadataType>
<metadataType id="GMLfootprint"
name="Footprint"
contentType="application/gml+xml"
category="product">
<solrField name="gmlfootprint"
type="string"/>
</metadataType>
<metadataType id="footprint"
name="JTS footprint"
contentType="application/jts"
category="product">
<solrField name="footprint"
type="location_rpt"/>
</metadataType>
<metadataType id="platformidentifier"
name="NSSDC identifier"
contentType="text/plain"
category="platform">
<solrField name="platformidentifier"
type="text_general"/>
</metadataType>
<metadataType id="orbitDirection"
name="Pass direction"
contentType="text/plain"
category="product">
<solrField name="orbitdirection"
type="text_general"/>
</metadataType>
<metadataType id="platformSerialIdentifier"
name="Platform serial identifier"
contentType="text/plain"
category="">
<solrField name="platformserialidentifier"
type="text_general"/>
</metadataType>
<metadataType id="processingLevel"
name="Processing level"
contentType="text/plain"
category="product">
<solrField name="processinglevel"
type="text_general"/>
</metadataType>
<metadataType id="degradedAncDataPercentage"
name="Degraded ancillary data percentage"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="degradedMsiDataPercentage"
name="Degraded MSI data percentage"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="sensorQualityFlag"
name="Sensor quality"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="geometryQualityFlag"
name="Geometric quality"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="generalQualityFlag"
name="General quality"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="formatCorrectnessFlag"
name="Format correctness"
contentType="text/plain"
category="product">
</metadataType>
<metadataType id="radiometricQualityFlag"
name="Radiometric quality"
contentType="text/plain"
category="product">
</metadataType>
</dhus:metadataTypes>
</rdf:Description>
<rdf:Description rdf:about="&s2;userProduct">
<dhus:support/>
<dhus:identifier rdf:parseType="Literal">
<![CDATA[
fn:tokenize(name (.), '\.')[1]
]]>
</dhus:identifier>
<dhus:metadataExtractor rdf:parseType="Literal">
<![CDATA[
<!-- XQuery methods -->
declare namespace
utils="java:fr.gael.drb.cortex.topic.sentinel2.Sentinel2Utils";
declare function local:cloudcoveragesequence() as xs:double*
{
fn:data(GRANULE/*/*[matches (name(), ".*\.xml")]/
*[matches (name(), "Level-.*")]/Quality_Indicators_Info/
*[matches (name(), ".*Image_Content_QI")]/CLOUDY_PIXEL_PERCENTAGE)
};
declare function local:computeSizes ($path, $base as item()*) as item()*
{
for $child in $path/*
return
if ($child/@directory)
then
local:computeSizes ($child, base)
else
data($child/@size), $base
};
let $metadata_node := *[matches (name(),
"(\w{8}_MTD_SAFL.[ABC]_.*|MTD_MSIL..)\.xml")]/
*[matches (name(),".*_User_Product")]
let $begin_position := fn:data($metadata_node/General_Info/*[matches(name(), ".*Product_Info")]/PRODUCT_START_TIME)
let $end_position := fn:data($metadata_node/General_Info/*[matches(name(), ".*Product_Info")]/PRODUCT_STOP_TIME)
return
(
<!-- Indexed metadata -->
<!-- GENERATION TIME -->
<metadata
category="product"
name="Generation time"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/GENERATION_TIME)
}
</metadata>,
<!-- FORMAT -->
<metadata
queryable="format"
category="product"
name="Format"
type="text/plain">
SAFE
</metadata>,
<!-- SENSING START -->
<metadata
queryable="beginposition"
category="product"
name="Sensing start"
type="text/date+iso8601">
{
$begin_position
}
</metadata>,
<!-- SENSING STOP -->
<metadata
queryable="endposition"
category="product"
name="Sensing stop"
type="text/date+iso8601">
{
$end_position
}
</metadata>,
<!-- PROCESSING BASELINE -->
<metadata
queryable="processingbaseline"
category="product"
name="Processing baseline"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/PROCESSING_BASELINE)
}
</metadata>,
<!-- SATELLITE -->
<metadata
queryable="platformname"
category="platform"
name="Satellite name"
type="text/plain">
Sentinel-2
</metadata>,
<metadata
category="platform"
name="Satellite number"
type="text/plain">
{
fn:substring(utils:getSatelliteByProductName(name()),3,1)
}
</metadata>,
<!-- FILENAME -->
<metadata
queryable="filename"
category=""
name="Filename"
type="text/plain">
{
name()
}
</metadata>,
<!-- INSTRUMENT -->
<metadata
queryable="instrumentname"
category="instrument"
name="Instrument name"
type="text/plain">
Multi-Spectral Instrument
</metadata>,
<metadata
queryable="instrumentshortname"
category="instrument"
name="Instrument abbreviation"
type="text/plain">
MSI
</metadata>,
<metadata
category="summary"
name="Instrument"
type="text/plain">
MSI
</metadata>,
<metadata category="summary"
name="Date"
type="text/date+iso8601">
{
$begin_position
}
</metadata>,
<metadata category="summary"
name="Satellite"
type="text/plain">
Sentinel-2
</metadata>,
<metadata queryable="size"
category="summary" name="Size" type="text/plain">
{
let $size := xs:double(fn:sum(local:computeSizes(., ())))
return
if ($size < 1024)
then
concat ($size, " bytes")
else
if (($size div 1024) < 1024)
then
concat (utils:formatNumber($size div 1024), " KB")
else
if (($size div (1024*1024)) < 1024)
then concat (utils:formatNumber($size div (1024*1024)), " MB")
else
if (($size div (1024*1024*1024)) < 1024)
then
concat (utils:formatNumber($size div (1024*1024*1024)), " GB")
else
concat (utils:formatNumber($size div (1024*1024*1024*1024)), " TB")
}
</metadata>,
<!-- CLOUD COVER PERCENTAGE -->
<metadata queryable="cloudcoverpercentage"
category="product"
name="Cloud cover percentage"
type="text/plain">
{
fn:avg(local:cloudcoveragesequence())
}
</metadata>,
<!-- MISSION DATATAKE ID -->
<metadata
queryable="s2datatakeid"
category="product"
name="Mission datatake id"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(),".*Product_Info")]/Datatake/@datatakeIdentifier)
}
</metadata>,
<!-- PRODUCT TYPE -->
<metadata
queryable="producttype"
category="product"
name="Product type"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/PRODUCT_TYPE)
}
</metadata>,
<!-- NSSDC IDENTIFIER -->
<metadata
queryable="platformidentifier"
category="platform"
name="NSSDC identifier"
type="text/plain">
{
fn:data(manifest.safe/XFDU/metadataSection/
metadataObject[@ID="platform"]/metadataWrap/
xmlData/platform/nssdcIdentifier)
}
</metadata>,
<!-- PASS DIRECTION -->
<metadata
queryable="orbitdirection"
category="product"
name="Pass direction"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/Datatake/
SENSING_ORBIT_DIRECTION)
}
</metadata>,
<!-- PLATFORM SERIAL IDENTIFIER -->
<metadata
category=""
name="Platform serial identifier"
queryable="platformserialidentifier"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/Datatake/
SPACECRAFT_NAME)
}
</metadata>,
<!-- PROCESSING LEVEL -->
<metadata
queryable="processinglevel"
category="product"
name="Processing level"
type="text/plain">
{
fn:data($metadata_node/General_Info/
*[matches(name(), ".*Product_Info")]/PROCESSING_LEVEL)
}
</metadata>,
<!-- DEGRADED ANCILLARY DATA PERCENTAGE -->
<metadata
category="product"
name="Degraded ancillary data percentage"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Technical_Quality_Assessment/DEGRADED_ANC_DATA_PERCENTAGE)
}
</metadata>,
<!-- DEGRADED MSI DATA PERCENTAGE -->
<metadata
category="product"
name="Degraded MSI data percentage"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Technical_Quality_Assessment/DEGRADED_MSI_DATA_PERCENTAGE)
}
</metadata>,
<!-- SENSOR QUALITY -->
<metadata
category="product"
name="Sensor quality"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Quality_Control_Checks/Quality_Inspections/SENSOR_QUALITY_FLAG)
}
</metadata>,
<!-- GEOMETRIC QUALITY -->
<metadata
category="product"
name="Geometric quality"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Quality_Control_Checks/Quality_Inspections/GEOMETRIC_QUALITY_FLAG)
}
</metadata>,
<!-- GENERAL QUALITY -->
<metadata
category="product"
name="General quality"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Quality_Control_Checks/Quality_Inspections/GENERAL_QUALITY_FLAG)
}
</metadata>,
<!-- FORMAT CORRECTNESS -->
<metadata
category="product"
name="Format correctness"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Quality_Control_Checks/Quality_Inspections/FORMAT_CORRECTNESS_FLAG)
}
</metadata>,
<!-- RADIOMETRIC QUALITY -->
<metadata
category="product"
name="Radiometric quality"
type="text/plain">
{
fn:data($metadata_node/
*[matches(name(), ".*Quality_Indicators_Info")]/
Quality_Control_Checks/Quality_Inspections/RADIOMETRIC_QUALITY_FLAG)
}
</metadata>
)
]]>
</dhus:metadataExtractor>
</rdf:Description>
<!-- USER PRODUCT L1C -->
<!-- Back to previous ID for compatibility
<rdf:Description rdf:about="&s2;userProductLevel1c">-->
<rdf:Description rdf:about="&s2;userLevel1CProduct">
<dhus:metadataExtractor rdf:parseType="Literal">
<![CDATA[
declare namespace
utils="java:fr.gael.drb.cortex.topic.sentinel2.Sentinel2Utils";
let $metadata_node :=
*[matches (name(), "(\w{8}_MTD_SAFL1[ABC]_.*|MTD_MSIL1C)\.xml")]/
Level-1C_User_Product
let $footprintL1C := $metadata_node/Geometric_Info/
Product_Footprint/Product_Footprint/Global_Footprint/EXT_POS_LIST
return
(
<!-- SENSOR MODE -->
<metadata
queryable="sensoroperationalmode"
category="instrument"
name="Instrument mode"
type="text/plain">
{
fn:data($metadata_node/General_Info/Product_Info/Datatake/DATATAKE_TYPE)
}
</metadata>,
<!-- GML FOOTPRINT -->
<metadata
queryable="gmlfootprint"
category="product"
name="Footprint"
type="application/gml+xml">
<gml:Polygon
xmlns:gml="http://www.opengis.net/gml"
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>
{
utils:xYPoints2GML(fn:data($footprintL1C))
}
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</metadata>,
<!-- JTS FOOTPRINT -->
<metadata
queryable="footprint"
category="product"
name="JTS footprint"
type="application/jts">
{
concat("POLYGON ((",utils:xYPoints2JTS(fn:data($footprintL1C)),"))")
}
</metadata>,
<!-- -->
<!-- ABSOLUTE ORBIT -->
<metadata
queryable="orbitnumber"
category="product"
name="Orbit number (start)"
type="text/integer">
{
utils:getAbsoluteOrbitFromDatatakeFilename(
fn:data($metadata_node/General_Info/
*[matches (name(),".*Product_Info")]/Datatake/
@datatakeIdentifier))
}
</metadata>,
<!-- RELATIVE ORBIT -->
<metadata
queryable="relativeorbitnumber"
category="product"
name="Relative orbit (start)"
type="text/integer">
{
utils:filterUselessZeros(fn:data($metadata_node/General_Info/
Product_Info/Datatake/SENSING_ORBIT_NUMBER))
}
</metadata>
)
]]>
</dhus:metadataExtractor>
<img:descriptor rdf:parseType="Literal">
<img:query>
<![CDATA[
declare function local:checkPath($path as xs:string?) as xs:string
{
let $nodes :=
(
for $node in fn:tokenize ($path, '/')
return
concat('*[name()="', $node, '"]')
)
return
concat ('/',fn:string-join ($nodes, '/'))
};
declare function local:listdata()
{
(: Commented since quality of the PNG is not sure
This will be uncommented when the PNG will be well processed
let $png := *[fn:matches(fn:name(),".*\.png")]
let $data := if (fn:exists($png)) then $png else
GRANULE/*/QI_DATA/*[fn:matches(fn:name(), ".*\.jp2")]
:)
let $data :=
GRANULE/*/QI_DATA/*[fn:matches(fn:name(), ".*\.jp2")]
for $node in $data
return
local:checkPath(drb:path($node))
};
declare function local:createCollection ()
{
<img:collection xmlns:img="http://www.gael.fr/drb/image#">
{
for $data in local:listdata()
return
(: look at all BrowseImage files :)
<img:raster name="previews">
<img:source>
{$data}
</img:source>
</img:raster>
}
</img:collection>
};
local:createCollection()
]]>
</img:query>
</img:descriptor>
<img:rendering rdf:parseType="Literal" xmlns:img="&img;">
<img:operator name="pass-flip">
<img:script language="beanshell" version="1.0">
return fr.gael.drb.cortex.topic.sentinel2.Sentinel2Image.processLocatedImage (source,1, 10, 10);
</img:script>
</img:operator>
</img:rendering>
</rdf:Description>
<!-- USER PRODUCT L2A -->
<!-- Back to previous ID for compatibility
<rdf:Description rdf:about="&s2;userProductLevel2a">-->
<rdf:Description rdf:about="&s2;userLevel2AProduct">
<dhus:metadataTypes rdf:parseType="Literal">
<metadataType id="vegetationpercentage"
name="Vegetation percentage"
contentType="text/plain"
category="product">
<solrField name="vegetationpercentage"
type="double"/>
</metadataType>
<metadataType id="baresoilpercentage"
name="Bare soils percentage"
contentType="text/plain"
category="product">
<solrField name="baresoilpercentage"
type="double"/>
</metadataType>
<metadataType id="waterpercentage"
name="Water percentage"
contentType="text/plain"
category="product">
<solrField name="waterpercentage"
type="double"/>
</metadataType>
<metadataType id="lowprobacloudspercentage"
name="Low proba clouds percentage"
contentType="text/plain"
category="product">
<solrField name="lowprobacloudspercentage"
type="double"/>
</metadataType>
<metadataType id="mediumprobacloudspercentage"
name="Medium proba clouds percentage"
contentType="text/plain"
category="product">
<solrField name="mediumprobacloudspercentage"
type="double"/>
</metadataType>
<metadataType id="highprobacloudspercentage"
name="High proba clouds percentage"
contentType="text/plain"
category="product">
<solrField name="highprobacloudspercentage"
type="double"/>
</metadataType>
<metadataType id="snowicepercentage"
name="Snow ice percentage"
contentType="text/plain"
category="product">
<solrField name="snowicepercentage"
type="double"/>
</metadataType>
<metadataType id="orbitNumber"
name="Orbit number (start)"
contentType="text/integer"
category="product">
<solrField name="orbitnumber"
type="int"/>
</metadataType>
<metadataType id="relativeOrbitNumber"
name="Relative orbit (start)"
contentType="text/integer"
category="product">
<solrField name="relativeorbitnumber"
type="int"/>
</metadataType>
</dhus:metadataTypes>
</rdf:Description>
<!-- Back to previous ID for compatibility
<rdf:Description rdf:about="&s2;userProductLevel2a">-->
<rdf:Description rdf:about="&s2;userLevel2AProduct">
<dhus:metadataExtractor rdf:parseType="Literal">
<![CDATA[
declare namespace
utils="java:fr.gael.drb.cortex.topic.sentinel2.Sentinel2Utils";
let $footprintL2A := fn:data(*[matches (name(),
"\w{8}_MTD_SAFL2[ABC]_.*\.xml")]/Level-2A_User_Product/
Geometric_Info/Product_Footprint/Product_Footprint/
Global_Footprint/EXT_POS_LIST)
return
(
<!-- SENSOR MODE -->
<metadata
queryable="sensoroperationalmode"
category="instrument"
name="Instrument mode"
type="text/plain">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL2[ABC]_.*\.xml")]/
Level-2A_User_Product/
General_Info/
L2A_Product_Info/
Datatake/
DATATAKE_TYPE
)
}
</metadata>,
<!-- GML FOOTPRINT -->
<metadata
queryable="gmlfootprint"
category="product"
name="Footprint"
type="application/gml+xml">
<gml:Polygon
xmlns:gml="http://www.opengis.net/gml"
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>
{
utils:xYPoints2GML($footprintL2A)
}
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</metadata>,
<!-- JTS FOOTPRINT -->
<metadata
queryable="footprint"
category="product"
name="JTS footprint"
type="application/jts">
{
concat("POLYGON ((",utils:xYPoints2JTS($footprintL2A ),"))")
}
</metadata>,
<!-- ABSOLUTE ORBIT -->
<metadata
queryable="orbitnumber"
category="product"
name="Orbit number (start)"
type="text/integer">
{
xs:integer(fn:substring(name(GRANULE/*[matches (name(), "\w{8}_MSI_L.[ABC]_.*")]),43,6))
}
</metadata>,
<!-- RELATIVE ORBIT -->
<metadata
queryable="relativeorbitnumber"
category="product"
name="Relative orbit (start)"
type="text/integer">
{
fn:substring (name(),43, 3 )
}
</metadata>,
<!-- VEGETATION PERCENTAGE -->
<metadata
queryable="vegetationpercentage"
category="product"
name="Vegetation percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
VEGETATION_PERCENTAGE)
}
</metadata>,
<!-- BARE SOILS PERCENTAGE -->
<metadata
queryable="baresoilpercentage"
category="product"
name="Bare soils percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
BARE_SOILS_PERCENTAGE)
}
</metadata>,
<!-- WATER PERCENTAGE -->
<metadata
queryable="waterpercentage"
category="product"
name="Water percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
WATER_PERCENTAGE)
}
</metadata>,
<!-- LOW PROBA CLOUDS PERCENTAGE -->
<metadata
queryable="lowprobacloudspercentage"
category="product"
name="Low proba clouds percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
LOW_PROBA_CLOUDS_PERCENTAGE)
}
</metadata>,
<!-- MEDIUM PROBA CLOUDS PERCENTAGE -->
<metadata
queryable="mediumprobacloudspercentage"
category="product"
name="Medium proba clouds percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
MEDIUM_PROBA_CLOUDS_PERCENTAGE)
}
</metadata>,
<!-- HIGH PROBA CLOUDS PERCENTAGE -->
<metadata
queryable="highprobacloudspercentage"
category="product"
name="High proba clouds percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
HIGH_PROBA_CLOUDS_PERCENTAGE)
}
</metadata>,
<!-- SNOW ICE PERCENTAGE -->
<metadata
queryable="snowicepercentage"
category="product"
name="Snow ice percentage"
type="text/integer">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL.[ABC]_.*\.xml")]/
*[matches(name(), ".*User_Product")]/
L2A_Quality_Indicators_Info/
Image_Content_QI/
SNOW_ICE_PERCENTAGE)
}
</metadata>
)
]]>
</dhus:metadataExtractor>
<img:descriptor rdf:parseType="Literal">
<img:query>
<![CDATA[
declare function local:checkPath($path as xs:string?) as xs:string
{
let $nodes :=
(
for $node in fn:tokenize ($path, '/')
return
concat('*[name()="', $node, '"]')
)
return
concat ('/',fn:string-join ($nodes, '/'))
};
declare function local:listdata()
{
let $png := *[fn:matches(fn:name(),".*\.png")]
let $data := if (fn:exists ($png)) then $png else
GRANULE/*/QI_DATA/*[fn:matches(fn:name(), ".*PVI.*[A-Z](?!_20m)\.jp2")]
for $node in $data
return
local:checkPath(drb:path($node))
};
declare function local:createCollection ()
{
<img:collection xmlns:img="http://www.gael.fr/drb/image#">
{
for $data in local:listdata()
return
(: look at all BrowseImage files :)
<img:raster name="previews">
<img:source>
{$data}
</img:source>
</img:raster>
}
</img:collection>
};
local:createCollection()
]]>
</img:query>
</img:descriptor>
<img:rendering rdf:parseType="Literal" xmlns:img="&img;">
<img:operator name="pass-flip">
<img:script language="beanshell" version="1.0">
ParameterBlock pb = new ParameterBlock ();
pb.addSource (source);
pb.add (DataBuffer.TYPE_BYTE);
return JAI.create ("format", pb);;
</img:script>
</img:operator>
</img:rendering>
</rdf:Description>
<!-- USER PRODUCT L1B -->
<!-- Back to previous ID for compatibility
<rdf:Description rdf:about="&s2;userProductLevel1b">-->
<rdf:Description rdf:about="&s2;userLevel1BProduct">
<dhus:metadataExtractor rdf:parseType="Literal">
<![CDATA[
declare namespace
utils="java:fr.gael.drb.cortex.topic.sentinel2.Sentinel2Utils";
declare variable $footprintL1B := fn:data(*[matches (name(),
"\w{8}_MTD_SAFL1B_.*\.xml")]/Level-1B_User_Product/Geometric_Info/
Product_Footprint/Product_Footprint/Global_Footprint/EXT_POS_LIST);
<!-- SENSOR MODE -->
<metadata
queryable="sensoroperationalmode"
category="instrument"
name="Instrument mode"
type="text/plain">
{
fn:data(*[matches (name(), "\w{8}_MTD_SAFL1[ABC]_.*\.xml")]/
Level-1B_User_Product/General_Info/Product_Info/Datatake/
DATATAKE_TYPE)
}
</metadata>,
<!-- GML FOOTPRINT -->
<metadata
queryable="gmlfootprint"
category="product"
name="Footprint"
type="application/gml+xml">
<gml:Polygon
xmlns:gml="http://www.opengis.net/gml"
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>
{
utils:xYPoints2GML($footprintL1B)
}
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</metadata>,
<!-- JTS FOOTPRINT -->
<metadata
queryable="footprint"
category="product"
name="JTS footprint"
type="application/jts">
{
concat("POLYGON ((",utils:xYPoints2JTS($footprintL1B),"))")
}
</metadata>
]]>
</dhus:metadataExtractor>
<img:descriptor rdf:parseType="Literal">
<img:query>
<![CDATA[
declare function local:checkPath($path as xs:string?) as xs:string
{
let $nodes :=
(
for $node in fn:tokenize ($path, '/')
return
concat('*[name()="', $node, '"]')
)
return
concat ('/',fn:string-join ($nodes, '/'))
};
declare function local:listdata()
{
(: Commented since quality of the PNG is not sure
This will be uncommented when the PNG will be well processed
let $png := *[fn:matches(fn:name(),".*\.png")]
let $data := if (fn:exists ($png)) then $png else
GRANULE/*/IMG_DATA/*[fn:matches(fn:name(),".*B(01|09|10)\.jp2")]
:)
let $data :=
GRANULE/*/IMG_DATA/*[fn:matches(fn:name(),".*B(01|09|10)\.jp2")]
for $node in $data
return
local:checkPath(drb:path($node))
};
declare function local:createCollection ()
{
<img:collection xmlns:img="http://www.gael.fr/drb/image#">
{
for $data in local:listdata()
return
(: look at all BrowseImage files :)
<img:raster name="previews">
<img:source>
{$data}
</img:source>
</img:raster>
}
</img:collection>
};
local:createCollection()
]]>
</img:query>
</img:descriptor>
<img:rendering rdf:parseType="Literal" xmlns:img="&img;">
<img:operator name="rgb-compos">
<img:script language="beanshell" version="1.0">
pb = new ParameterBlock();
iterator=source.getChildren().iterator();
while (iterator.hasNext())
pb.addSource(iterator.next());
img = JAI.create("bandmerge",pb);
pb = new ParameterBlock();
pb.addSource(img);
pb.add(DataBuffer.TYPE_BYTE);
img = JAI.create("Format", pb);
return JAI.create("bandSelect", img, new int[] {2, 1, 0});
/* 1B implementation is not efficient.
pb = new ParameterBlock();
pb.addSource(fr.gael.drb.cortex.topic.sentinel2.Sentinel2Image.process1BImage(source, 1, 10, 10));
pb.add(DataBuffer.TYPE_BYTE);
img = JAI.create("Format", pb);
*/
</img:script>
</img:operator>
</img:rendering>
</rdf:Description>
<!-- Enforce S2.../IMG_DATA/*.jp2 as FileNodes
<owl:Class rdf:about="&s2;userProductOneGranuleFolder">
<rdfs:label xml:lang="en">User Product Granule container folder</rdfs:label>
<rdfs:subClassOf rdf:resource="&drb;item"/>
<drb:signature rdf:parseType="Resource">
<drb:parentClassTest>&s2;userProductGranuleFolder</drb:parentClassTest>
<drb:nameMatch>S2[AB]_...._MSI_.*\.\d\d</drb:nameMatch>
</drb:signature>
</owl:Class>
<owl:Class rdf:about="&s2;userProductGranuleImageFolder">
<rdfs:label xml:lang="en">User Product Granule IMG folder</rdfs:label>
<rdfs:subClassOf rdf:resource="&drb;item"/>
<drb:signature rdf:parseType="Resource">
<drb:parentIsSubClassTest>&s2;userProductOneGranuleFolder</drb:parentIsSubClassTest>
<drb:nameTest>IMG_DATA</drb:nameTest>
</drb:signature>
</owl:Class>
<owl:Class rdf:about="&s2;userProductGranule">
<rdfs:label xml:lang="en">User Product jp2k Granule Image.</rdfs:label>
<rdfs:subClassOf rdf:resource="&jpeg2000;JPEG2000"/>
<drb:signature rdf:parseType="Resource">
<drb:parentIsSubClassTest>&s2;userProductGranuleImageFolder</drb:parentIsSubClassTest>
<drb:nameMatch>.*\.jp2</drb:nameMatch>
</drb:signature>
<drb:implementationIdentifier>file</drb:implementationIdentifier>
</owl:Class>
-->
<!-- Overrides in order to see JPEG2000 files as simple files
<owl:Class rdf:about="&s2;level1cTileImageFileFileImplementation">
<rdfs:label xml:lang="en">Level-1C Tile Image File (File Implementation).</rdfs:label>
<rdfs:subClassOf rdf:resource="&s2;level1cTileImageFile"/>
<drb:implementationIdentifier>file</drb:implementationIdentifier>
</owl:Class>
<owl:Class rdf:about="&s2;level1aImageFileFileImplementation">
<rdfs:label xml:lang="en">Level-1A Image File (File Implementation).</rdfs:label>
<rdfs:subClassOf rdf:resource="&s2;level1aImageFile"/>
<drb:implementationIdentifier>file</drb:implementationIdentifier>
</owl:Class>
<owl:Class rdf:about="&s2;level1bImageFileFileImplementation">
<rdfs:label xml:lang="en">Level-1B Image File (File Implementation).</rdfs:label>
<rdfs:subClassOf rdf:resource="&s2;level1bImageFile"/>
<drb:implementationIdentifier>file</drb:implementationIdentifier>
</owl:Class>
<owl:Class rdf:about="&s2;level0QuicklookFileFileImplementation">
<rdfs:label xml:lang="en">Level-0 QuickLook File (File Implementation).</rdfs:label>
<rdfs:subClassOf rdf:resource="&s2;level0QuicklookFile"/>
<drb:implementationIdentifier>file</drb:implementationIdentifier>
</owl:Class>
-->
</rdf:RDF>
You can’t perform that action at this time.