Skip to content

Commit

Permalink
Provide CSW data as DCAT-AP.de RDF XML catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
seitenbau-govdata authored and jvanzadelhoff committed Jul 17, 2020
1 parent 3772f3c commit 7ff7a18
Show file tree
Hide file tree
Showing 4 changed files with 346 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/resources/camel-oai-pmh.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
harvester.base.url=${oai-pmh.base.url.external}/harvesters/
rdf.catalog.base.url=${oai-pmh.base.url.external:http:https://localhost:8080/omdf}/gp-csw/catalog.rdf
db.item.csw.TYPE=${db.item.csw.TYPE}
db.item.csw.URL=${db.item.csw.URL}
db.item.ckan.TYPE=${db.item.ckan.TYPE}
Expand Down
102 changes: 102 additions & 0 deletions src/main/resources/camel-oai-pmh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@

<!-- internal endpoint of processing route for csw catalogs -->
<endpoint id="csw" uri="direct:csw"/>
<!-- internal endpoint of processing route for csw catalogs into DCAT catalogs (instead of OAI-PMH) -->
<endpoint id="catalog" uri="direct:catalog"/>
<!-- internal endpoint of processing route for CKAN catalogs -->
<endpoint id="ckan" uri="direct:ckan"/>
<!-- internal endpoint of processing route for INSPIRE catalogs -->
<endpoint id="inspire" uri="direct:inspire"/>
<!-- internal endpoint of processing route for INSPIRE catalogs into DCAT catalogs -->
<endpoint id="catalog-inspire" uri="direct:catalog-inspire"/>
<!-- internal endpoint of processing route for INSPIRE catalogs via SOAP 1.1 -->
<endpoint id="inspireSoap11" uri="direct:inspireSoap11"/>
<!-- internal endpoint of processing route for INSPIRE catalogs via SOAP 1.2 -->
Expand All @@ -48,6 +52,7 @@
<endpoint id="cswIds" uri="servlet:https:///gp-csw/listIdentifiers?matchOnUriPrefix=true"/>
<endpoint id="cswRecords" uri="servlet:https:///gp-csw/listRecords?matchOnUriPrefix=true"/>
<endpoint id="cswRecord" uri="servlet:https:///gp-csw/getRecord?matchOnUriPrefix=true"/>
<endpoint id="dcatCatalog" uri="servlet:https:///gp-csw/catalog.rdf"/>

<!-- endpoint for harvester nrw ckan catalog -->
<endpoint id="ckanHarvesters" uri="servlet:https:///gp-ckan?matchOnUriPrefix=true"/>
Expand Down Expand Up @@ -76,6 +81,8 @@
<setHeader headerName="response_date">
<simple>${date:now:yyyy-MM-dd'T'HH:mm:ss'Z'}</simple>
</setHeader>
<removeHeader headerName="page"/>
<removeHeader headerName="cookie"/>
<!-- we need some element for xsl input, but the result only depends on header (request) parameters -->
<setBody>
<constant>&lt;dummy/&gt;</constant>
Expand Down Expand Up @@ -215,6 +222,69 @@
<to uri="direct:getCoupledServices"/>
</route>

<!-- route for INSPIRE catalogs output as RDF catalog -->
<route>
<from ref="catalog-inspire"/>
<setHeader headerName="response_date">
<simple>${date:now:yyyy-MM-dd'T'HH:mm:ss'Z'}</simple>
</setHeader>
<setHeader headerName="baseCatalogUri">
<simple>{{rdf.catalog.base.url}}</simple>
</setHeader>
<removeHeader headerName="resumptionToken"/>
<removeHeader headerName="cookie"/>
<!-- we need some element for xsl input, but the result only depends on header (request) parameters -->
<setBody>
<constant>&lt;dummy/&gt;</constant>
</setBody>
<to uri="xslt:inspireRequest.xsl"/>
<to uri="log:input"/>
<choice>
<when>
<!-- Only send a GetRecords request to the target catalog if we have not already created an OAI-PMH response -->
<xpath>count(/oai:OAI-PMH) = 0</xpath>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<choice>
<when>
<simple>${header.soapVersion} == '1.1'</simple>
<setHeader headerName="Content-Type">
<constant>text/xml</constant>
</setHeader>
</when>
<when>
<simple>${header.soapVersion} == '1.2'</simple>
<setHeader headerName="Content-Type">
<constant>application/soap+xml</constant>
</setHeader>
</when>
<otherwise>
<setHeader headerName="Content-Type">
<constant>application/xml</constant>
</setHeader>
</otherwise>
</choice>
<!-- Replaced dynamically with the target catalog URL -->
<to uri="http:https://dummy?httpClient.soTimeout=180000"/>
<!-- transform the GetRecordsResponse -->
<choice>
<when>
<simple>${header.out} == null</simple>
<to uri="xslt:inspireResponseDcatCatalog.xsl?uriResolverFactory=uriResolverFactory"/>
</when>
<when>
<simple>${header.out} != 'csw'</simple>
<to uri="xslt:inspireResponseDcatCatalog.xsl?uriResolverFactory=uriResolverFactory"/>
</when>
</choice>
</when>
</choice>
<setHeader headerName="Content-Type">
<constant>application/rdf+xml</constant>
</setHeader>
</route>

<!-- management route for harvester types -->
<route>
<from ref="mgmtHarvesterTypes"/>
Expand Down Expand Up @@ -248,6 +318,30 @@
</recipientList>
</route>

<route>
<from ref="catalog"/>
<setHeader headerName="CamelHttpUri">
<simple>{{db.item.csw.URL}}</simple>
</setHeader>
<setHeader headerName="CamelHttpPath">
<constant/>
</setHeader>
<choice>
<when>
<simple>${header.metadataPrefix} == null</simple>
<setHeader headerName="metadataPrefix">
<simple>dcat_ap</simple>
</setHeader>
</when>
</choice>
<recipientList>
<simple>catalog-inspire</simple>
<!-- If SOAP-specific settings are needed, add endpoints above and replace with:
<simple>catalog-{{db.item.csw.TYPE}}</simple>
-->
</recipientList>
</route>

<route>
<from ref="cswHarvesters"/>
<to ref="csw"/>
Expand Down Expand Up @@ -277,6 +371,14 @@
<to ref="csw"/>
</route>

<route>
<from ref="dcatCatalog"/>
<setHeader headerName="verb">
<simple>ListRecords</simple>
</setHeader>
<to ref="catalog"/>
</route>

<route>
<from ref="ckan"/>
<setHeader headerName="response_date">
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/inspireRequest.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<xsl:param name="until"/>
<xsl:param name="set"/>
<xsl:param name="resumptionToken"/>
<xsl:param name="page"/>
<xsl:param name="soapVersion"/>

<xsl:param name="response_date"/>
Expand Down Expand Up @@ -137,6 +138,14 @@
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$page and number($page) > 1">
<xsl:variable name="startPosition" select="((number($page) - 1) * $recordsPerPage) + 1"/>
<xsl:call-template name="getRecords">
<xsl:with-param name="startPosition" select="$startPosition"/>
<xsl:with-param name="fromParam" select="$from"/>
<xsl:with-param name="untilParam" select="$until"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="getRecords">
<xsl:with-param name="fromParam" select="$from"/>
Expand Down
Loading

0 comments on commit 7ff7a18

Please sign in to comment.